IOS8 post-Uiimagepickconroller warning prompt workaround

Source: Internet
Author: User

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

@property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle NS_AVAILABLE_IOS(3_2);

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

typedef NS_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:

typedef NS_ENUM ( NSInteger , UIModalPresentationStyle) {          UIModalPresentationFullScreen = 0,          UIModalPresentationPageSheet  NS_ENUM_AVAILABLE_IOS (3_2),          UIModalPresentationFormSheet  NS_ENUM_AVAILABLE_IOS (3_2),          UIModalPresentationCurrentContext  NS_ENUM_AVAILABLE_IOS (3_2),          UIModalPresentationCustom  NS_ENUM_AVAILABLE_IOS (7_0),          UIModalPresentationOverFullScreen  NS_ENUM_AVAILABLE_IOS (8_0),          UIModalPresentationOverCurrentContext  NS_ENUM_AVAILABLE_IOS (8_0),          UIModalPresentationPopover  NS_ENUM_AVAILABLE_IOS (8_0),          UIModalPresentationNone  NS_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!!

if ([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0) {      self .modalPresentationStyle=UIModalPresentationOverCurrentContext; }

IOS8 post-Uiimagepickconroller warning prompt workaround

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.