I\'ve got an iPad app that\'s in the App Store for around three months now and I\'ve been receiving some weird crash reports that I can\'t figure out. These are not that frequen
Look at your Javascript-to-Objective-C code and if you are executing/calling javascript code make sure that script does not invoke new calls to Objective-C.
This is proper usage:
Javascript >> Objective-C
Objective-C >> Javascript
This is reason for crash:
Objective-C >> Javascript >> Objective-C (here is possible crash depending on some race conditions)
Solution is specific for your project code. But easiest would be to wrap all Javascript in setTimeout() to schedule execution in Javascript thread. Here is simple example, your Objective-C code needs to execute this script:
storeUserPhoneNumber("011 123 4567");
Crash will happen if storeUserPhoneNumber function calls back to Objective-C code (directly or indirectly) in its body. To fix this just wrap code in setTimeout like this:
setTimeout(function() {
storeUserPhoneNumber("011 123 4567");
}, 0);
What this accomplishes is to parse Javascript code from string and place it in function that is scheduled to be executed later on next event-loop tick releasing control back to Objective-C after parsing JS code.
Remember you need this fix on all Objective-C >> Javascript calls ;)