Post not yet marked as solved
In our app, We have to download 5000 assets in the Install/Periodic event. Obviously, we can't download them all in parallel.
If we return all 5000 entries in the extension downloads function, will the system take care of queueing and downloading some 20 assets parallelly and take care of downloading all of 5000 assets?
Or Should we return only 20 urls and after if got finished, from the finished call back we can repeatedly schedule the next 20 every time and can download all of 5000 assets?
If we can't reduce the number of assets(like in our case 5000 entries), What is the recommended way of downloading it?
My Background Assets extension arranges to download image resources, as follows:
NSURL *assetURL = [NSURL URLWithString:@"https://***.png”];
NSUInteger assetSize = 6849;
switch (contentRequest) {
case BAContentRequestInstall:
case BAContentRequestUpdate:
{
BAURLDownload *essentialDownload = [[BAURLDownload alloc] initWithIdentifier:@"YYBADAsset"
request:[NSURLRequest requestWithURL:assetURL]
essential:true
fileSize:assetSize
applicationGroupIdentifier:appGroupIdentifier
priority:BADownloaderPriorityDefault];
[downloadsToSchedule addObject:essentialDownload];
break;
}
}
At the same time, the finishedWithFileURL method is implemented as follows:
- (void)backgroundDownload:(BADownload *)download finishedWithFileURL:(NSURL *)fileURL
{
NSLog(@"BackgroundAssetsTest extension finishedWithFileURL:%@ forDownlad:%@",fileURL,download.identifier);
NSLog(@"BackgroundAssetsTest extension finishedWithManifestURLExist:%@",@([[NSFileManager defaultManager] fileExistsAtPath:fileURL.absoluteString]));
}
And then use tools to trigger events,
xcrun backgroundassets-debug --app-bundle-id com.luph.mytest --device-id 00008020-000A04xxF0002E --simulate --app-install
The following log is observed through the console:
BackgroundAssetsTest extension finishedWithFileURL:file:///private/var/mobile/Containers/Shared/AppGroup/1D051E06-E597-4670-969A-38ECA52C4F7A/Library/C aches/com.apple.BackgroundAssets/BAFile-5152AFB2.tmp forDownlad:YYBADAsset
BackgroundAssetsTest extension finishedWithManifestURLExist:0
What's the problem? Did I set the size of BAURLDownload to be different from the actual download size? Or the wrong way to determine the existence of the file?
Post not yet marked as solved
Hi, I used Background assets to download files during install/update events. The debug build works fine when I trigger the install event through terminal. The same code base (with different bundle ID ) is used in Test Flight build. But the file is not downloaded when I install the TestFlight build. I'm getting following error in Console while installing the TestFlight build.
sometimes, i'm getting Failed to notify extension about finished download: BAURLDownload (0x61a80ab98):
guard let url = URL(string:"https://devstreaming-cdn.apple.com/videos/wwdc/2021/10220/6/3866585A-3920-44B4-AB3F-03A446FCDE3A/downloads/wwdc2021-10220_hd.mp4") else{
return Set()
}
switch (request) {
case .install, .update:
let essentialDownload =
BAURLDownload(
identifier: "avtar345",
request: URLRequest(url: url),
essential: true,
fileSize: 155384552,
applicationGroupIdentifier: appGroupIdentifier,
priority: .default)
downloadsToSchedule.insert(essentialDownload)
break;
case .periodic: break;
}
Post not yet marked as solved
Hi team,
I tried to download an image using the background assets . In development it downloads the image when I trigger the xcrun backgroundassets-debug command with instal event. But the image is not downloading for Test flight build.
In console I observed the following errors while installing the app,
Why am I getting this error while installing the app and how to resolve this?
Post not yet marked as solved
Hi , i tried to download image using background assets framework. I tried to use install and update events to test the extension. But the extension always delegate to backgroundDownload(_ :failedWithError :) function with following error
Error Domain=BAErrorDomain Code=202 "The requested URL is not permitted to be downloaded until the application is launched." UserInfo={NSLocalizedFailureReason=The requested URL is not permitted to be downloaded until the application is launched.}
I used the following url to download the image https://w0.peakpx.com/wallpaper/934/165/HD-wallpaper-avatar-aang-aang-airbender-aire-appa-avatar-legend-leyenda.jpg
Why am i getting this error and how to resolve this?
Post not yet marked as solved
I download the demo provided by WWDC 2023 Session 10108 "What’s new in Background Assets", and I configure all targets to my developer team for signing so I can run the application on my device. But I get an error when I use backgroundassets-debug command:
xcrun backgroundassets-debug --simulate --app-periodic-check --device-id 00008030-001631C036208*** --app-bundle-id com.example.apple-samplecode.WWDC-Sessions8QQGK9DXXX
Error Log:
backgroundassets.user Unable to use persistent identifier to update application info. Falling back to bundle identifier lookup. (bundle identifier: com.example.apple-samplecode.WWDC-Sessions8QQGK9DJB9)
......
backgroundassets.user Failed to get extension process: Error Domain=com.apple.extensionKit.errorDomain Code=4 "Failed to aquire assertion for pid: 3091" UserInfo={NSLocalizedDescription=Failed to aquire assertion for pid: 3091}
......
backgroundassets.user Failed to get extension process: Error Domain=com.apple.extensionKit.errorDomain Code=4 "Failed to aquire assertion for pid: 3092" UserInfo={NSLocalizedDescription=Failed to aquire assertion for pid: 3092}
backgroundassets.user -[BAAgentCore downloadQueue:manifest:finishedWithFileURL:]_block_invoke, Failed to access extension for com.example.apple-samplecode.WWDC-Sessions8QQGK9DXXX.
backgroundassets.user Removing manifest download as extension did not handle manifest. BAManifestDownload (0x75cd44aa0): [ID:com.example.apple-samplecode.WWDC-Sessions8QQGK9DXXX.Manifest-3BE0D398-734D-4E12-90DD-EE943D6DCXXX, AppID:com.example.apple-samplecode.WWDC-Sessions8QQGK9DXXX, Necessity:Essential]
Any help will be gratefully appreciated
Post not yet marked as solved
Message failed: -[BAAgentClientProxy currentDownloadsWithCompletion:]_block_invoke error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.backgroundassets.user" UserInfo={NSDebugDescription=connection to service named com.apple.backgroundassets.user}
The above error occurs when debugging Background Assets on iPhone。