bug: infdig Infinite $digest Loop
Type: bug
Platform: ios 9 webview
I tried my app on iOS9 Beta and always receive this error, when i click something (e.g. a tab):
angularjs exception: [$rootScope:infdig] 10 $digest() iterations reached. Aborting! Watchers fired in the last 5 iterations: [] caused by "undefined js stack:
I've seen this as well. Since it's beta software, I wouldn't worry too much.
That's right. I hope it will be fixed soon. i recognized that ionic inherited this bug from angular. https://github.com/angular/angular.js/issues/12241
Alright, closing this since it's not really an issue with ionic, but ios9 and angular.
CleverCoder posted a fix. Is it possible to include this fix to ionic? https://github.com/angular/angular.js/issues/12241#issuecomment-130744518
@mhartington So how to update the fix in ionic ? any steps?
@mhartington Now the ionic got the new angular update ?
It is an iOS9-specific issue but that is due to be released imminently. Should ionic not urgently adopt a patched version of Angular to create a workable interim solution for iOS9? (e.g. like this https://github.com/angular/angular.js/issues/12241#issuecomment-130744518 ).
The Angular team is unlikely to change anything because Angular doesn't officially support uiWebView. And I think waiting to Apple to maybe fix this is it extremely risky as this is a ticking timebomb that affects thousands of apps in the wild. And uiWebView is deprecated so why would they care?
The other way out of this problem (which to me is a business-critical show stopper) is if cordova-ios 4.0 gets released with WKWebView used in place of uiWebView, and ionic adopts that.
Even though ionic isn't directly the cause, the upshot is that ionic is fundamentally broken in iOS9. I'd rather be pessimistic about it being fixed elsewhere and be proven wrong than just sit and wait.
Release of IOS9 is in one week. Is there any update on this bug ?
We're talking to the angular team, where the issue is originating from.
My app has a tab navigation where each tab's class is bound (indirectly) to the $location. An active class indicates which is the active section (kind of like ng-class="{ 'active': thisTab.active }") where each tab's active property is based on a comparison to the location). In iOS9 the icons kind of flicker and don't reliably update as you navigate. Two tabs will appear to be 'active' at the same time.
Speculatively: maybe $scope.$apply() is not being called due to the infinite digest error.
Also, sometimes tapping on the tabs (standard <a href tags) has no effect first time around, so the new location apparently doesn't get registered by ui-router.
It's completely solid in iOS8.X
@mhartington if you wish to experience the usability issues caused by this just follow the steps I provided in #4151. Choosing side menu items is now and then broken, the navigation seeming very off. You just have to see it to get a feeling for the problem. Given the age of the seemingly Angular issue and the slow app approval process at Apple I worry it might be too late to do anything about it just now. Quite disappointing case handling if you ask me, even if it's a pure root cause within WebKit. I could not see any official response from the Angular people.
Hey everyone, we are looking into this and will make sure we get it fixed for immediate release, even if we have to hack Angular to make it work. Sorry for the lack of movement on this. We will also push on the angular side to get it fixed if we can.
Small update: It seems the issue is still there in the latest iOS 9 (GM, build 13A340). I could simply experience the problem(s) while using an app that's already in production / app store.
The aforementioned iOS build is the one going out to everyone one week from now.
We have a work in progress branch which can be found here: https://github.com/driftyco/ionic/blob/ios9-patch/js/angular/service/decorators/ios9-browser-fix.js
It decorates $browser and applies this patch.
We also placed the patch on our CDN. I don't recommend using the CDN file for production, it's only there so it's easier to test with right now. http://code.ionicframework.com/patch/ios9-$browser-patch.js
Please test it out and let us know how it goes, thanks.
To test it out, place this script tag below your ionic.bundle.js file:
<script src="http://code.ionicframework.com/patch/ios9-$browser-patch.js"></script>
EDIT: I should also add that it currently will always apply the patch whether it's iOS9 or not. Eventually it'll be updated to only apply the patch when it is iOS9 UIWebView.
Hi !
Thank you to work so fast on a solution. I tested your script and everything works fine with my application, except I had to replace "forEach" declarations with "angular.forEach" to avoid this error when the application launches:
"ReferenceError: Can't find variable: forEach, http://192.168.0.49:8101/lib/ionic/js/ionic.bundle.js, Line: 12976"
versions:
- Ionic v1.0.1
- Angular v1.3.13
Thank you.
@adamdbradley
~~One possible integration is the following:~~
...
<script src="lib/ionic/js/ionic.bundle.min.js"></script>
<script>
// iOS9 patch, see https://github.com/driftyco/ionic/issues/4082
if ( ionic.Platform.isIOS() && ionic.Platform.version().toString()[ 0 ] === '9' ) {
var patch = document.createElement( 'script' );
patch.src = 'lib/ionic/js/ios9-$browser-patch.js';
document.head.appendChild( patch );
}
</script>
...
~~I'd rather not include the current patch script at all when running on iOS version < 9~~
Forget it, the approach above isn't reliable. It was working when I tested using ionic live reload (with run) but not when the app was running directly on the device.
I will note, that so far the patch hasn't created any issues on android or older iOS
Mike Hartington
On Sep 10, 2015, at 4:57 AM, Zarko Hristovski [email protected] wrote:
@adamdbradley One possible integration is the following:
... <script src="lib/ionic/js/ionic.bundle.min.js"></script> <script> // iOS9 patch, see https://github.com/driftyco/ionic/issues/4082 if ( ionic.Platform.isIOS() && ionic.Platform.version().toString()[ 0 ] === '9' ) { var patch = document.createElement( 'script' ); patch.src = 'lib/ionic/js/ios9-$browser-patch.js'; document.head.appendChild( patch ); } </script> ...I'd rather not include the current patch script at all when running on iOS version < 9.
— Reply to this email directly or view it on GitHub.
Looks like the patch fixed all the issues we had with transitions. Thanks!
thanks, patch seems to work great.
is there a rdar:// we can reference as we push this through to the app store?
@zarko-tg Yes - I just realised the same thing. For some reason if the script is added that way the module does not load.
Is there a workable way of only loading the script in iOS9? Or, if not, is there any harm in this patch running on iOS8?