Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: infdig Infinite $digest Loop #4082

Closed
aexei opened this issue Jul 14, 2015 · 108 comments
Closed

bug: infdig Infinite $digest Loop #4082

aexei opened this issue Jul 14, 2015 · 108 comments

Comments

@aexei
Copy link

aexei commented Jul 14, 2015

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:

@aexei aexei changed the title crash: infdig Infinite $digest Loop bug: crash: infdig Infinite $digest Loop Jul 14, 2015
@aexei aexei changed the title bug: crash: infdig Infinite $digest Loop bug: infdig Infinite $digest Loop Jul 14, 2015
@mhartington
Copy link
Contributor

I've seen this as well. Since it's beta software, I wouldn't worry too much.

@mhartington mhartington added the needs: reply the issue needs a response from the user label Jul 14, 2015
@aexei
Copy link
Author

aexei commented Jul 15, 2015

That's right. I hope it will be fixed soon. i recognized that ionic inherited this bug from angular.
angular/angular.js#12241

@Ionitron Ionitron removed the needs: reply the issue needs a response from the user label Jul 15, 2015
@mhartington
Copy link
Contributor

Alright, closing this since it's not really an issue with ionic, but ios9 and angular.

@aexei
Copy link
Author

aexei commented Aug 14, 2015

CleverCoder posted a fix. Is it possible to include this fix to ionic?
angular/angular.js#12241 (comment)

@abrahamrkj
Copy link

@mhartington So how to update the fix in ionic ? any steps?

@abrahamrkj
Copy link

@mhartington Now the ionic got the new angular update ?

@aderowbotham
Copy link

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 angular/angular.js#12241 (comment) ).

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.

@pawurb
Copy link

pawurb commented Sep 9, 2015

Release of IOS9 is in one week. Is there any update on this bug ?

@mhartington
Copy link
Contributor

We're talking to the angular team, where the issue is originating from.

@aderowbotham
Copy link

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

@zarko-tg
Copy link

zarko-tg commented Sep 9, 2015

@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.

@mlynch
Copy link
Contributor

mlynch commented Sep 9, 2015

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.

@mlynch mlynch reopened this Sep 9, 2015
@zarko-tg
Copy link

zarko-tg commented Sep 9, 2015

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.

@adamdbradley
Copy link
Contributor

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.

adamdbradley added a commit that referenced this issue Sep 10, 2015
iOS 9 UIWebView introduced an issue with window.location updates.
Providing a hot fix for apps which rely on location.hash Issue #4082
@Kira2
Copy link

Kira2 commented Sep 10, 2015

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.

@zarko-tg
Copy link

@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.

@mhartington
Copy link
Contributor

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 notifications@github.com 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.

@sidlauskaslukas
Copy link

Looks like the patch fixed all the issues we had with transitions. Thanks!

@outlog
Copy link

outlog commented Sep 10, 2015

thanks, patch seems to work great.

is there a rdar:// we can reference as we push this through to the app store?

@aderowbotham
Copy link

@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?

@perrygovier
Copy link
Contributor

Thanks @IgorMinar, this appears to fix the few remaining navigation issues people were seeing.

Thank you all for your patience with this. Max has updated his blog post explaining the issue.

Adam has also added the patch to Ionic's nightly build and it should be included automatically in projects that use it.

@sean-hill
Copy link

Thanks @IgorMinar! I confirm with @perrygovier that this has resolved all my issues, other than the fact that iOS 9 is broken 😄

@sloops77
Copy link

All good with @IgorMinar's 1.1 - thanks fellas!

@andreground
Copy link

I can confirm that @IgorMinar 1.1 fixes all animation and transition issues we had!

Hint for those with navigation issues (eg. views getting back to home instead of target), remove ANY reference in your html code using the tag href="#". That's what was broking navigation in our case!

Thanks a lot for your effort guys!

@sean-hill
Copy link

Just wanted to let you fellas know that my app is now "Waiting for Review". Thanks for all the hard work that went into this patch. I really appreciate it.

@mhartington
Copy link
Contributor

Alright since the fix is in master....I'm going to close this.
Please, if there are issue, ping us so we can take a look.

@5amfung
Copy link

5amfung commented Sep 12, 2015

When Angularjs 1.4.6 is out, should we update Angularjs version independent of ionic or should we wait for a new ionic version to be bundled with 1.4.6?

@mhartington
Copy link
Contributor

When 1.4.6 is released, we will probably look at what it takes to update ionic to work with it. I don't suspect there will any breaking changes, but I wouldn't suggest upgrading the angular version that gets bundled with ionic. Stuff may break and that would be bad 😄

@mreinhardt24
Copy link

I tried the fix from @IgorMinar but my problems are still there. When i click on something i still get the error message and everywhere i use $state.go sometimes the content and ion-nav-buttons flicker and then the content loads but the ion-nav-buttons and back-button are vanished.

@mhartington
Copy link
Contributor

@EpoX44 are you sure you have the latest patch? What version of ionic are you using?

@mreinhardt24
Copy link

@mhartington I use
Ionic Version: 1.0.0-rc.1
AngularJS: v1.3.13

and tried this patch https://gist.github.com/IgorMinar/863acd413e3925bf282c

What I find a little bit curious is the fact that the strange loading of a view only appears randomly. Sometimes it works and sometimes not, but I always get the error message. When the forward view loads normal i get 2 console entries of the error messages and when it loads strange (like described) I get 8.

@mhartington
Copy link
Contributor

Can you update to the latest 1.1 version of ionic?

@mreinhardt24
Copy link

Yeah i'll update it and try it again. :)

@mreinhardt24
Copy link

@mhartington so I found out why it didn't worked. I just had to remove and add the iOS platform. Now everything works fine.

Anyway thanks for the help.

@bitcoinvsalts
Copy link

Hello guys,

I am experiencing weird issues after upgrading to iOS9 and Xcode7. I posted this question on the forum:
http://forum.ionicframework.com/t/problem-compiling-with-xcode7-and-ios9/32644

What am I doing wrong?

Hervé

@mhartington
Copy link
Contributor

Did you try the comment from before?

I just had to remove and add the iOS platform. Now everything works fine.

@bitcoinvsalts
Copy link

Yes I did remove and add the iOS platform.

@bitcoinvsalts
Copy link

Xcode compiles and gives me this error:

2015-09-17 12:04:01.963 Tree The World[395:70721] App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.
2015-09-17 12:04:01.983 Tree The World[395:70553] Failed to load webpage with error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.```

@rajatrocks
Copy link

That's a separate iOS9 issue, unrelated to this. You need to make a change to your iOS app's plist: http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/

@bitcoinvsalts
Copy link

@rajatrocks thanks for the tip. I edit my myapp-Info.plist and it's working. But the app feels slower for some reasons.

@rajatrocks
Copy link

I think the issue that caused this thread's problem is because of a delay in in iOS9's UIWebView correctly reporting the current href, and that was breaking parts of angular. I believe the fix makes the app wait until it's correctly reported. So that would make your app feel slower. Or it could be iOS 9, or Xcode 7, or any of a number of other things.

I ended up embedding the newer WKWebView in my app using https://github.com/Telerik-Verified-Plugins/WKWebView and it works great on iOS8 and 9.

@bitcoinvsalts
Copy link

@rajatrocks I installed the WKWebView and remove the calls for the patch. The app compiles and starts but it gives me that blank page again.

@rajatrocks
Copy link

You need to install v0.6.0, don't know if that's the current one. Beyond that, I can't really help you.
cordova plugin add https://github.com/icenium/cordova-plugin-webserver.git
cordova plugin add https://github.com/Telerik-Verified-Plugins/WKWebView.git#0.6.0

@bitcoinvsalts
Copy link

@rajatrocks I followed your instructions and the apps worked very good and very fast the first time I launched it. But something very weird happen after. Every time I tried to run the app again (from Xcode or Ionic run command) I keep getting the error message "ERROR: Start Page at 'http://192.168.0.100:8100' was not found." and the app does not work again. Any idea why?

@rajatrocks
Copy link

Sorry, no idea...

@eplicanic
Copy link

@jsappme did you try editing your config.xml so "access origin" is set to "*"

@bitcoinvsalts
Copy link

@eplicanic yes my config.xml is good.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests