Reputation: 21
When I try to build the instance of AVAssetDownloadURLSession in iOS 9.0, it had a exception.
Reason: 'Creating an AVAssetDownloadURLSession requires the com.apple.developer.media-asset-download entitlement'.
I don't know how to solve the question. Please help me.
My code:
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"AX"];
configuration.HTTPCookieAcceptPolicy = NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain;
configuration.shouldUseExtendedBackgroundIdleMode = YES;
configuration.sessionSendsLaunchEvents = YES;
configuration.HTTPShouldSetCookies = YES;
configuration.HTTPShouldUsePipelining = NO;
configuration.requestCachePolicy = NSURLRequestUseProtocolCachePolicy;
configuration.allowsCellularAccess = YES;
configuration.timeoutIntervalForRequest = 60.0;
configuration.HTTPMaximumConnectionsPerHost = 10;
configuration.discretionary = YES;
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
queue.maxConcurrentOperationCount = 3;
AVAssetDownloadURLSession *session = [AVAssetDownloadURLSession sessionWithConfiguration:configuration assetDownloadDelegate:self delegateQueue:[NSOperationQueue mainQueue]];
Upvotes: 2
Views: 703
Reputation: 648
@martin 's answer is correct. Use TARGET_IOS_SIMULATOR
commenting out the AVAssetDownloadURLSession
related code for debugging on a simulator.
Upvotes: 0
Reputation: 866
AVDownloadURLSession works on devices only. If your trying it on simulator it will crash. Try to run this code on device. It will work.
Upvotes: 2