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!!