将 Fastlane 用于推送通知服务? (在这种情况下,Wonderpush iOS)

Posted

技术标签:

【中文标题】将 Fastlane 用于推送通知服务? (在这种情况下,Wonderpush iOS)【英文标题】:Using Fastlane for Push Notification services? (Wonderpush iOS, in this instance) 【发布时间】:2020-08-11 14:18:33 【问题描述】:

我有一个使用 Fastlane 成功构建的 Cordova 应用程序(使用“match”和“fastlane-plugin-cordova”),我正在尝试向它添加推送通知 - 具体来说,我正在使用 Wonderpush 并尝试最初在 ios 上运行,但我相信我的问题可能适用于任何使用通知服务扩展的推送通知服务。

我已经添加了 wonderpush-cordova-sdk Cordova 插件,如果我通过 Xcode 手动构建应用程序,它构建得很好。

但是,如果我尝试通过 Fastlane 构建它,我会收到错误消息:

error: Provisioning profile "match AppStore uk.co.mycompany.my-app" has app ID "uk.co.mycompany.my-app", which does not match the bundle ID "uk.co.mycompany.my-app.WonderPushNotificationServiceExtension". (in target 'WonderPushNotificationServiceExtension' from project 'My App')

(如果有用,请在下面完整跟踪)

问题似乎是我需要正确配置配置文件/证书/匹配,但我一直在查看 Fastlane 文档,并且通常在 SO/Google 上进行搜索,但到目前为止我无法找到任何示例可以关注正常工作的人。

我尝试从链接中挑选出部分解决方案,例如 https://github.com/fastlane/fastlane/issues/12826 和 https://github.com/fastlane/fastlane/issues/8563,但到目前为止还没有找到可以让我使用的配置行组合。

我的 Fastfile 相当简单:

    desc "Ship to Testflight"
    lane :beta do
        setup_project
        changelog_from_git_commits
        match(type: 'appstore')

        cordova(
            platform: 'ios',
        )

        upload_to_testflight(
            ipa: ENV['CORDOVA_IOS_RELEASE_BUILD_PATH'],
        )
    end

正如我所说,当我使用 Wonderpush 时,我假设您在尝试实施任何添加需要以这种方式签名的扩展的推送通知服务时会遇到同样的问题?

非常感谢任何有关如何进行的建议或指示!


完整的错误日志以防万一:

[15:01:17]: Exit status of command 'npx --no-install cordova compile ios --release --device --packageType=app-store --developmentTeam=XXXXXXX --provisioningProfile=xxxxxxxxxxxxxxxxxxxx -- ' was 65 instead of 0.
Building project: /Users/me/Sites/project/src-cordova/platforms/ios/My App.xcworkspace
    Configuration: Release
    Platform: device
    Target:
Running command: xcodebuild -workspace My App.xcworkspace -scheme My App -configuration Release -destination generic/platform=iOS -archivePath My App.xcarchive archive CONFIGURATION_BUILD_DIR=/Users/me/Sites/project/src-cordova/platforms/ios/build/device SHARED_PRECOMPS_DIR=/Users/me/Sites/project/src-cordova/platforms/ios/build/sharedpch
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace "My App.xcworkspace" -scheme "My App" -configuration Release -destination generic/platform=iOS -archivePath "My App.xcarchive" archive CONFIGURATION_BUILD_DIR=/Users/me/Sites/project/src-cordova/platforms/ios/build/device SHARED_PRECOMPS_DIR=/Users/me/Sites/project/src-cordova/platforms/ios/build/sharedpch

User defaults from command line:
    IDEArchivePathOverride = /Users/me/Sites/project/src-cordova/platforms/ios/My App.xcarchive

Build settings from command line:
    CONFIGURATION_BUILD_DIR = /Users/me/Sites/project/src-cordova/platforms/ios/build/device
    SHARED_PRECOMPS_DIR = /Users/me/Sites/project/src-cordova/platforms/ios/build/sharedpch

note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: Provisioning profile "match AppStore uk.co.mycompany.my-app" has app ID "uk.co.mycompany.my-app", which does not match the bundle ID "uk.co.mycompany.my-app.WonderPushNotificationServiceExtension". (in target 'WonderPushNotificationServiceExtension' from project 'My App')

** ARCHIVE FAILED **

xcodebuild: Command failed with exit code 65


+------+----------------------------------+-------------+
|                   fastlane summary                    |
+------+----------------------------------+-------------+
| Step | Action                           | Time (in s) |
+------+----------------------------------+-------------+
| 1    | default_platform                 | 0           |
| 2    | Switch to ios setup_project lane | 0           |
| 3    | is_ci                            | 0           |
| 4    | changelog_from_git_commits       | 0           |
| 5    | is_ci                            | 0           |
| 6    | is_ci                            | 0           |
| 7    | is_ci                            | 0           |
| 8    | match                            | 5           |
| 9    | produce                          | 1           |
| 10   | is_ci                            | 0           |
| 11   | is_ci                            | 0           |
| 12   | is_ci                            | 0           |
| 13   | match                            | 5           |
| ????   | cordova                          | 6           |
+------+----------------------------------+-------------+

[15:01:17]: fastlane finished with errors

Looking for related GitHub issues on fastlane/fastlane...

Traceback (most recent call last):
    33: from /Users/me/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:24:in `<main>'
    32: from /Users/me/.rvm/gems/ruby-2.7.1/bin/ruby_executable_hooks:24:in `eval'
    31: from /Users/me/.rvm/gems/ruby-2.7.1/bin/fastlane:23:in `<main>'
    30: from /Users/me/.rvm/gems/ruby-2.7.1/bin/fastlane:23:in `load'
    29: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/bin/fastlane:23:in `<top (required)>'
    28: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/cli_tools_distributor.rb:119:in `take_off'
    27: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/commands_generator.rb:41:in `start'
    26: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/commands_generator.rb:352:in `run'
    25: from /Users/me/.rvm/gems/ruby-2.7.1/gems/commander-fastlane-4.4.6/lib/commander/delegates.rb:15:in `run!'
    24: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb:76:in `run!'
    23: from /Users/me/.rvm/gems/ruby-2.7.1/gems/commander-fastlane-4.4.6/lib/commander/runner.rb:476:in `run_active_command'
    22: from /Users/me/.rvm/gems/ruby-2.7.1/gems/commander-fastlane-4.4.6/lib/commander/command.rb:153:in `run'
    21: from /Users/me/.rvm/gems/ruby-2.7.1/gems/commander-fastlane-4.4.6/lib/commander/command.rb:178:in `call'
    20: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/commands_generator.rb:108:in `block (2 levels) in run'
    19: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/command_line_handler.rb:36:in `handle'
    18: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/lane_manager.rb:47:in `cruise_lane'
    17: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/runner.rb:45:in `execute'
    16: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/runner.rb:45:in `chdir'
    15: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/runner.rb:49:in `block in execute'
    14: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/lane.rb:33:in `call'
    13: from Fastfile:97:in `block (2 levels) in parsing_binding'
    12: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/fast_file.rb:159:in `method_missing'
    11: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/runner.rb:157:in `trigger_action_by_name'
    10: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/runner.rb:229:in `execute_action'
     9: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/runner.rb:229:in `chdir'
     8: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/runner.rb:255:in `block in execute_action'
     7: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/actions/actions_helper.rb:50:in `execute_action'
     6: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/runner.rb:263:in `block (2 levels) in execute_action'
     5: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-plugin-cordova-3.0.0/lib/fastlane/plugin/cordova/actions/cordova_action.rb:129:in `run'
     4: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-plugin-cordova-3.0.0/lib/fastlane/plugin/cordova/actions/cordova_action.rb:116:in `build'
     3: from /Users/me/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/forwardable.rb:235:in `sh'
     2: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane/lib/fastlane/helper/sh_helper.rb:80:in `sh_control_output'
     1: from /Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane_core/lib/fastlane_core/ui/ui.rb:17:in `method_missing'
/Users/me/.rvm/gems/ruby-2.7.1/gems/fastlane-2.155.3/fastlane_core/lib/fastlane_core/ui/interface.rb:153:in `shell_error!': \e[31m[!] Exit status of command 'npx --no-install cordova compile ios --release --device --packageType=app-store --developmentTeam=XXXXXXX --provisioningProfile=xxxxxxxxxxxxxxxxxxxx -- ' was 65 instead of 0. (FastlaneCore::Interface::FastlaneShellError)
Building project: /Users/me/Sites/project/src-cordova/platforms/ios/My App.xcworkspace
    Configuration: Release
    Platform: device
    Target:
Running command: xcodebuild -workspace My App.xcworkspace -scheme My App -configuration Release -destination generic/platform=iOS -archivePath My App.xcarchive archive CONFIGURATION_BUILD_DIR=/Users/me/Sites/project/src-cordova/platforms/ios/build/device SHARED_PRECOMPS_DIR=/Users/me/Sites/project/src-cordova/platforms/ios/build/sharedpch
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -workspace "My App.xcworkspace" -scheme "My App" -configuration Release -destination generic/platform=iOS -archivePath "My App.xcarchive" archive CONFIGURATION_BUILD_DIR=/Users/me/Sites/project/src-cordova/platforms/ios/build/device SHARED_PRECOMPS_DIR=/Users/me/Sites/project/src-cordova/platforms/ios/build/sharedpch

User defaults from command line:
    IDEArchivePathOverride = /Users/me/Sites/project/src-cordova/platforms/ios/My App.xcarchive

Build settings from command line:
    CONFIGURATION_BUILD_DIR = /Users/me/Sites/project/src-cordova/platforms/ios/build/device
    SHARED_PRECOMPS_DIR = /Users/me/Sites/project/src-cordova/platforms/ios/build/sharedpch

note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
error: Provisioning profile "match AppStore uk.co.mycompany.my-app" has app ID "uk.co.mycompany.my-app", which does not match the bundle ID "uk.co.mycompany.my-app.WonderPushNotificationServiceExtension". (in target 'WonderPushNotificationServiceExtension' from project 'My App')

** ARCHIVE FAILED **

xcodebuild: Command failed with exit code 65

【问题讨论】:

你解决了吗?我也收到了。 【参考方案1】:

嘿嘿,

我不知道你是否在此期间解决了这个问题,但我记得我们在处理 OneSignal Push 集成时曾经遇到过类似的问题。

您需要确保您不仅为应用本身调用 match,还为该服务扩展调用 match,如下所示:

ext_identifier = app_id + ".OneSignalNotificationServiceExtension"
match(
      app_identifier: [app_id, ext_identifier],
      type: "appstore",
      git_branch: gitBranch
)

我们最终没有使用该 ServiceExtension,因此在我们的场景中再次将其删除 - 但我希望它有所帮助。

安妮

【讨论】:

以上是关于将 Fastlane 用于推送通知服务? (在这种情况下,Wonderpush iOS)的主要内容,如果未能解决你的问题,请参考以下文章

Ionic/cordova:如何使用 fastlane 或 xcodebuild 添加推送功能?

将 javapns 用于推送通知提供程序/服务器

更改为另一个苹果帐户后不会收到任何推送通知

在这种情况下推送通知服务的可用性?

将 BroadcastReceiver 用于推送通知时不会被调用

在 Unity 中更改服务器端解析通知的推送通知图标