【问题标题】:iCloud uses a different container on watchOS 3iCloud 在 watchOS 3 上使用不同的容器
【发布时间】:2017-03-13 19:06:26
【问题描述】:

我正在尝试让 iCloud 在 iPhone 和 Apple Watch 之间工作(在 watchOS 3 上使用 CloudKit)。我已将 Watch Extension 中的云容器指定为与 iOS 目标中的相同,但是在运行应用程序时,我从我所做的查询中收到此错误:

Failure retrieving: Optional(<CKError 0x17d45cf0: "Unknown Item" (11/2003); server message = "did not find record type recordTypeId="Recommendation""; uuid = 37D53C78-FF19-4CE3-80BD-C1990F0135A2; container ID = "iCloud.mathsrobot.MathsRobot-LearnMaths.watchkitapp.watchkitextension">)

从容器 ID 可以看出,它没有使用 iOS 应用容器,应该是 iCloud.mathsrobot.MathsRobot-LearnMaths。如何让它使用 iOS 应用的 iCloud 容器?

iOS 目标功能截图 Main iOS target capabilities with iCloud

观看目标功能截图 Watch Extension target capabilities with iCloud

【问题讨论】:

    标签: ios iphone xcode cloudkit watchos-3


    【解决方案1】:

    您很可能在代码中使用了默认容器...

    container = CKContainer.default()
    

    这将默认为 watchOS 应用的容器 ID,即使您在 Xcode 中设置它也是如此。你应该尝试做这样的事情......

    container = CKContainer(identifier: "iCloud.mathsrobot.MathsRobot-LearnMaths")
    

    【讨论】:

      猜你喜欢
      • 2020-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-03
      • 2014-12-27
      相关资源
      最近更新 更多