I can't get spc when use Fairplay in IOS

streamingContentKeyRequestDataForApp:contentIdentifier function always return error 268451843


[1]@"NSLocalizedFailureReason" : @"An unknown error occurred (268451843)"

[2]@"NSLocalizedDescription" : @"The operation could not be completed"


- (NSData *)myGetAppCertificateData
{
     NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"fairplay" ofType:@"der"];
    NSData*certificate=[NSData dataWithContentsOfFile:resourcePath];
    return certificate;
}


in resourceLoader:(AVAssetResourceLoader *)resourceLoader shouldWaitForLoadingOfRequestedResource:(AVAssetResourceLoadingRequest *)loadingRequest


  NSString *assetStr;
  NSData *assetId;
  NSData *requestBytes;


    assetStr = [url host];
    assetId = [NSData dataWithBytes: [assetStr cStringUsingEncoding:NSUTF8StringEncoding] length:[assetStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
    NSData *certificate = [self myGetAppCertificateData];
    #pragma mark ADAPT: YOU MUST CALL: streamingContentKeyRequestDataForApp::options:


    requestBytes = [loadingRequest streamingContentKeyRequestDataForApp:certificate
                                                      contentIdentifier:assetId
                                                                options:nil
                                                                  error:&error];


please help us to debug

Replies

I am facing the similar issue. Did you solve it?

Hello,


You must use a 'real' FairPlay client certificate (not the one from the demo SDK).


The FairPlay system can only be tested end-to-end with a certificate from a deployment package (must be requested from Apple)