【问题标题】:Add IOS capability programmatically in Cordova plugin在 Cordova 插件中以编程方式添加 IOS 功能
【发布时间】:2016-09-05 06:29:33
【问题描述】:

我为 Cordova IOS 开发了一个插件,用于使用 App Groups。

插件需要在XCodeTargets->Capabilities下激活App Groups Capability,并选择App Groups之一。

如果我手动激活它,它工作得很好,但我想以编程方式激活它,在plugin.xml 中很好,或者使用自定义挂钩。

有人做到了吗?

【问题讨论】:

  • 我认为您可以使用钩子将其存档,您需要在解决方案之前添加/编辑 Entitlement.plist 文件,其中包含 AppGroup 功能(如 xcode8 上的推送功能)。自 cordova-ios 4.3.0 起支持并自动生成 entitlement.plist。 issues.apache.org/jira/browse/CB-11854

标签: ios node.js xcode cordova cordova-plugins


【解决方案1】:

将以下内容添加到plugin.xml 文件中,然后删除并重新安装插件。该功能仍需要添加到配置文件中,但如果您使用 GUI 构建或使用带有 cordova build ios/xcodebuild-allowProvisioningUpdates 标志,Xcode 应该会自动解决该问题。

<platform name="ios">
    <config-file target="*.entitlements"
            parent="com.apple.security.application-groups">
            <array><string>group.com.example</string></array>
    </config-file>
    <config-file target="**/Entitlements-Debug.plist"
            parent="com.apple.security.application-groups">
            <array><string>group.com.example</string></array>
    </config-file>
    <config-file target="**/Entitlements-Release.plist"
            parent="com.apple.security.application-groups">
            <array><string>group.com.example</string></array>
    </config-file>
</platform>

【讨论】:

  • 3年后:D
  • @Del 如果对您有用,请随时将其标记为正确!
  • 嗨@noodleofdeath,因为我不记得我为什么需要它或我打算在哪里使用它,我不能说这是否正确。如果有人现在需要这个并且 cets 是正确的,我会批准下一个人。
  • @del 原来这个要求对于我上个月刚刚分配的项目来说是必要的
  • @Víctor 这是正确的,确认工作。 Xcode 还处理自动配置。我们被飞行意大利面怪物的优雅所感动。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-17
  • 2017-10-17
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多