使用SKCloudServiceController API检查Apple Music功能时出错

时间:2018-12-19 14:37:22

标签: ios objective-c iphone apple-music apple-musickit

我正在使用此代码尝试检查设备的Apple Music功能:

  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!!!!");
    }
  }];

很遗憾,我无法追踪如何解决我收到的错误。

我认为SKCloudServiceController正在本地查找设备功能,因此无需连接到Apple即可确定

那么为什么错误使我相信SKCloudServiceController在连接到Apple时出现某种通讯问题?

以下是显示错误的时间剥离输出日志:

[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) 

谢谢您的帮助:)

P.S。我确实记得要在项目中添加StoreKit功能,并将其头文件导入运行我的代码的.m文件中。

0 个答案:

没有答案