App crash vulnerability in iOS 6.0 and above

A

while setting a root viewcontroller of the app one must make sure that navigationcontroller object has been set rootviewcontroller of the window and not been added as subview of the window. It was ok in iOS 5.1 and lower versions but for iOS 6.0 and above it can cause crash issue.

I’ll explain using the below code snippet which is used in the app delegate of the app.

StartScreenViewController * obj = [ [StartScreenViewController alloc] init];

UINavigationController * nav = [ [UINavigationController alloc] initWithRootViewController:obj];

use

[self.window setRootViewController:nav];

instead of

[self.window addSubview:nav.view];

 

About the author

shailesh.zambad
By shailesh.zambad

Category