【问题标题】:Editing the Entitlements.plist file using config.xml in Phonegap Build在 Phonegap Build 中使用 config.xml 编辑 Entitlements.plist 文件
【发布时间】:2017-04-20 18:58:42
【问题描述】:

我正在尝试通过 Phonegap 构建使用 Apple Pay cordova 插件。这是我在配置文件中的条目:

     <plugin name="cordova-plugin-applepay-stripe" source="npm">
<param name="STRIPE_TEST_PUBLISHABLE_KEY" value="xxxxxxxx" />
<param name="STRIPE_LIVE_PUBLISHABLE_KEY" value="xxxxxxxxx" />
<param name="APPLE_MERCHANT_IDENTIFIER" value="merchant.etc.etc" />
</plugin>

插件安装正确,但无法正常工作,因为我在使用 PC 时没有在 Xcode 中启用 Apply Pay 权利。

我知道您可以像我在这里所做的那样直接从 phonegap build config.xml 文件中编辑 plist 文件:

<gap:config-file platform="ios" parent="NSPhotoLibraryUsageDescription" overwrite="true">
<string>We are using the Photo Library for PayPal</string>...

所以我的问题是我到底该如何编辑 Entitlements.plist 文件以便我可以启用 ApplePay 并添加我的商家 ID?!

我尝试了以下方法:

  <config-file platform="ios" target="*-Entitlements.plist" parent="com.apple.developer.in-app-payments">  
        <array>
            <string>merchant.etc.etc/string>
        </array>
</config-file>  

但这并没有奏效。任何帮助,将不胜感激!

【问题讨论】:

  • 您使用的是哪个 CLI 版本?并非所有版本都有 Entitlements.plist 文件。另外,添加overwrite="true" 部分
  • 也在尝试解决这个问题——想知道你是否取得了任何进展

标签: cordova plist phonegap-build entitlements phonegap


【解决方案1】:

似乎config-file 出于某种原因只能在插件中使用。它似乎应该在您的项目config.xml 中工作,但不幸的是它没有。但是,您可以使用本地插件来管理您的权利,以达到或多或少相同的效果。

例如,src/local-plugins/app-entitlements

将此添加到您的config.xml

<plugin name="app-entitlements" spec="src/local-plugins/app-entitlements" />

您只需要src/local-plugins/app-entitlements/plugin.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<plugin id="app-entitlements" version="0.0.0" xmlns="http://apache.org/cordova/ns/plugins/1.0">
  <name>AppEntitlements</name>
  <platform name="ios">
    <config-file target="*-Debug.plist" parent="com.apple.developer.in-app-payments">
      <array>
        <string>YOUR DEBUG MERCHANT ID HERE</string>
      </array>
    </config-file>
    <config-file target="*-Release.plist" parent="com.apple.developer.in-app-payments">
      <array>
        <string>YOUR RELEASE MERCHANT ID HERE</string>
      </array>
    </config-file>
  </platform>
</plugin>

您当然可以在此处设置其他权利,例如推送通知或您想要的任何内容。

现在,当您创建一个新的 cordova platform add ios 时,它应该使用这些键创建 Entitlements-*.plist,您应该可以开始了。

请记住,Xcode 中的“功能”选项卡是单独处理的,只是一个 GUI 助手。它不会反映这些文件的权利。

【讨论】:

    猜你喜欢
    • 2014-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-09
    • 2017-03-12
    • 2016-11-18
    • 2013-11-19
    相关资源
    最近更新 更多