Post not yet marked as solved
I've added a background downloads extension to my app and added device console logging to every method in the placeholder code created by XCode, and Setting a breakpoint, then installed the app to the phone.
When I run the following command:
xcrun backgroundassets-debug --app-bundle-id com.myCompany.myApp --device-id 00008110-001E0DDA0AB8801E --simulate --app-update
prompt: Application was updated event was sent for app identifier: (com.myCompany.myApp).
But the break point did not enter。Nothing is sent, and there is no log output
How do I set breakpoints in the extension for debugging?
Post not yet marked as solved
Frequent Appear Download did fail: BAManifestDownload Error Domain=NSURLErrorDomain Code=-999 "cancelled" ,
How to resolve this error ?
Here is Logs:
Dec 30 11:16:02 backgroundassets.user[288] <Error>: Failed to send -[BADownloaderExtensionProxy sendAuthenticationChallenge:download:completionHandler:]_block_invoke for: com.xx.BADemoserror: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service with pid 1999 named com.xx.BADemos.extension was invalidated from this process." UserInfo={NSDebugDescription=The connection to service with pid 1999 named com.xx.BADemos.extension was invalidated from this process.}
Dec 30 11:16:02 backgroundassets.user[288] <Error>: Cannot message extension for 'com.xx.BADemos' to answer auth challenge, canceling challenge for download: BAManifestDownload (0xd5e839fc0) - com.xx.BADemos.Manifest-B57DC493-0E76-49A0-9429-BB40B439DC22
Dec 30 11:16:02 backgroundassets.user(CFNetwork)[288] <Notice>: Task <19F9FE6C-0DDE-419A-95F4-B309166FBA71>.<1> auth completion disp=2 cred=0x0
Dec 30 11:16:02 backgroundassets.user[288] <Notice>: Extension invalidated for identifier: com.xx.BADemos
Dec 30 11:16:02 runningboardd(RunningBoard)[31] <Notice>: Invalidating assertion 31-288-23055 (target:[xpcservice<com.xx.BADemos.extension([osservice<com.apple.backgroundassets.user>:288])>:1999]) from originator [osservice<com.apple.backgroundassets.user>:288]
Dec 30 11:16:02 backgroundassets.user(CFNetwork)[288] <Notice>: Connection 85: cleaning up
Dec 30 11:16:02 backgroundassets.user(CFNetwork)[288] <Notice>: Connection 85: summary for unused connection {protocol="h2", domain_lookup_duration_ms=0, connect_duration_ms=0, secure_connection_duration_ms=0, private_relay=false, idle_duration_ms=0}
Dec 30 11:16:03 backgroundassets.user(CFNetwork)[288] <Notice>: Task <19F9FE6C-0DDE-419A-95F4-B309166FBA71>.<1> finished with error [-999] Error Domain=NSURLErrorDomain Code=-999 UserInfo={NSErrorFailingURLStringKey=<private>, NSErrorFailingURLKey=<private>, _NSURLErrorRelatedURLSessionTaskErrorKey=<private>, _NSURLErrorFailingURLSessionTaskErrorKey=<private>, NSLocalizedDescription=<private>}
Dec 30 11:16:03 backgroundassets.user(Network)[288] <Notice>: [C85 DEA8B25F-4296-4950-8F8B-5DFBD7D54FFE Hostname#138f72b3:443 tcp, bundle id: com.xx.BADemos, url hash: 03f00812, tls, attribution: developer] cancel
Dec 30 11:16:03 backgroundassets.user(Network)[288] <Notice>: [C85 Hostname#138f72b3:443 tcp, bundle id: com.xx.BADemos, url hash: 03f00812, tls, attribution: developer] cancelled
Dec 30 11:16:03 backgroundassets.user[288] <Error>: Download did fail: BAManifestDownload (0xd5e839fc0) - com.xx.BADemos.Manifest-B57DC493-0E76-49A0-9429-BB40B439DC22 with error: Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://xx.xx.com/321809_7fb0d3cb44918c0c3598ae15d151713d.json, NSErrorFailingURLKey=https://https://xx.xx.com/321809_7fb0d3cb44918c0c3598ae15d151713d.json321809_7fb0d3cb44918c0c3598ae15d151713d.json, _NSURLErrorRelatedURLSessionTaskErrorKey=(
"LocalDownloadTask <19F9FE6C-0DDE-419A-95F4-B309166FBA71>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDownloadTask <19F9FE6C-0DDE-419A-95F4-B309166FBA71>.<1>, NSLocalizedDescription=cancelled}
Post not yet marked as solved
Apple this is dead easy and quick to reproduce.
Just create an app and then add a target of type background download.
Xcode automatically assigns a group id to the target and generates a corresponding entitlements file like so:
However the extension will not build, there is this error:
You can bugger about in the developer portal as long as you want, ensuring the group identifier exists, ensuring provisioning profiles have this group capability, etc. etc. nothing will make this error go away.
Now, what is unique about the download extension's entitlements file is the com.apple.developer.team-identifier key. This does not get generated for other extension - go ahead and see for yourself, create an action extension and give it a group, the result is its group appears in the entitlements file but not this com.apple.developer.team-identifier.
If you try to print out $(TeamIdentifierPrefix) (via echoing it in a build script), you get this
/Users/me/Library/Developer/Xcode/DerivedData/experiments-clpwbtcvdpqwuodxzwmsxwpztguo/Build/Intermediates.noindex/experiments.build/Debug-iphoneos/backgroundDownloadExtension.build/Script-243C9904292461BC001FDE14.sh: line 4: TeamIdentifierPrefix: command not found
Hmm, command not found, but if you change the echo to ${TeamIdentifierPrefix} guess what gets printed, yes the team identifier i.e. in my case MV8J9D3236.
Now if in the entitlements file I add the team identifier explicitly, like so
Then magically the error about automatic signing and the provisioning profile goes away. Change it back to $(TeamIdentifierPrefix) and the error appears, change it to be explicit and it goes away.
So by tweaking the entitlements file its possible to get the extension to build, however all is not well, now that it builds, if the extension is installed and run, the OS says:
"Event (1) dropped for client (com.company.experiments) failed because the app and extension do not share any application groups."
It says that despite the fact the app and extension both do have the same group capability.
This is driving me nuts - the auto generated entitlements file is stopping the extension from compiling, but if you fix the build, it can't run.
(Xcode 14.1, iOS 16.2)
Post not yet marked as solved
On Chinese devices, the APP requires the authorization of network access. On the newly installed APP, if the user has not authorized it, will Background Assets work normally?
Post not yet marked as solved
I get this error in the latest Xcode 14.3 RC1 in 16.4 iPhone simulator:
Calling `startForegroundDownload:error:` with an `Essential` necessity is prohibited.
I found .isNecessity property on BADownload but it's get-only and I can't find any other documentation on this. This worked in the past and there are no docs. Any ideas?