iOS8 call to the camera warning: snapshotting A view that have not been rendered results in an empty snapshot. Ensure you (GO)

Source: Internet
Author: User

I also reported this warning, but according to his method does not work, write to this place to see if other people use the

Error code: Snapshotting A view that have not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

Problem Analysis: IOS8 in the call system camera, there will be a two-second pause, and then pop-up Uiimagepickconroller,ios7 is not the problem, in Baidu to find countless times have not been able to solve the problem, Have said to set the Imagepickcontroller as a global variable, have said to delay 0.5 seconds again presentviewcontroller, recount, but unfortunately did not solve this problem, today deliberately alone to write a demo to study this problem, finally made a breakthrough progress!

In fact, the root cause is not the system camera controller above, but the implementation of Presentviewcontroller this action itself! We can look at the next uiviewcontroller this class, he has a property

[Objective-c]Plain Text view copy code
@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle NS_AVAILABLE_IOS(3_2);

This is an enumeration value, as defined in the SDK for IOS7:

[Objective-c]Plain Text view copy code
typedefNS_ENUM(NSInteger, UIModalPresentationStyle) {    UIModalPresentationFullScreen = 0,#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2    UIModalPresentationPageSheet,    UIModalPresentationFormSheet,    UIModalPresentationCurrentContext,#endif#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_7_0    UIModalPresentationCustom,    UIModalPresentationNone = -1,        #endif       };

The following are defined in the SDK for IOS8:

[Objective-c]Plain Text view copy code
typedefNS_ENUM(NSInteger, UIModalPresentationStyle) {        UIModalPresentationFullScreen = 0,        UIModalPresentationPageSheetNS_ENUM_AVAILABLE_IOS(3_2),        UIModalPresentationFormSheetNS_ENUM_AVAILABLE_IOS(3_2),        UIModalPresentationCurrentContextNS_ENUM_AVAILABLE_IOS(3_2),        UIModalPresentationCustomNS_ENUM_AVAILABLE_IOS(7_0),        UIModalPresentationOverFullScreenNS_ENUM_AVAILABLE_IOS(8_0),        UIModalPresentationOverCurrentContextNS_ENUM_AVAILABLE_IOS(8_0),        UIModalPresentationPopoverNS_ENUM_AVAILABLE_IOS(8_0),        UIModalPresentationNoneNS_ENUM_AVAILABLE_IOS(7_0) = -1,         };

The key to solving the problem came, IOS8 a more style uimodalpresentationovercurrentcontext, IOS8 Presentviewcontroller when the controller Modalpresentationstyle set to Uimodalpresentationovercurrentcontext, solve the problem!!

[Objective-c]Plain Text view copy code
if([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) {    self.modalPresentationStyle=UIModalPresentationOverCurrentContext;} 

iOS8 call to the camera warning: snapshotting A view that have not been rendered results in an empty snapshot. Ensure you (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.