Search code examples
iosionic-frameworkios9iphone-6

iOS 9 Ionic Cordova App Crashes on iPhone; works on iPad


Cordova v5.3.1 / Ionic v1.1.0 (library v1.6.4)

Upgraded our application to iOS 9 from 8.4. The application builds and runs fine on iPad/iPad mini. However, it crashes when deployed to an iPhone.

Below is the debug output:

2015-09-23 11:17:09.920 AnApplicaiton[6490:1359695] *** Assertion failure in -[UIApplication _cachedSystemAnimationFenceCreatingIfNecessary:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3505.16/UIApplication.m:1697

2015-09-23 11:17:09.926 AnApplication[6490:1359695] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'accessing _cachedSystemAnimationFence requires the main thread'

The debug console is identical up to this point.


Solution

  • I don't know the real reason but when the App has WebView and third party keyboard such as Swype, program crashes. I replicated the issue many times. So if your app uses WebView such as Cordova, iAd, Admob you will see these weird crashes. I don't know how to prevent this issue. It only happens on iOS and only on iPhones. My crash reports show iPhone 5s, iPhone 6, iPhone 6 Plus.

    Edit: I think code given by @Kurt.F can fix the issue for now. Add following code to your AppDelegate.swift file. All credits go to @Kurt.F

    func application(application: UIApplication, shouldAllowExtensionPointIdentifier extensionPointIdentifier: String) -> Bool {
    
        if extensionPointIdentifier == UIApplicationKeyboardExtensionPointIdentifier {
            return false
        }
    
        return true
    
    }