Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 7: UIWebView crashes because of range exception

I'm currently building an App that uses the krpano viewer, which is a Panorama Viewer built with JavaScript. I'm loading this Panorama viewer in a UIWebView with local images that are saved on the iPad.

But after using the Panorama viewer for a while, I get this error and the app crashes:

Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[WebCoreSharedBufferData getBytes:range:]: range {0, 4000} exceeds data length 0'
*** First throw call stack:
(0x2e213f53 0x38a226af 0x2e213e95 0x2eb4dc31 0x2e16ca65 0x2ef4ce47 0x2ef4cd21 0x2ef68f03 0x2ef682db 0x2ef68029 0x2ef67e61 0x2ef67dcf 0x2ef6bd39 0x2ef6b813 0x2ef5471f 0x2e29b2ed 0x30635c6d 0x30635117 0x30621069 0x30620bad 0x3061d949 0x3061c051 0x38f0c297 0x38f0c09b 0x38f0cd15 0x38f0cf8d 0x39047dbf 0x39047c84)
libc++abi.dylib: terminating with uncaught exception of type NSException

Does anyone have an idea why this happens? When I load the online page in the UIWebView there is no problem.

Thanks for your help!

like image 700
chritaso Avatar asked Nov 12 '22 21:11

chritaso


1 Answers

This is probably a memory related issue. When a web application allocates too much memory using Javascript, weird things will happen.

Your best bet is to observe memory warning notifications and try to influence the web app from the outside. Of course this depends on the specifics of the web app but you might want to try disabling userInteractionEnabled for a while to let the web view catch up with queued user input actions or, if the memory warning persists, try to reload the web view.

Unfortunately there are no easy solutions here.

like image 95
Ortwin Gentz Avatar answered Dec 16 '22 05:12

Ortwin Gentz