Friday, January 29, 2016

Bug in Apple chess Program

I am interested in playing chess game with computer lot of my times. Like that i played a game two months back with apple chess program. In that i found a bug in Pawn move by computer and even that bug allow for user move to.

Produced in :- iMac OS Version: OS X Yosemite /Version-10.10.5

Videos :

1) Bug by Computer Move :


2) Bug by human move:



Moves Screenshot:



Sunday, January 24, 2016

UIAlertview issues in iOS 8 and above


Welcome all once again after long month back.

Last two day's back i had faced one issue in one of my project by using Alertview in iOS 9. The issue is External keyboard or sometime Default keyboard not worked properly . If i typed in the textfield, textfield didn't display any value in it. After a long try i found the solution because of UIAlertview causing the problem. So here is the fix,

if your app support lower then iOS 8 then we need to Whether the iOS Version is lower then 8.0 or UIAlertController class object is present either way we can use it.

Objective-C:-

if (([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] == NSOrderedAscending)) { 
     // use UIAlertView
}
else { 
    // use UIAlertController 
}


//or

 if ([UIAlertController class]) { 
      // use UIAlertController
 } 
 else { 
     // use UIAlertView
 }



Swift :-

if objc_getClass("UIAlertController") == nil {
// use UIAlertView
} else { // use UIAlertController 
}

//or

if (NSClassFromString("UIAlertController") != nil) {
// use UIAlertView
}
else {
// use UIAlertController 
}



Base on the condition display UIAlertview or UIAlertController for it.

Note: 
1) Don't try and work out this based on the OS version. You need to detect abilities not OS.(Refer here.)

2) While using UIAlertController need Viewcontroller to present it, So we can't able to present UIAlertController in viewDidLoad. You will get an warning 'Warning: Attempt to present <UIAlertController: 0x13550e280> on <ViewController: 0x13560a470> whose view is not in the window hierarchy!'. So be aware of it also.

Saturday, November 21, 2015

Welcome

I am Velmurugan S, Started career as iOS Developer. In this blog i plan to share the code snippet that i came across and various topic related to programming. Thank all to support writing this blog.