1

我正在使用此代码尝试检查设备 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) 

感谢您对此的任何帮助:)

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

4

0 回答 0