Hello, I have a some problem with background fetch. In my app I use background modes for fetch data and display on my home widget iPhone. Its working correct when I built app on my phone from Xcode but when I distribute my app on TestFlight my home widget not updating at all. Help me understand if this issue is only due to TestFlight resources, or should I try releasing the app and hope that it will work in the release version?
When you say you are using "background fetch" are you actually using the now deprecated application(_:performFetchWithCompletionHandler:)
method of refreshing app data in the background? If so, even if this method weren't deprecated, it would be quite the wrong way to update a widget, because with this method, the system tries to predict when your app is expected to be launched by the user, and if appropriate gives the app background runtime to refresh its data in preparation for the user launch. It would also, if appropriate, do so at times where there are ample system resources.
The reason you are seeing this work in debug mode is, when debugged, the system lifts all the typical limitations in order for you to be able to debug your code. When built for TestFlight and the App Store, the control of the background behavior is up to the system, and that is going to be much more limited than you think.
Do check iOS Background Execution Limits to understand the limitations you are against.
In any case, if you are using the deprecated method, then you should be using BGAppRefreshTask instead.
But do understand that the background execution limits explained in the above link still stand, and you cannot expect a background refresh task to run on a schedule of your choosing, every time, all the time. Background execution is at the discretion of the system, and will happen when the system determines there are enough resources and when it is appropriate.
Argun Tekant / DTS Engineer / Core Technologies