When I'm trying to select images from camera rolls, I'm getting the following warning. (when I press the button camera rolls it goes to select albums page where we can select images from our phone).
Presenting view controllers on detached view controllers is discouraged
My didFinishLaunchingWithOptions
method is like this:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[application setStatusBarHidden:YES];
NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
[userDefault synchronize];
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.viewController = [[ViewController alloc] init];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:self.viewController];
self.window.rootViewController = navigation;
navigation.navigationBarHidden = YES;
[self.window makeKeyAndVisible];
}
My camera button code is:
- (void)cameraButtonSelected
{
ELCAlbumPickerController *albumController = [[ELCAlbumPickerController alloc] initWithNibName:nil bundle:nil];
ELCImagePickerController *elcPicker = [[ELCImagePickerController alloc] initWithRootViewController:albumController];
[albumController setParent:elcPicker];
[elcPicker setDelegate:self];
AppDelegate *app = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[app.viewController presentViewController:elcPicker animated:YES completion:nil];
[self.view.window.rootViewController.navigationController pushViewController:elcPicker animated:YES];
}