0

I'm working on a long-standing, fairly-complex iOS Cocoa app, and I'm trying to fix performance when resuming from the inactive (say, locking the device). The problem appears on all versions of the iPhone (we support back to the 3G).

The steps are:

  1. Run the app.
  2. Lock the screen with the sleep/wake button (lock button).
  3. Resume the app. The app appears on the same view that it showed before, but it's non-responsive. Also, in the OS bar, the carrier, signal, battery, and location icons appear, but the clock is missing.
  4. After about a second, the clock comes back, and at about the same time, my app is responsive.

I would say that it's an iOS thing, but most apps don't take nearly that long to come back, including to show the clock.

What is the significance of the rendering of the clock in the OS task bar when resuming from sleep? I need to know what period of time this represents (after this event/action/delegate/etc, but before another one) so I can narrow down the point of the code to examine.

When I debug with Xcode, this doesn't happen. It also doesn't happen in the simulator, ever.

Thanks!

  • Might be low memory, since it's happening on devices. (Less likely since it's happening on multiple devices, but still possible.) Double tap the home button and a list of all the apps that are currently running in memory on your device appear. Then long press on one of the apps and press the minus sign to remove every single app running on the phone from memory. Then restart the device. See if this fixes your problem. – WendiKidd Jun 30 '12 at 00:31
  • 1
    Are you doing any heavy processing in `applicationWillEnterForeground:` or `applicationDidBecomeActive:`? – Josh Hinman Jun 30 '12 at 00:48
  • @WendiKidd - no, this is a dev environment with no other apps running, as well as in the wild. – Matthew Picioccio Jun 30 '12 at 08:46
  • @Josh Hinman - not that is apparent to me. I guess I'm trying to figure out the significance of the appearance of the clock. The OS shows the rest of the bar right away, but there's something I'm doing that's making the clock show up a second later (and the app is nonresponsive). – Matthew Picioccio Jun 30 '12 at 08:47
  • I figured out what's going on here, but it raises more issues. We have a bunch of objects responding to a notification raised from our CLLocationManager didUpdateToLocation delegate. Whenever you start up the location manager (which we do when you come back from the background), you get four updates within about a second, which causes all of these screens to recalculate everything four times. The locations coming back are different - it's the location manager finding more cell towers - and the accuracy is always 65 meters (i.e. useless for ignoring some updates). – Matthew Picioccio Jul 03 '12 at 16:50
  • FYI - the location behavior was normal. The problem was that our terrible code was holding onto every Google Maps instance that had ever been viewed since the app has started, and our app is about navigation, so that's usually a lot. They were all trying to recalculate and load tiles on those four updates. I added code to clean them up correctly, and the problem went away. – Matthew Picioccio Aug 27 '12 at 04:23

0 Answers0