Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

adamkharris

macrumors newbie
Original poster
Oct 17, 2016
12
6
United Kingdom
I have developed an app that is fairly resource hungry (a golf scoring app) an am having a bit of an issue. When the screen locks, either manually or by timer, I open the phone and my app has gone back to the springboard. It would be great if the app were sitting there after unlock but I can't seem to get this to happen.

Any help or pointers would be great thanks, using Xcode.
 
iOS is very strict about what it keeps running in the background when the phone is not in use. If your app is very resource-intensive, and uses a lot of battery life....why keep it running in the background if it's just gonna drain people's batteries?

What you should do is find a way to offload most of the resources & processes when the app is not in the foreground. Thus, when the screen is locked, deallocate most of your resources until the app is back in the foreground again. When you do this, iOS won't stop execution of your app.
 
  • Like
Reactions: adamkharris

We have had a good look at this and according to my lead dev, all is okay with the code!
[doublepost=1476780644][/doublepost]
Is your app crashing? If you build one of the apps from Xcode templates does it act the same as your app?

On closer inspection, I am getting sporadic crashing.

I have my scorecard on the app running and after the lock screen kicks in, we just see the springboard (not always) and opening the app essentially just runs it from the start. Not always but a little too often :-/

Frustrating.
[doublepost=1476780706][/doublepost]
iOS is very strict about what it keeps running in the background when the phone is not in use. If your app is very resource-intensive, and uses a lot of battery life....why keep it running in the background if it's just gonna drain people's batteries?

What you should do is find a way to offload most of the resources & processes when the app is not in the foreground. Thus, when the screen is locked, deallocate most of your resources until the app is back in the foreground again. When you do this, iOS won't stop execution of your app.

Good points and taken on board, thanks
 
On closer inspection, I am getting sporadic crashing.

To track down crashes you want either to run the app in the Debugger and make it crash or Run the app without the debugger and look at the crash log that's generated. If your app is being killed for using too much memory that will also be shown in the crash logs.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.