Argun and Kevin,
Thank you both for your suggestions and explanations. The main use case is periodically running the refresh in the background. There are very few cases where the user actually interacts with the app UI, and they are probably executed very infrequently. So my guess is that the user will frequently swipe the app away after using it, but I still need the background processes to run. It sounds like neither background tasks nor silent push notifications can help me with this.
Do I have any other options?
Post
Replies
Boosts
Views
Activity
Perfect. I can detect the OS version and conditionally run the appropriate block, and then phase out the deprecated code eventually. Thanks!
Aha! I figured it out! I guess it would help to read the docs a little more carefully!
It seems that only 1 refresh task can be scheduled at a time. If I do a BGTaskScheduler.shared.cancelAllTaskRequests() when I start up the app, to insure there aren't any "lingering" refresh tasks, I can use whatever names I want, and change them at will.
Sorry to take up your time, but I learned to read better, and to file a bug (which I will close), so not a total loss (at least for me).
I'll be more careful next time!
Thanks again...David
it's the onChange(of: phase) that is giving me the error in xcode...says it's not supported before ios 17. Maybe there is a variation of this modifier.
So if I file a TSI, and it turns out to be an un-workaroundable (not sure that's a word) bug, does it still count as against my quota?
I filed bug report: FB13532365
Thanks! I'll file bug report.
I still have two TSI's available on my Developer Program. Would it be worthwhile to ask for help on this through the TSI? My concern is that when I first found this problem, it was when I was testing an app I'm working on. I think I changed the identifier a few times, and I don't know if I can retrace back to the original one (there seem to be some git bugs in xcode, so sometimes getting back to old version is difficult), so I may never be able to get the app to work without either: 1) figuring out what name is "registered" that will work, or 2) finding a way to "de-register" so I can put in a name that will work until the bug is fixed (if it is fixed).
I guess my question is: how deep will Apple tech support go to help me get my app working, given that there is a bug I may not be able to workaround? (Does that make sense?)
Any insights will be appreciated.
I have also created a "slimmed-down" version of my app, using a new name: com.dlsa.BackgroundProcesses.refresh
Once again, after running the first time, it will not let me change the name.
Here's what I did:
Ran with original name. Debug commands work fine.
Stopped app in xcode, and changed names (added "x" at end of identifier in target (replicated to Info.plist), and code
Removed app from phone
Shutdown phone and rebooted.
Ran with new names from xcode...same problem
Switched name back...runs fine.
What you described is correct. I have tried deleting app between 3 and 4, and it still fails. The identifier I'm using (not that this should matter) is:
"com.dlsa.BackgroundProcesses.refresh" and I when I change it to:
"com.dlsa.BackgroundProcesses.refreshx" it fails.
The command I'm using is:
e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdentifier:@"com.example.apple-samplecode.ColorFeed.refreshx"]
I know it is registering the task correctly, because if I run the app and enter the old command (without the "x") I get:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'No launch handler registered for task with identifier {public}@'
*** First throw call stack:
(0x1a55be69c 0x19d873c80 0x1a4b1cdd8 0x21bb89b0c 0x21bb882bc 0x1a5503794 0x1a550322c 0x1a44d6440 0x1a44d5fc0 0x1a44d5928 0x20f517b44 0x20f50a4b8 0x105852bb4 0x105871ca8 0x10585a7c4 0x10585b728 0x1058685f8 0x105867c2c 0x20f4b7964 0x20f4b7a04)
libc++abi: terminating due to uncaught exception of type NSException
but if I re-run with the correct command, I don't get the exception, but it doesn't run the background task.
Switching back to name without "x" all works fine.
While digging around on StackOverflow, I found a posting that says specifically you can't use any predicates besides those supplied. Unless anyone has another point of view, I think that probably ends the discussion.
First attempt to submit was rejected because it is a game to teach blackjack gameplay and it has “betting” to keep score as if you’re at blackjack table. It’s not a multiplayer game…no interaction with anyone. No purchases or actual betting. Just there to teach the game and give sense of how you might do at the tables if you apply the lessons learned. I’m assuming the concern relates to all the online gambling and fantasy-sports games. This is nothing like that. So what should I do?
Seemingly same problem. Download wheel spins about 1/4 of the way, then reverts back to Install button. App Store Connect stats show that I installed, but it didn't.