objective-c - 创建 AVAssetDownloadURLSession 需要 com.apple.developer.media-asset-download 权利

标签 objective-c nsurlsession entitlements avasset

当我尝试在 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/

相关文章:

Objective-C 时间跨度

objective-c - 使用 Objective-C 在 iOS 9 中将状态栏文本颜色更改为浅色

objective-c - 使用核心数据的父实体继承和逆关系

objective-c - 从 iOS 在后台发送电子邮件

objective-c - NSURLSession 委托(delegate) : How to implement my custom SessionDelegate class accordingly?

objective-c - NSURLSessionDownloadTask 委托(delegate)未触发

ios - 权利无效?

swift - Swift 从服务器接收 Json 数据

ios - iPhone 应用程序提交 : ERROR ITMS-90171: Invalid Bundle Structure (constants. o)