当我尝试在 iOS 9.0 中构建 AVAssetDownloadURLSession 的实例时,出现异常。
原因:“创建 AVAssetDownloadURLSession 需要 com.apple.developer.media-asset-download 权利”。
我不知道如何解决这个问题。请帮助我。
我的代码:
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]];
最佳答案
AVDownloadURLSession 仅适用于设备。如果你在模拟器上尝试它会崩溃。尝试在设备上运行此代码。它会起作用的。
关于objective-c - 创建 AVAssetDownloadURLSession 需要 com.apple.developer.media-asset-download 权利,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44941121/