Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 434
Joey Avatar asked Sep 23 '15 16:09

Joey


People also ask

Can I use ionic with Cordova?

Since Ionic is an HTML5 framework, it needs a native wrapper like Cordova or PhoneGap in order to run as a native app. We strongly recommend using Cordova proper for your apps, and the Ionic tools will use Cordova underneath.


2 Answers

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

}
like image 129
Meanteacher Avatar answered Oct 02 '22 13:10

Meanteacher


This seems to be a conflict between 3rd party keyboards and the WebView. I am also able to crash Chrome (outside of Cordova) on iOS 9. I just go to a popular website and focus on some edit fields a few times. You can do his while the page is loading to bring out the keyboard while a certain custom one is enabled and it crashes.

I created a simple Cordova plugin to not allow any keyboard extensions to run with the app. Not a permanent solution, but it will stop the crashes for now. Just add the plugin, no code changes are needed.

https://github.com/kurtisf/cordova-plugin-restrict-keyboard

like image 45
Kurt.F Avatar answered Oct 02 '22 14:10

Kurt.F