ios - sublayer with non-finite position [inf inf] -


i using third cocoapods library written in objective-c take screenshot of uitextview. ok ios 8, after change syntax ios 9 , swift 2, throws error:

terminating app due uncaught exception 'calayerinvalidgeometry', reason: 'sublayer non-finite position [inf inf]'

here code library:

- (uiimage *)screenshotforcroppingrect:(cgrect)croppingrect {     uigraphicsbeginimagecontextwithoptions(croppingrect.size, no, [uiscreen mainscreen].scale);     // create graphics context , translate view want crop     // in grabbing (0,0), origin point represents actual     // cropping origin desired:     cgcontextref context = uigraphicsgetcurrentcontext();     if (context == null) return nil;      nslog(@"hiii :%f" , croppingrect.size.width);      cgcontexttranslatectm(context, -croppingrect.origin.x, -croppingrect.origin.y);      [self layoutifneeded];     [self.layer renderincontext:context];      uiimage *screenshotimage = uigraphicsgetimagefromcurrentimagecontext();     uigraphicsendimagecontext();     return screenshotimage; } 

the problem line:

[self.layer renderincontext:context]; 

i realize because trying take snapshot of uiview contain uiscrollview. if remove uiscrollview subview, error gone.

so mean?

sublayer non-finite position [inf inf]

anyone having same issue , how did solve it?

here how solved this:

following post

https://github.com/facebook/ios-snapshot-test-case/issues/112

the error coming library used, search on files , find out

cgrectnull 

and change them

cgrectzero 

that resolved problem.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -