[I’m responding at the bottom of this thread because it’s hard to track conversations that occur in the middle.]
Adam Knight wrote:
Is there any extra information about anything that might have changed in 10.3 to affect this?
Not from me, alas.
I should stress that every time I’ve looked at problems like this they were caused by the developer making invalid assumptions about NSTimer. I posted my general advice on this topic back on 5 Apr 2017.
… in iOS 10.3 our timers do not appear to be firing correctly and the app is being terminated after the regular three minutes of allowed background time has elapsed.
I’m confused by this. In general any code running in the background should be using a UIApplication background task to ensure that it stays running. When creating a background task you have to pass in an expiry handler so that the system can ‘call in’ your background task and thus suspend the app early. The only way to get killed here is for the expiry handler to not respond promptly. Is your expiry handler dependent on an NSTimer? Presumably not, in which case I can’t see how any NSTimer issue could cause you to be killed in this way.
Regardless, to move forward here you need to get serious about:
You can then look at the log to see what’s actually happening with your app on 10.3.x.
IMPORTANT When you test this, test it with your app run from the home screen (not Xcode) and with the device on battery power. Xcode’s debugger radically changes background execution behaviour, so you never want to test background code that way. Likewise, mains power can cause iOS to behave quite differently, so it’s best to test your app on battery, as it’s going to be used by your users.
With iOS 10’s new logging architecture you can test while disconnected and then recover the log after the fact via sysdiagnose. There are instructions for getting a sysdiagnose on our Bug Reporting > Profiles and Logs page.
Finally, I should stress that I totally believe that there’s some change in behaviour in iOS 10.3 that’s causing all of these problems. The question here is whether the new behaviour is within the bounds laid out by the documentation for the APIs in question. If it isn’t, that’s definitely bugworthy. OTOH, if it is then you should feel free to file a binary compatibility bug but the best way forward is to update your code.
Regardless, any progress here (be that a bug report with a workaround, or just a fix to your code) is going to need a proper analysis of what’s going wrong, hence my logging suggestions.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"