These 4 lines causes the app to crash. If i change to UIImagePickerControllerSourceTypePhotoLibrary as source type it works like a charm. It has nothing to do with my current app. Create a new project and added these 4 lines to a UIButton and it still crashes.
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self addChildViewController:picker];
[self.view addSubview:picker.view];
I've also tried
[self presentViewController:picker animated:YES completion:^{}];
and
popController = [[UIPopoverController alloc] initWithContentViewController:picker];
[popController presentPopoverFromRect:button.bounds inView:button permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
It will all cause this crash:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[0]' * First throw call stack: (0x2e17af53 0x388f06af 0x2e0b923b 0x2e0b9003 0x30961f39 0x30961ba1 0x308fa1b7 0x346f5e9b 0x308ec023 0x3057524b 0x30570a5b 0x305708ed 0x305702ff 0x3057010f 0x308e4343 0x2e1461d5 0x2e143b79 0x2e143ebb 0x2e0aece7 0x2e0aeacb 0x32d89283 0x30950a41 0x18135 0x38df8ab7) libc++abi.dylib: terminating with uncaught exception of type NSException
Running iOS 7.0.2 on iPad 2.