iOS 9, Ionic, Cordova, Angular & 10 $digest() iterations reached

TL;DR: If your getting $digest errors in your Cordova application using Angular (as Ionic does) in iOS9 Apply this patch.


Late Wednesday I received an error via Rollbar. a error tracking service that I started looking at.

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []$rootScope/infdig?p0=10&p1=%5B%5D

It was just one user and according to Apple iTunes Connect and the Google Play Console we’ve had a fair amount of upgrades. So I decided that maybe it was an issue with this one person’s phone and continued brushed it aside.

Then Thursday happened….


Panicked I started looking at everything, loaded up my app on my phone and tried everything to reproduce the issue. I checked the API for errors, nothing there. WTH is going on?

The Stack Traces were all over the places, here’s an example:

Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: []$rootScope/infdig?p0=10&p1=%5B%5D
File "file:///var/mobile/Containers/Bundle/Application/FD993E94-0772-4748-AC98-541A62F8FC47/" line 8895 col 32 in [anonymous]
File "file:///var/mobile/Containers/Bundle/Application/FD993E94-0772-4748-AC98-541A62F8FC47/" line 24548 col 35 in $digest
File "file:///var/mobile/Containers/Bundle/Application/FD993E94-0772-4748-AC98-541A62F8FC47/" line 24778 col 31 in $apply
File "file:///var/mobile/Containers/Bundle/Application/FD993E94-0772-4748-AC98-541A62F8FC47/" line 26545 col 42 in [anonymous]
File "file:///var/mobile/Containers/Bundle/Application/FD993E94-0772-4748-AC98-541A62F8FC47/" line 14221 col 15 in completeOutstandingRequest
File "file:///var/mobile/Containers/Bundle/Application/FD993E94-0772-4748-AC98-541A62F8FC47/ viagra reviews.bundle.js" line 14493 col 33 in [anonymous]

I would also this this error:

[$rootScope:inprog] $digest already in progress$rootScope/inprog?p0=%24digest

My first thought was I was using excessive $scope.$watch’ers or too many $scope.$apply’s. But a scan though the app revealed nothing.

I was investigating the error and found the Occurrences tab, as you can see it’s not limited to 1 page, so not a local scope issue.


I hovered over the browser, “Mobile Safari 9.0”!!! CRAP iOS9.

“Side note to the Rollbar team, this information needs to be on the main page when looking at an item, you give me the error, and graph, but I have to hunt for the URL (for the occurrence that first tripped it), and hover over the browser icon to get the browser version, don’t hide information behind a hover event! You can make the charts smaller and add some more metadata/contextual information.”

The Ionic Framework Team posted a blog on 9/10/15 titled “iOS 9 Potential Breaking Change” of course I read it, but the gist of what stood out to me was:

If you rely on the semantics of window.location or use the $location service heavily, and have noticed issues on iOS 9 GM please try the patch and let us know how it works for you.

I recently removed all $location so I thought I was free and and clear. But if you dig deeper, to the OpenRadar issue the Ionic Team linked to the problem is with UIWebView and how it handles Url’s with a hash in them (used in a lot of SPA’s “Single Page Applications”).

In the Responder app we use Angular UI Router, which uses hash’s in the url a lot. So if your app is using $state or $location to navigate, your app is most likely borked in iOS9.

To fix the Digest error Apply the PATCH, it’s very very simple and works.

The Ionic Team also has another great article published on 9/12/15 titled “Preparing for iOS 9” give it a close read, Mobile Safari 9 broke some CSS selectors and in some circumstances requires HTTPS only calls.

I noticed some strangeness with Ionic and navigation animations, sometimes I would get a double animation. But I was frantically trying to get app tested to get it to Apple for review.

To request an expedited review once your app is in a “Waiting for Review” state:

  1. Log into iTunes Connect:
  2. Click Contact Us in the lower right hand corner:
  3. Select from the drop downs “App Review” “App Store Review” and “Request Expedited Review” and click the “Request and Expedited App Review” form link then fill that out.


Good luck out there and happy Ionic\Cordova coding!

Resgrid is a SaaS product utilizing Microsoft Azure, providing logistics, management and communication tools to first responder organizations like volunteer fire departments, career fire departments, EMS, search and rescue, CERT, public safety, disaster relief organizations, etc. It was founded in late 2012 by myself and Jason Jarrett (staxmanade).

About: Shawn Jackson

I’ve spent the last 18 years in the world of Information Technology on both the IT and Development sides of the aisle. I’m currently a Software Engineer for Paylocity. In addition to working at Paylocity, I’m also the Founder of Resgrid, a cloud services company dedicated to providing logistics and management solutions to first responder organizations, volunteer and career fire departments, EMS, ambulance services, search and rescue, public safety, HAZMAT and others.