I wrote the following code to schedule the download in extension:
AURLDownload *essentialDownload = [[BAURLDownload alloc] initWithIdentifier:url
request:[NSURLRequest requestWithURL:assetURL]
essential:true
fileSize:assetSize
applicationGroupIdentifier:YYBASharedSettings.appGroupIdentifier
priority:BADownloaderPriorityDefault];
NSLog(@"BackgroundAssetsTest extension Schedule essentialDownload url:%@",url);
and the delegate callback is implemented as follows:
- (void)backgroundDownload:(BADownload *)download failedWithError:(NSError *)error
{
NSLog(@"BackgroundAssetsTest extension failedWithError: %@",error);
}
The console outputs the following error:
BackgroundAssetsTest extension failedWithError: 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.}
What's the problem? Scheduled downloads can only be triggered by launching the APP?