Meet Background Assets

RSS for tag

Discuss the WWDC22 Session Meet Background Assets

Posts under wwdc2022-110403 tag

22 Posts

Post

Replies

Boosts

Views

Activity

Background Assets: How do I set breakpoints in the extension for debugging?
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?
5
0
2.5k
May ’24
Frequent Appear Download did fail: BAManifestDownload Error Domain=NSURLErrorDomain Code=-999 "cancelled"
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}
3
0
1.2k
Aug ’23
The auto generate asset download extension entitlements file prevents compilation
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)
2
0
1.6k
Aug ’23
Background Assets: Download BAManifestDownload rejected as we are out of download allowance
Background Asset Session: https://developer.apple.com/videos/play/wwdc2022/110403 I create a new project after watching the session. And i add the following in the info.plist: BAMaxInstallSize: 1024000 BAManifestURL: https://xxx.com BAInitialDownloadRestrictions : Dictionary BADownloadAllowance: 1024000 BADownloadDomainAllowList : Array *.xxx.com But when i debug the extension with this command: xcrun backgroundassets-debug -s --app-install -b com.xxx.BADemo1 -d xxxxxxx , i get some error in conslog.app: Download BAManifestDownload - com.xxx.BADemo1.Manifest-xx rejected as we are out of download allowance. Download did fail: BAManifestDownload - com.xxx.BADemo1.Manifest-xx with error: Error Domain=com.apple.backgroundassets.error Code=203 "The requested download will not be allowed due to running out of download allowance." UserInfo={NSLocalizedFailureReason=The requested download will not be allowed due to running out of download allowance.} Rejecting launching extension for <private> because it has already run too long. how i can fix this problem
3
0
1.9k
Apr ’23
Background assed download error: "BAApplicationInfo is missing an extensionIdentity"
I've added a background asset extension and am trying to invoke it using this: xcrun backgroundassets-debug --app-bundle-id com.myCompany.myApp  --device-id 00008120-000225060C9B401E --simulate --app-update  When I run that command I see this in the phone's log: Unable to observe extension for (com.cequint.myapp), the BAApplicationInfo is missing an extensionIdentity. So how should an extension identify be added? The extension's info.plist is as created by the Xcode template: &lt;key&gt;EXAppExtensionAttributes&lt;/key&gt; &lt;dict&gt; &lt;key&gt;EXExtensionPointIdentifier&lt;/key&gt; &lt;string&gt;com.apple.background-asset-downloader-extension&lt;/string&gt; &lt;/dict&gt; And I've added the following to the app's info.plist: &gt; &lt;dict&gt; &lt;key&gt;BGTaskSchedulerPermittedIdentifiers&lt;/key&gt; &lt;array&gt; &lt;string&gt;kBackgroundTaskIdIdentifier_RNScheduleAppRunEvent&lt;/string&gt; &lt;/array&gt;   &lt;key&gt;BAMaxInstallSize&lt;/key&gt;   &lt;integer&gt;3221225472&lt;/integer&gt;   &lt;key&gt;BAInitialDownloadRestrictions&lt;/key&gt;   &lt;dict&gt;          &lt;key&gt;BADownloadDomainAllowList&lt;/key&gt;          &lt;array&gt;                 &lt;string&gt;*.drive.google.com&lt;/string&gt;          &lt;/array&gt;          &lt;key&gt;BADownloadAllowance&lt;/key&gt;          &lt;integer&gt;2147483648&lt;/integer&gt;   &lt;/dict&gt; &lt;key&gt;BAManifestURL&lt;/key&gt; &lt;string&gt;https://drive.google.com/file/d/1doJtzxBKCoVHEF80sndK6VskCrkD9H9r/view?usp=sharing&lt;/string&gt; What else needs doing to provide the extension identifier the OS is saying is missing? (Using Xcode 14.1 and iOS 16.2)
2
0
1.9k
Apr ’23
Background Assets - Access downloads in Exclusive control
I want to run some code in withExclusiveControl and only when the downloads count is 0 Approach 1 manager.fetchCurrentDownloads { downloads, e in manager.withExclusiveControl { a, e in // Here we are in ExclusiveControl but checking for downloads.count == 0 might not give accurate value } } Approach 2 manager.withExclusiveControl { a, e in manager.fetchCurrentDownloads { downloads, e in // Here we can check for downloads.count == 0, but not actually in ExclusiveControl } } Can you please let me know how to achieve this?
1
0
826
Apr ’23
Memory Limit for Background Assets Download Extension
Is there any memory limit for Background Assets Download Extension? I am using a manifest file that is ~2.5MB and has ~15000 entries. I am trying to load them into an array but the process keeps getting killed, there is no error message. If I am loading ~1000 entries, it's working fine. Is there a way to increase the memory limit for Background Assets Extension?
2
0
1.3k
Mar ’23
Trigger Notifications from Background Assets Extension
Is it possible to trigger Local Notifications from Background Assets Extension to update users that Assets are downloaded successfully ? While I was calling UNUserNotificationCenter.current().requestAuthorization UNUserNotificationCenter.current().add getting below error Requesting authorization failed with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.usernotifications.usernotificationservice was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.usernotifications.usernotificationservice was invalidated: failed at lookup with error 159 - Sandbox restriction.} Adding notification request failed with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.usernotifications.usernotificationservice was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.usernotifications.usernotificationservice was invalidated from this process.} Can you please suggest any other alternative to update Users after a download has been completed successfully?
1
0
1k
Mar ’23
Update assets in the background
I am looking to automatically fetch some new (and large) content in the background while the app is closed. The content that needs to be downloaded is user specified, and as such doesn't need to run on install or update, but only periodically to see if the content has been updated. The app is a mac app, and I wanted to know if Background Assets is a good choice for this, as the app may not always be running, and I'd like for the user's content to be updated seemingly when they open the app. If this is the right course of action, what is a recommended way of implementing this? I was thinking of scheduling a request to check for updated assets in BADownloaderExtension.download() and then checking in BADownloaderExtension.backgroundDownload(_:finishedWithFileURL:) if are new content, and then schedule the download of new content or if it is new content then installing it appropriately from there. Thank you - Bastian
1
0
1.6k
Feb ’23
Xcode 14.1 is unable to provision an asset download extension
This can easily be reproduced from scratch following these steps: Launch Xcode and choose to create a new iOS app. Organization name: com.company, ProductName:experiments. Therefore the bundle id is: com.company.experiments Create a background download target, productName:backgroundDownloadExtension. Therefore the bundle is is: com.company.experiments.backgroundDownloadExtension When Xcode creates the extension it automatically gives it a group capability with id: group.com.company.experiements. Within the signing & Capabilities section for the extension there is the following error: Within the developer portal, go to the Identifiers section, locate the main app bundle com.company.experiements. If not ticked, tick the App Groups capability. Click on edit, select group.com.company.experiments Within the developer portal Identifiers section, locate the extension bundle, com.company.experiments.backgroundDownloadExtension. Ensure the App Groups capability is ticked. Click on edit, select group.com.company.experiments. Like so for both the app and extension: Back in Xcode, for the app add the group capability, tick group.com.company.experiments. Now it matches the extension and will be like this for both of them: Quit and relaunch Xcode because Xcode is so unbelievably sticky and seems to cache everything, e-v-e-r-y-t-h-i-n-g, and millions of problems can be solved just by quitting/relaunching it. In the Signing & Capabilities section for the extension it still displays this: Back in the developer portal, create a provisioning profile for iOS development, choose the com.company.experiments bundle id, download it. Do likewise for the com.company.experiments.backgroundDownloadExtension After downloading, click on them both. Quit and re-lanch Xcode again. Any luck? No its still displaying the provisioning error. Ok, enough of Xcode's automatic management of signing. Let's turn that off and import the the extension provisioning profile that was just downloaded. Still getting this error: The entitlements file's contents are: <key>com.apple.security.application-groups</key> <array> <string>group.com.company.experiments</string> </array> The contents of the downloaded extension profile are: <key>Entitlements</key> <dict> <key>com.apple.security.application-groups</key> <array> <string>group.com.company.experiments</string> </array> <key>application-identifier</key> <string>MV8J9D3236.com.company.experiments.backgroundDownloadExtension</string> <key>keychain-access-groups</key> <array> <string>MV8J9D3236.*</string> <string>com.apple.token</string> </array> <key>get-task-allow</key> <true/> <key>com.apple.developer.team-identifier</key> <string>MV8J9D3236</string> </dict> I give up, how the hell can you create a background download extension without Xcode displaying the error?
3
1
1.8k
Jan ’23
I get an error when executing the debug command
Hello everyone,I get an error when calling the test command. Command: xcrun backgroundassets-debug --app-bundle-id com.myCompany --device-id xxx-xxx-xxx-xxx-xxxx --simulate --app-install xcrun backgroundassets-debug --app-bundle-id com.myCompany --device-id xxx-xxx-xxx-xxx-xxxx --simulate --app-update xcrun backgroundassets-debug --app-bundle-id com.myCompany --device-id xxx-xxx-xxx-xxx-xxxx --app-periodic-check I made sure that the --app-bundle-id and --device-id entered are valid and that the simulator runs the project through XCode.But I get the same error message with the 3 sets of commands above: The requested device to send simulation events to is not available. Verify that the device is connected to this Mac. My XCode version is 14.1 official version. I hope someone can help me to find out the problem, thank you very much~
1
0
929
Dec ’22
Background Assets: manifestURL file does not exist
I have the manifestURL set up in the info.plist. Write the following code for extension - (NSSet<BADownload *> *)downloadsForRequest:(BAContentRequest)contentRequest                  manifestURL:(NSURL *)manifestURL                 extensionInfo:(BAAppExtensionInfo *)extensionInfo {   [BADownloadManager sharedManager].delegate = self;   NSLog(@"BackgroundAssetsTest extension downloadsForRequestWithManifestURLExist:%@",@([[NSFileManager defaultManager] fileExistsAtPath:self.manifestURL.absoluteString]));   NSLog(@"BackgroundAssetsTest extension downloadsForRequest: %@",manifestURL);   NSError *cfgError;   NSString *config = [NSString stringWithContentsOfFile:self.manifestURL.absoluteString encoding:NSUTF8StringEncoding error:&cfgError];   NSLog(@"BackgroundAssetsTest extension downloadsForRequestCfg:%@ error:%@",config,cfgError); ....    } Trigger using the backgroundassets-debug tool. But the manifestURL file of the extension delegate callback does not exist. Viewing console.app Logs: BackgroundAssetsTest extension downloadsForRequestWithManifestURLExist:0 BackgroundAssetsTest extension downloadsForRequest: file:///var/tmp/com.apple.backgroundassets.downloadstaging/com.my.bundleid/994c0d0f-17c0-44b3-8e92-144927701b9c.json BackgroundAssetsTest extension downloadsForRequestCfg:(null) error:Error Domain=NSCocoaErrorDomain Code=260 "The file “994c0d0f-17c0-44b3-8e92-144927701b9c.json” couldn’t be opened because there is no such file." UserInfo={NSFilePath=file:///var/tmp/com.apple.backgroundassets.downloadstaging/com.my.bundleid/994c0d0f-17c0-44b3-8e92-144927701b9c.json, NSUnderlyingError=0x103f06e90 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} What happens when I'm supposed to read the file for parsing, but it doesn't exist!!
1
0
1.1k
Dec ’22
How is one supposed to create a Background Assets extension? There's no extension type for this existing in Xcode beta 5
I want to use features described in the background assets WWDC22 session, however with Xcode 14 Beta 5 there is no application extension of this type. There was an application extension type with beta 4, but there are two problems with this firstly Testflight doesn't recognize it so its impossible to upload and therefore use (because some of the features are documented as only working when the app is installed from Testflight/App Store). secondly, if one creates an extension using Xcode beta 4, then it complies with beta 4, but it won't compile with beta 5. Therefore it is currently impossible to even begin to start working with the background assets extension framework.
3
0
1.1k
Sep ’22
Background Assets: How do I set breakpoints in the extension for debugging?
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?
Replies
5
Boosts
0
Views
2.5k
Activity
May ’24
Frequent Appear Download did fail: BAManifestDownload Error Domain=NSURLErrorDomain Code=-999 "cancelled"
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}
Replies
3
Boosts
0
Views
1.2k
Activity
Aug ’23
The auto generate asset download extension entitlements file prevents compilation
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)
Replies
2
Boosts
0
Views
1.6k
Activity
Aug ’23
Background Assets, the authorization of network access
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?
Replies
1
Boosts
0
Views
667
Activity
Jun ’23
Background Assets undocumented error
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?
Replies
1
Boosts
0
Views
939
Activity
Jun ’23
Background Assets: Download BAManifestDownload rejected as we are out of download allowance
Background Asset Session: https://developer.apple.com/videos/play/wwdc2022/110403 I create a new project after watching the session. And i add the following in the info.plist: BAMaxInstallSize: 1024000 BAManifestURL: https://xxx.com BAInitialDownloadRestrictions : Dictionary BADownloadAllowance: 1024000 BADownloadDomainAllowList : Array *.xxx.com But when i debug the extension with this command: xcrun backgroundassets-debug -s --app-install -b com.xxx.BADemo1 -d xxxxxxx , i get some error in conslog.app: Download BAManifestDownload - com.xxx.BADemo1.Manifest-xx rejected as we are out of download allowance. Download did fail: BAManifestDownload - com.xxx.BADemo1.Manifest-xx with error: Error Domain=com.apple.backgroundassets.error Code=203 "The requested download will not be allowed due to running out of download allowance." UserInfo={NSLocalizedFailureReason=The requested download will not be allowed due to running out of download allowance.} Rejecting launching extension for <private> because it has already run too long. how i can fix this problem
Replies
3
Boosts
0
Views
1.9k
Activity
Apr ’23
Background assed download error: "BAApplicationInfo is missing an extensionIdentity"
I've added a background asset extension and am trying to invoke it using this: xcrun backgroundassets-debug --app-bundle-id com.myCompany.myApp  --device-id 00008120-000225060C9B401E --simulate --app-update  When I run that command I see this in the phone's log: Unable to observe extension for (com.cequint.myapp), the BAApplicationInfo is missing an extensionIdentity. So how should an extension identify be added? The extension's info.plist is as created by the Xcode template: &lt;key&gt;EXAppExtensionAttributes&lt;/key&gt; &lt;dict&gt; &lt;key&gt;EXExtensionPointIdentifier&lt;/key&gt; &lt;string&gt;com.apple.background-asset-downloader-extension&lt;/string&gt; &lt;/dict&gt; And I've added the following to the app's info.plist: &gt; &lt;dict&gt; &lt;key&gt;BGTaskSchedulerPermittedIdentifiers&lt;/key&gt; &lt;array&gt; &lt;string&gt;kBackgroundTaskIdIdentifier_RNScheduleAppRunEvent&lt;/string&gt; &lt;/array&gt;   &lt;key&gt;BAMaxInstallSize&lt;/key&gt;   &lt;integer&gt;3221225472&lt;/integer&gt;   &lt;key&gt;BAInitialDownloadRestrictions&lt;/key&gt;   &lt;dict&gt;          &lt;key&gt;BADownloadDomainAllowList&lt;/key&gt;          &lt;array&gt;                 &lt;string&gt;*.drive.google.com&lt;/string&gt;          &lt;/array&gt;          &lt;key&gt;BADownloadAllowance&lt;/key&gt;          &lt;integer&gt;2147483648&lt;/integer&gt;   &lt;/dict&gt; &lt;key&gt;BAManifestURL&lt;/key&gt; &lt;string&gt;https://drive.google.com/file/d/1doJtzxBKCoVHEF80sndK6VskCrkD9H9r/view?usp=sharing&lt;/string&gt; What else needs doing to provide the extension identifier the OS is saying is missing? (Using Xcode 14.1 and iOS 16.2)
Replies
2
Boosts
0
Views
1.9k
Activity
Apr ’23
Background Assets - Access downloads in Exclusive control
I want to run some code in withExclusiveControl and only when the downloads count is 0 Approach 1 manager.fetchCurrentDownloads { downloads, e in manager.withExclusiveControl { a, e in // Here we are in ExclusiveControl but checking for downloads.count == 0 might not give accurate value } } Approach 2 manager.withExclusiveControl { a, e in manager.fetchCurrentDownloads { downloads, e in // Here we can check for downloads.count == 0, but not actually in ExclusiveControl } } Can you please let me know how to achieve this?
Replies
1
Boosts
0
Views
826
Activity
Apr ’23
Memory Limit for Background Assets Download Extension
Is there any memory limit for Background Assets Download Extension? I am using a manifest file that is ~2.5MB and has ~15000 entries. I am trying to load them into an array but the process keeps getting killed, there is no error message. If I am loading ~1000 entries, it's working fine. Is there a way to increase the memory limit for Background Assets Extension?
Replies
2
Boosts
0
Views
1.3k
Activity
Mar ’23
Trigger Notifications from Background Assets Extension
Is it possible to trigger Local Notifications from Background Assets Extension to update users that Assets are downloaded successfully ? While I was calling UNUserNotificationCenter.current().requestAuthorization UNUserNotificationCenter.current().add getting below error Requesting authorization failed with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.usernotifications.usernotificationservice was invalidated: failed at lookup with error 159 - Sandbox restriction." UserInfo={NSDebugDescription=The connection to service named com.apple.usernotifications.usernotificationservice was invalidated: failed at lookup with error 159 - Sandbox restriction.} Adding notification request failed with error: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.usernotifications.usernotificationservice was invalidated from this process." UserInfo={NSDebugDescription=The connection to service named com.apple.usernotifications.usernotificationservice was invalidated from this process.} Can you please suggest any other alternative to update Users after a download has been completed successfully?
Replies
1
Boosts
0
Views
1k
Activity
Mar ’23
Update assets in the background
I am looking to automatically fetch some new (and large) content in the background while the app is closed. The content that needs to be downloaded is user specified, and as such doesn't need to run on install or update, but only periodically to see if the content has been updated. The app is a mac app, and I wanted to know if Background Assets is a good choice for this, as the app may not always be running, and I'd like for the user's content to be updated seemingly when they open the app. If this is the right course of action, what is a recommended way of implementing this? I was thinking of scheduling a request to check for updated assets in BADownloaderExtension.download() and then checking in BADownloaderExtension.backgroundDownload(_:finishedWithFileURL:) if are new content, and then schedule the download of new content or if it is new content then installing it appropriately from there. Thank you - Bastian
Replies
1
Boosts
0
Views
1.6k
Activity
Feb ’23
Xcode 14.1 is unable to provision an asset download extension
This can easily be reproduced from scratch following these steps: Launch Xcode and choose to create a new iOS app. Organization name: com.company, ProductName:experiments. Therefore the bundle id is: com.company.experiments Create a background download target, productName:backgroundDownloadExtension. Therefore the bundle is is: com.company.experiments.backgroundDownloadExtension When Xcode creates the extension it automatically gives it a group capability with id: group.com.company.experiements. Within the signing & Capabilities section for the extension there is the following error: Within the developer portal, go to the Identifiers section, locate the main app bundle com.company.experiements. If not ticked, tick the App Groups capability. Click on edit, select group.com.company.experiments Within the developer portal Identifiers section, locate the extension bundle, com.company.experiments.backgroundDownloadExtension. Ensure the App Groups capability is ticked. Click on edit, select group.com.company.experiments. Like so for both the app and extension: Back in Xcode, for the app add the group capability, tick group.com.company.experiments. Now it matches the extension and will be like this for both of them: Quit and relaunch Xcode because Xcode is so unbelievably sticky and seems to cache everything, e-v-e-r-y-t-h-i-n-g, and millions of problems can be solved just by quitting/relaunching it. In the Signing & Capabilities section for the extension it still displays this: Back in the developer portal, create a provisioning profile for iOS development, choose the com.company.experiments bundle id, download it. Do likewise for the com.company.experiments.backgroundDownloadExtension After downloading, click on them both. Quit and re-lanch Xcode again. Any luck? No its still displaying the provisioning error. Ok, enough of Xcode's automatic management of signing. Let's turn that off and import the the extension provisioning profile that was just downloaded. Still getting this error: The entitlements file's contents are: <key>com.apple.security.application-groups</key> <array> <string>group.com.company.experiments</string> </array> The contents of the downloaded extension profile are: <key>Entitlements</key> <dict> <key>com.apple.security.application-groups</key> <array> <string>group.com.company.experiments</string> </array> <key>application-identifier</key> <string>MV8J9D3236.com.company.experiments.backgroundDownloadExtension</string> <key>keychain-access-groups</key> <array> <string>MV8J9D3236.*</string> <string>com.apple.token</string> </array> <key>get-task-allow</key> <true/> <key>com.apple.developer.team-identifier</key> <string>MV8J9D3236</string> </dict> I give up, how the hell can you create a background download extension without Xcode displaying the error?
Replies
3
Boosts
1
Views
1.8k
Activity
Jan ’23
I get an error when executing the debug command
Hello everyone,I get an error when calling the test command. Command: xcrun backgroundassets-debug --app-bundle-id com.myCompany --device-id xxx-xxx-xxx-xxx-xxxx --simulate --app-install xcrun backgroundassets-debug --app-bundle-id com.myCompany --device-id xxx-xxx-xxx-xxx-xxxx --simulate --app-update xcrun backgroundassets-debug --app-bundle-id com.myCompany --device-id xxx-xxx-xxx-xxx-xxxx --app-periodic-check I made sure that the --app-bundle-id and --device-id entered are valid and that the simulator runs the project through XCode.But I get the same error message with the 3 sets of commands above: The requested device to send simulation events to is not available. Verify that the device is connected to this Mac. My XCode version is 14.1 official version. I hope someone can help me to find out the problem, thank you very much~
Replies
1
Boosts
0
Views
929
Activity
Dec ’22
Running app , even though user completely closed the app
Is it possible to run the app in the background even though the user has completely closed it? I want to fetch device activity every 15 mins. Is this possible to fetch even though the app is completely closed?
Replies
3
Boosts
0
Views
1.2k
Activity
Dec ’22
Background Assets: manifestURL file does not exist
I have the manifestURL set up in the info.plist. Write the following code for extension - (NSSet<BADownload *> *)downloadsForRequest:(BAContentRequest)contentRequest                  manifestURL:(NSURL *)manifestURL                 extensionInfo:(BAAppExtensionInfo *)extensionInfo {   [BADownloadManager sharedManager].delegate = self;   NSLog(@"BackgroundAssetsTest extension downloadsForRequestWithManifestURLExist:%@",@([[NSFileManager defaultManager] fileExistsAtPath:self.manifestURL.absoluteString]));   NSLog(@"BackgroundAssetsTest extension downloadsForRequest: %@",manifestURL);   NSError *cfgError;   NSString *config = [NSString stringWithContentsOfFile:self.manifestURL.absoluteString encoding:NSUTF8StringEncoding error:&cfgError];   NSLog(@"BackgroundAssetsTest extension downloadsForRequestCfg:%@ error:%@",config,cfgError); ....    } Trigger using the backgroundassets-debug tool. But the manifestURL file of the extension delegate callback does not exist. Viewing console.app Logs: BackgroundAssetsTest extension downloadsForRequestWithManifestURLExist:0 BackgroundAssetsTest extension downloadsForRequest: file:///var/tmp/com.apple.backgroundassets.downloadstaging/com.my.bundleid/994c0d0f-17c0-44b3-8e92-144927701b9c.json BackgroundAssetsTest extension downloadsForRequestCfg:(null) error:Error Domain=NSCocoaErrorDomain Code=260 "The file “994c0d0f-17c0-44b3-8e92-144927701b9c.json” couldn’t be opened because there is no such file." UserInfo={NSFilePath=file:///var/tmp/com.apple.backgroundassets.downloadstaging/com.my.bundleid/994c0d0f-17c0-44b3-8e92-144927701b9c.json, NSUnderlyingError=0x103f06e90 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}} What happens when I'm supposed to read the file for parsing, but it doesn't exist!!
Replies
1
Boosts
0
Views
1.1k
Activity
Dec ’22
Background Assets how to test your extension and to simulate its entry points.
Background Assets how to test your extension and to simulate its entry points.
Replies
3
Boosts
0
Views
1.7k
Activity
Nov ’22
Background Assets How do I manage downloaded resources
If the resource downloaded through BADownloadManager has been completed, will BADownloadManager download the same resource repeatedly? If not, does the developer have to keep track of the downloaded resources? So that when the extension is triggered, the query ignores the downloaded resources
Replies
0
Boosts
0
Views
1.7k
Activity
Nov ’22
Background Download: Error executing "backgroundassetes-debug"
When I use the "backgroundassetes-debug" cmd to trigger the background download extension callback, I get a "Refused to start extension for because it has been running for too long" error except the first time. Since I'm in the testing phase, I want it to be successfully triggered multiple times by the test cmd. So how to solve this problem.
Replies
1
Boosts
0
Views
747
Activity
Nov ’22
Background Assests: How to test BADownloadManager.scheduleDownload function
When I submit a task via the BADownloadManager.scheduleDownload API in my tests, I don't know when the task will be executed. It looks like I can only wait for the syscall. Is there any way to test this api with some test commands?
Replies
1
Boosts
0
Views
779
Activity
Nov ’22
How is one supposed to create a Background Assets extension? There's no extension type for this existing in Xcode beta 5
I want to use features described in the background assets WWDC22 session, however with Xcode 14 Beta 5 there is no application extension of this type. There was an application extension type with beta 4, but there are two problems with this firstly Testflight doesn't recognize it so its impossible to upload and therefore use (because some of the features are documented as only working when the app is installed from Testflight/App Store). secondly, if one creates an extension using Xcode beta 4, then it complies with beta 4, but it won't compile with beta 5. Therefore it is currently impossible to even begin to start working with the background assets extension framework.
Replies
3
Boosts
0
Views
1.1k
Activity
Sep ’22