iOS9 under Ionic [$rootScope: Infdig] $digest () iterations reached. Solutions to aborting!

Source: Internet
Author: User

After upgrading iOS9, the app developed by Ionic will report [$rootScope: Infdig] $digest () iterations reached. aborting! error, plus a patch to fix it.

Introduce JS in index.html
<script type= "Text/javascript" src= "Js/angular-ios9-uiwebview.patch.js" ></script>

App.js added dependency ' Ngios9uiwebviewpatch '
Angular.module (' starter ', [' Ionic ', ' starter.controllers ', ' starter.services ', ' Ngios9uiwebviewpatch '])

Js/angular-ios9-uiwebview.patch.js's:
https://gist.github.com/IgorMinar/863acd413e3925bf282c

-----------------------------------------------------------------------------------------------
Author Blog:
http://blog.ionic.io/ios-9-potential-breaking-change/
Author Blog full text:

IOS 9 Potential Breaking Changetweetby Max on September

Update (9/11/2015): A new version of the patch is released by Igor to the Angular team that fixes many issues. Please use It:angular-ios9-uiwebview.patch.js. Make sure to add to ‘ngIOS9UIWebViewPatch‘ your angular modules and use version 1.1.0 or higher of the patch. Also, see we latest postabout other issues that need addressing.

A breaking change was introduced to UIWebView for IOS 9, could cause issues for apps, heavily rely on the semant ICS of window.location .

We ' ve tested a number of widely-used Ionic apps with IOS 9 beta and GM, and issues appear to being isolated to intermittent U I/navigation issues on some apps, along with console errors indicating infinite Digest warnings in Angular. Functionality beyond that should is not being impacted.

We is still investigating the impact of this change and working with the Angular team to develop a long-term fix. In the meantime, we ' ve (the Angular team have) created a patch to stop the digest issue which was causing the cons OLE errors. This hot fix can is included in the majority of Ionic and Angular apps (even those running ALPHA/BETA/RC) releases. If you rely on window.location the semantics of or use $location the service heavily, and has noticed issues on IOS 9 GM please try the Patch and let us know what it works for you.

If You do notice a issue with your app on IOS 9, add the patch, and submit your apps for review. There is a openradar issue for this so you might being able to reference a update (of expedite, no course). There is supposedly a fix on the works from Apple, but it wasn ' t released on time for GM.

Thanks to everyone, have helped us with this issue. If This issue have caused an issue in your app, please let us know (and we is sincerely sorry) as we work towards a Perman ENT fix.


---------------------------------------------------------------------------------------------
---js/angular-ios9-uiwebview.patch.js----------------------------------------------------------------------

/**
* ================== angular-ios9-uiwebview.patch.js v1.1.1 ==================
*
* This patch works around iOS9 UIWebView regression that causes infinite digest
* Errors in Angular.
*
* The patch can is applied to Angular 1.2.0–1.4.5. Newer versions of Angular
* The workaround baked in.
*
* To apply the This patch load/bundle the this file with your application and add a
* Dependency on the ' Ngios9uiwebviewpatch ' module to your main app module.
*
* For example:
*
* ```
* Angular.module (' myApp ', [' Ngroute ']) '
* ```
*
* becomes
*
* ```
* Angular.module (' myApp ', [' Ngroute ', ' Ngios9uiwebviewpatch '])
* ```
*
*
* More info:
*-https://openradar.appspot.com/22186109
*-https://github.com/angular/angular.js/issues/12241
*-https://github.com/driftyco/ionic/issues/4082
*
*
* @license AngularJS
* (c) 2010-2015 Google, Inc. http://angularjs.org
* License:mit
*/

Angular.module (' Ngios9uiwebviewpatch ', [' ng ']). config ([' $provide ', function ($provide) {
' Use strict ';

$provide. Decorator (' $browser ', [' $delegate ', ' $window ', function ($delegate, $window) {

if (Isios9uiwebview ($window. navigator.useragent)) {
Return Applyios9shim ($delegate);
}

return $delegate;

function Isios9uiwebview (useragent) {
return/(Iphone|ipad|ipod). * OS 9_\d/.test (useragent) &&!/version\/9\./.test (useragent);
}

function Applyios9shim (browser) {
var pendinglocationurl = null;
var originalurlfn= browser.url;

Browser.url = function () {
if (arguments.length) {
Pendinglocationurl = Arguments[0];
return originalurlfn.apply (browser, arguments);
}

return Pendinglocationurl | | Originalurlfn.apply (browser, arguments);
};

Window.addeventlistener (' Popstate ', Clearpendinglocationurl, false);
Window.addeventlistener (' Hashchange ', Clearpendinglocationurl, false);

function Clearpendinglocationurl () {
Pendinglocationurl = null;
}

return browser;
}
}]);
}]);

iOS9 under Ionic [$rootScope: Infdig] $digest () iterations reached. Solutions to aborting!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.