1

Fun error that ONLY happens in iOS 10, when debugging on a physical device. It does not happen in the simulator, or when running on the physical device (while not debugging). It also does not happen on an iOS 9 device in any situation...only iOS 10 while debugging and after any javascript call has been executed.

I have a hybrid web app, written in Swift 2.3, after the xwebview loads I call various javascript methods...actually, any in this case. Anyway, after the javascript method has finished I get a malloc error saying I'm trying to free a pointer.

malloc: *** error for object 0x1740b5060: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

So I set the break point...and it never breaks on the breakpoint, it just keeps telling me to set a breakpoint.

If I remove all of my javascript calls, the error never happens. I've tried enabling them one by one, it doesn't matter, they all break after the callback returns.

I've been after this for about 2 weeks, I'm out of extra hair to pull out. At this point I'd love to hear if someone else is seeing the same thing.

1
  • I experienced the same problem. Everything was working fine before using Swift 3. When I remove the parameters from my js functions the error seems to be gone. Unfortunately I could find any solution for this problem so far. Commented Oct 17, 2016 at 11:07

1 Answer 1

5

It looks like its a safari bug and therefore only appears when you are debugging your webview with safari. In Safari under Develop->Your_Device_Name uncheck "Automatically Show Web Inspector for JSContexts". This should resolve your issue.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you, that was it. I was a little slow, but I also started to notice the error didn't happen when Safari wasn't running...which led to your fix.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.