2

我正在尝试在 Visual Studio 2013(Mac 上的 Xcode 7.2.1)中为我的 Xamarin.iOS(v4.0.30319)应用程序包含 iCloud 键值存储支持,但不断得到:

错误 MT1019:您的应用程序具有当前配置文件不支持的权利,并且无法安装在设备“我的 iPhone 4”上。请查看 iOS 设备日志以获取更多详细信息(错误:0xe8008016)。

顺便说一句,设备上没有日志,至少 xCode 不会显示任何日志。

我在 Xcode 中有另一个用本机目标 C 编写的应用程序,它也支持 iCloud,而且工作正常。所以我做了同样的事情:

  1. 在 developer.apple.com 上创建了名为“iCloud.[my team id].[my bundle id]”的 iCloud 容器(我使用了准确的值,没有宏)
  2. 在 developer.apple.com 上为 [my bundle id] 创建了应用程序 ID,并为容器“iCloud.[my team id].[my bundle id]”启用了 iCloud
  3. 创建了开发配置文件
  4. 在 Xcode 中安装它。
  5. 在“iOS Bundle Signing”中的 Visual Studio 中选择它
  6. 此处编写的已编辑权利:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>com.apple.developer.ubiquity-kvstore-identifier</key>
        <string>iCloud.[my team id].[my bundle id]</string>
        <key>com.apple.developer.ubiquity-container-identifiers</key>
        <array>
            <string>iCloud.[my team id].[my bundle id]</string>
        </array>
    </dict>
    </plist>

之后 Xamarin 不想在设备上安装我的应用程序。我更改了容器的名称,从权利中删除了 com.apple.developer.ubiquity-container-identifiers 并将其返回(始终删除所有配置文件,重新下载到 xcode,重新启动 Visual Studio,清理解决方案,删除设备上的配置文件,卸载现有应用程序)。只有当我从权利中删除 com.apple.developer.ubiquity-kvstore-identifier 和 com.apple.developer.ubiquity-container-identifiers 时,Xamarin 才会将应用程序安装到设备。但显然 NSUbiquitousKeyValueStore 不起作用。我的设置有什么问题?

4

1 回答 1

2

在将 Capabilities-> Cloud 设置为“on”之后,我什至尝试从我的其他 xcode 项目中获取权利。它生成的 plist 只有 com.apple.developer.ubiquity-kvstore-identifier 值和默认值 $(AppIdentifierPrefix)[my bundle id]。

当我几乎准备睡觉时,应用程序启动了!最终权利(没有“iCloud。”前缀,也没有其他键):

<plist version="1.0">
<dict>
    <key>com.apple.developer.ubiquity-kvstore-identifier</key>
    <string>[my team id].*</string>

    <key>com.apple.developer.ubiquity-container-identifiers</key>
    <array>
      <string>iCloud.[my team id].[my bundle id]</string>
    </array>

    <key>com.apple.developer.icloud-container-identifiers</key>
    <array>
      <string>iCloud.[my team id].[my bundle id]</string>
    </array> 

</dict>
</plist>

诀窍是简单地打开 myapp.mobileprovision 文件,看看它有什么建议。

它确实有效,但 NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null) 返回 null 并且 NSFileManager.DefaultManager.UbiquityIdentityToken 也为 null。所以没有办法查看 iCloud 是打开还是关闭:它总是保存数据,甚至显示它(直到重新安装应用程序)。但是,如果 iCloud 在重新安装后数据仍然存在。

更新

重要提示:NSFileManager.DefaultManager.GetUrlForUbiquityContainer(null) 在 DEBUG 中返回 null,adHoc 版本返回有效令牌和路径。

APPLE讨厌开发者!我花了 3 天时间让云工作,都是因为缺乏文档,现有的已经过时了。

于 2016-06-17T18:25:05.733 回答