iOS App crashes on loading the pano

  • I've already spent dozens of hours trying to solve this problem - maybe the krpano community will be able to help me.
    I'm developing iOS panorama app using krpano viewer. It embeds the cube pano in the UIWebView. In the iOS 6 I used the tiles of very high quality (2048x2048, 4-5mb). Everything was fine. I had to stop developing the app and recently returned back to it. The problem is, that now, with iOS 7.1, it crashes.
    At first time the UIWebView loads fine, everything works fast and cool. But when I close the view and open it once more, the application crashes with the following error:

    Code
    Terminating app due to uncaught exception 'NSRangeException', reason: '-[WebCoreSharedBufferData getBytes:range:]: range {0, 4000} exceeds data length 0'

    I've tried a lot of things - to call [webView reload] on -viewWillDisappear, tried to load an empty page, fired a javascript which set document.body.innerHTML to an empty value, implemented -didReceiveMemoryWarning - dozens of things, but nothing has helped. It seems to be the problem with WebKit itself.
    The only possible solution, which fixed the crashes was to use tiles of very low quality with the size 3-10kb. But the use of such panoramas in production is meaningless. I was testing the app on iPhone 5 and iPhone 4. On the simulator everything works fine.
    Here is my current code for embedding the pano in the UIWebView:

    This is krpano.html:

    krpano.xml:

    Code
    <krpano version="1.17" onstart = "startup();">
    	<action name="startup">
    	<!-- startup action (called from the onstart event) - slide-in the example-button-containers -->
    loadpano('tour.xml');" />
    	</action>
    </krpano>

    tour.xml:

    I would be very glad for any help, this problem makes me mad *sad*

  • I would suggest you a couple of things

    1.- try with panos wuth 1024 px size ( you could also try with 512px)
    2.- upadte krpano to 1.17.2

    hope it helpls

    1. Tiles with this size have to be of very poor quality to match the 10kb-size requirement.
    2. Already updated *sad*

  • Hi,

    2048x2048px cube images are way too big for iOS!
    Try using 1024x1024px or multires, the file sizes itself shouldn't matter.

    Regarding the crash report itself - that looks like the same problem like the iOS 7.0 'black tiles' bug (Mac Safari 7.0.x seems to have the same bug now).

    The problem seems to be this: one browser thread is decoding the image, while an other thread is freeing the image memory at the same time => which leads to a crash in the first thread of course. In iOS 7.0 this typically results in black tiles.

    A fundamental bug of Safari itself, but workarounds seems to be possible by 'forcing' the browser indirectly to decode the image instantly instead of letting it do that in background.

    krpano 1.17 and above have enabled that workaround automatically for iOS 7.0 - but not for iOS 7.1, because it seems that Apple has fixed that bug already there.

    Contact me directly by mail for test version where this workaround is enabled for iOS 7.1.

    Best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!