15

I've got an app that was working perfectly on iOS 6, but on iOS 7, if there is a very specific action taken by the user (too complex to get into but it uses a UIWebView and it's consistent), the app crashes with the error:

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

Now I'm more than happy to do some research and experimentation myself, but I just can't find WebCoreSharedBufferData. Google searches reveal several people (like here and here and here and here) who are having similar problems, but their questions either haven't been answered or they're using their apps in ways (like zooming on a map or using 3rd party code) that I'm not doing.

Xcode documentation has never heard of WebCoreSharedBufferData, and a search of my project reveals no references to it. Google searches have left me unenlightened as well, mostly just questions and GitHub projects with 3rd party code I'm not using. I'm assuming it's something deep in Apple's UIWebView functionality, but without being able to learn more about it I'm having a hard time proceeding.

So my question is: does anyone know where I can find information/tutorials/descriptions etc of WebCoreSharedBufferData? I feel like if I understood it a little better I'd be able to find the solution, it's just hard to debug in the dark...

Or alternatively, does anyone just straight-up know what changed with WebCoreSharedBufferData in iOS 7 that might be creating an error like this?

EDIT: A clue provided by kcbanner (who has experienced a similar issue) in the comments below: both of our problems involve pages with canvases and onclick events with those canvases. Maybe something has changed with canvas click handling in iOS 7?

Community
  • 1
  • 1
Nerrolken
  • 1,975
  • 3
  • 24
  • 53
  • What is the action taken by the user? I am having this issue as well and have not had success in tracking down the triggering event. – kcbanner Nov 22 '13 at 19:59
  • It was fairly complex and app-specific, where you'd need to visit a certain page in the `UIWebView` and call a certain JavaScript function on that page (having to do with creating and placing Canvas layers from an `onclick` event), then reload the page and try to call that same `onclick` function again. I'm not a JS guy and that's a really weird pattern, so I couldn't track it down beyond that, but the crash occurs 100% of the time when you follow those steps. How about you? – Nerrolken Nov 22 '13 at 22:12
  • 1
    A similar situation, we make use of canvases and click events on those canvases. Perhaps it is a bug with canvas click handlers. – kcbanner Nov 22 '13 at 22:15
  • Nice. I'm going to edit the original post to add that clue. – Nerrolken Nov 22 '13 at 22:19
  • Have you tried listening to all touch events per [this answer](http://stackoverflow.com/questions/8444184/listen-to-all-touch-events-in-an-ios-app) and see what's happening? I think that you might be able at least try/catch the crash inside there. – Josef Salyer Nov 23 '13 at 03:59
  • 1
    You can find it in the WebKit open source project. For example, Safari 6.x https://trac.webkit.org/browser/releases/Apple/Safari%206.0.2/WebCore/platform/mac/SharedBufferMac.mm vs https://trac.webkit.org/browser/trunk/Source/WebCore/platform/mac/SharedBufferMac.mm – russbishop Nov 25 '13 at 04:17
  • 1
    I dug around devforums.apple.com, and it seems that people most often have these issues when data that is streaming to the device is interrupted. Also, if you get a symbolized stack trace and look through the WebKit source(as @xenadu mentioned), you're bound to learn something. You could also dig through the WebKit bug reporter to see if there are any similar issues or report yours. – paulrehkugler Nov 28 '13 at 14:30
  • The reason you aren't seeing `WebCoreSharedBufferData` is because it is part of a private API that Apple doesn't want developers using. This will get called with one of their frameworks, I will assume it will get called in WebKit. Have you tried adding an expression breakpoint in xcode (https://developer.apple.com/library/ios/recipes/xcode_help-breakpoint_navigator/articles/setting_breakpoint_actions_and_options.html) to get the line it breaks on? If so please share that line and also can you please share the stack trace that you get. You can tell a lot from a stack trace – Popeye Dec 10 '13 at 09:30
  • Looks like no one has any further info on this. – kcbanner Dec 10 '13 at 21:13

2 Answers2

1

I just encountered this error also. My set up was phonegap 3.2 and createjs 0.7.0 and I never had an issue with ios6 but ios7 was causing me fits. My solution was to use one canvas element. I had been loading two canvas elements with png spritesheet bitmap data and toggling back and forth, now i just reuse the same canvas element by clearing the old data and adding the new data. Seems to have solved the issue. still don't understand why i can't have two canvas elements.

just a bit more... seems this only occurred when i quickly reloaded the two canvas elements with png data. I don't think it's an issue of corrupted pngs because it would happen on different bitmaps each time and now that i reuse the same canvas element everything works fine.

Steve T
  • 11
  • 2
0

if you are using IOS i Wouldn't use onClick. IOS takes your on click and puts some funky 200 ms delay on onClicks which results in sometimes breaking the "webglue". JavaScript has a full touch library that I would use and also something like Hammer.js will resolve your problem. also, i would use phonegap for the webview component of your app (even if it is not the full app) because they fix alot of quirks/bugs IOS has with their native webview (even if it is just for website browsing).

Dnaso
  • 1,335
  • 4
  • 22
  • 48