Present a UIImagePickerController results in temporary black screen
All,
I am developing an application that shows an initial page, then presents a UIImagePickerController with presentModalViewController:animated:.
After taking the photo, it returns to the initial page, dismiss the UIImagePickerController with dismissModalViewControllerAnimated:. Then save the photo and write a record in a table in SQLite database. It presents the UIImagePickerController again after triggered by tapping a button.
It works fine on iOS 4 and 5. But there is a little problem when running on iOS 6.
When the app re-presents the UIImagePickerController (that mean present and dismiss at least once before), the preview screen of the camera will be black for 5-6 seconds (for iOS 6 on iPhone 5, and 10-15 seconds for iOS 6 on iPhone 4 and 4S). And the console log shows the following message when the preview screen back to normal,
<Warning>: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces.
I have already noticed that the old methods presentModalViewController:animated: and dismissModalViewControllerAnimated: are deprecated on iOS 6 and I have made necessary changes. But the problem continues.
Here is my code:
For presenting the UIImagePickerController:
NSString *requiredSystemVersion = version6_0;
if ([Utils checkCurrentOSVersionOlderThanVersion:requiredSystemVersion]) {
[[self navigationController] presentModalViewController:picker animated:YES];
} else {
[[self navigationController] presentViewController:picker animated:YES completion:NULL];
}
For dismissing the UIImagePickerController:
NSString *requiredSystemVersion = version6_0;
if ([UtilscheckCurrentOSVersionOlderThanVersion:requiredSystemVersion]) {
[[selfnavigationController] dismissModalViewControllerAnimated:YES];
} else {
[[selfnavigationController] dismissViewControllerAnimated:YEScompletion:NULL];
}
where checkCurrentOSVersionOlderThanVersion: is for checking the OS version is older than the 6.0.
XCode version: 4.2 on Max OS 10.6.8
Would anyone can lend a hand for helping on this issue? Or it is some default behavior on iOS 6?
Thanks in advance.
Dart