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
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:
[Objective-c]Plain Text view copy code
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!!
[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)