我正在尝试使用 [AVAssetResourceLoadingRequest streamingContentKeyRequestDataForApp:contentIdentifier:options:error:] 方法来获取 SPC 密钥,但是返回给我的是 nil,而不是预期的 SPC 值。我主要参考了提供的 Fairplay 应用示例。我将编码后的请求 URL 主机字符串用作内容标识符,并将从 SPC 服务器检索的 .DER 证书用作应用程序数据。有其他人遇到过这个问题吗?
NSString *hostString = [URL host];
NSData *assetId = [NSData dataWithBytes:[hostString cStringUsingEncoding:NSUTF8StringEncoding] length:[hostString lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
NSData *certificate = (obtained via Key Server).
NSError *error;
NSData *SPC = [loadingRequest streamingContentKeyRequestDataForApp:certificate contentIdentifier:assetId options:nil error:&error]
SPC的输出为空。完整的错误描述如下:
Error Domain=AVFoundationErrorDomain
Code=-11800 "The operation could not be completed"
UserInfo=0x170461980
{NSUnderlyingError=0x1740548e0 "The operation couldn’t be completed. (OSStatus error -12640.)",
NSLocalizedFailureReason=An unknown error occurred (-12640),
NSLocalizedDescription=The operation could not be completed}