Here is my code to get user token
NSString *developerToken = @"eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlVaMzI1Q0MyMkcifQ.eyJpc3MiOiJEWjI4TDk1OFBCIiwiaWF0IjoxNTI1MjY1NjE0LCJleHAiOjE1Mzg0Mzg0MDB9.frMVLzCx3oaUyqcBzZvSoB60LjCrtqmiCwf-ouQ1Y12UYpW5w8R-cmAX6N_Fwpz_l5CFe3OkYP3uET7uCPvyOw";
[SKCloudServiceController requestAuthorization:^(SKCloudServiceAuthorizationStatus status) {
self->cloudServiceController = [[SKCloudServiceController alloc] init];
[self->cloudServiceController requestCapabilitiesWithCompletionHandler:^(SKCloudServiceCapability capabilities, NSError * _Nullable error) {
[self->cloudServiceController requestStorefrontIdentifierWithCompletionHandler:^(NSString * _Nullable storefrontIdentifier,
NSError * _Nullable error) {
NSString *identifier = [[storefrontIdentifier componentsSeparatedByString:@","] firstObject];
identifier = [[identifier componentsSeparatedByString:@"-"] firstObject];
if (@available(iOS 11.0, *)) {
[self->cloudServiceController requestUserTokenForDeveloperToken:developerToken completionHandler:^(NSString * _Nullable userToken, NSError * _Nullable error) {
NSLog(@"%@",error);
NSLog(@"%@",userToken);
}];
} else {
// Fallback on earlier versions
}
//NSString *countryCode = [self countryCodeWithIdentifier:identifier];
}];
}];
}];
but I am getting userToken as nil and error as
"Error Domain=SKErrorDomain Code=7 "(null)" UserInfo={NSUnderlyingError=0x1c08437b0 {Error Domain=SSErrorDomain Code=109 "(null)" UserInfo={NSUnderlyingError=0x1c08437e0 {Error Domain=SSErrorDomain Code=109 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store, SSErrorHTTPStatusCodeKey=401}}}}}"
What I'm doing wrong ? please help