Error using SKCloudServiceController API to check Apple Music capabilities

本小妞迷上赌 提交于 2019-12-11 06:29:55

问题


I am using this code to try to check a devices Apple Music capabilities:

  SKCloudServiceController *controller = [SKCloudServiceController new];
  [controller requestCapabilitiesWithCompletionHandler:^(SKCloudServiceCapability capabilities, NSError * _Nullable error) {
    if (error != nil) {
      NSLog(@"Error getting SKCloudServiceController capabilities: %@", error);
    } else if (capabilities & SKCloudServiceCapabilityMusicCatalogPlayback) {
      NSLog(@"YES SUBSCRIBED!!!!");
    } else {
      NSLog(@"NOT SUBSCRIBED!!!!");
    }
  }];

Unfortunately, I can not track down how to fix the errors I am receiving.

I assume that SKCloudServiceController is finding out the device capabilities locally and should not need to connect to Apple to determine this.

So why do the errors lead me to believe that SKCloudServiceController is having some sort of communications problem connecting to Apple?

Here is the time stripped output log showing the errors:

[core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
[core] "Error returned from daemon: Error Domain=com.apple.accounts Code=9 "(null)""
SSAccountStore: Failed to fetch the backing accounts. error = Error Domain=com.apple.accounts Code=9 "(null)"
SSAccountStore: Unable to get the local account. error = Error Domain=SSErrorDomain Code=100 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store}
Error getting SKCloudServiceController capabilities: Error Domain=SKErrorDomain Code=6 "The requesting app does not have the necessary permissions" UserInfo={NSLocalizedDescription=The requesting app does not have the necessary permissions}
warning: could not execute support code to read Objective-C class data in the process. This may reduce the quality of type information available.
(lldb) 

Thanks for any help on this :)

P.S. I did remember to add StoreKit capabilities to my project and imported its header file in the .m file where I run my code from.

来源:https://stackoverflow.com/questions/53853478/error-using-skcloudservicecontroller-api-to-check-apple-music-capabilities

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!