I am using the third CocoaPods library written in Objective-C to take a screenshot of a UITextView. This was fine for iOS 8, but after I changed the syntax for iOS 9 and Swift 2, it throws an error:
Application termination due to uncaught exception "CALayerInvalidGeometry", reason: "sublevel with non-final position [inf inf]"
Here is the code from the library:
- (UIImage *)screenshotForCroppingRect:(CGRect)croppingRect { UIGraphicsBeginImageContextWithOptions(croppingRect.size, NO, [UIScreen mainScreen].scale);
The problem is this line:
[self.layer renderInContext:context]
I understand this because I am trying to take a snapshot of a UIView that contains a UIScrollView. If I remove the UIScrollView routine, the error will disappear.
And what does it mean?
sublevel with non-final position [inf inf]
Does anyone have the same problem and how did you solve it?
source share