【问题标题】:Ionic v1 auto turn on push notifications capabilitiesIonic v1 自动开启推送通知功能
【发布时间】:2018-06-12 09:12:51
【问题描述】:

我有一个将应用程序直接上传到 AppStore 的脚本。问题是推送通知功能没有自动开启。

我正在使用: cli 包:(/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

全局包:

cordova (Cordova CLI) : 7.0.1

本地包:

Cordova Platforms : ios 4.4.0
Ionic Framework   : ionic1 1.3.1

系统:

ios-deploy : 1.9.1
Node       : v6.11.0
npm        : 3.10.10
OS         : macOS High Sierra
Xcode      : Xcode 9.2 Build version 9C40b

还有 phonegap-plugin-push 1.10.5 插件。

知道如何自动打开它吗?

提前致谢!

【问题讨论】:

  • 你为什么不发布你的脚本代码?我猜它可能会有所帮助。

标签: cordova ionic-framework push-notification cordova-plugins


【解决方案1】:

如果您使用 Fastlane 进行交付,您可以在您的 Fastfile 中使用它:

sh "fastlane produce enable_services --push-notification"

否则

我在一个项目中使用了这个 Ruby 脚本。也许它对你有帮助。 记得重命名“name”变量 https://gist.github.com/aitoraznar/87e2c3b458b2d799ae049be5e84d578d

#!/usr/bin/env ruby
require 'xcodeproj'

name = "app_name" // <-Replace with your app name
projectpath = "platforms/ios/" + name + ".xcodeproj"
puts "Adding entitlement push to " + name
puts "Opening " + projectpath
proj = Xcodeproj::Project.open(projectpath)
entitlement_path = name + "/" + name + ".entitlements"

group_name= proj.root_object.main_group.name

file = proj.new_file(entitlement_path)

attributes = {}
proj.targets.each do |target|
    attributes[target.uuid] = {"SystemCapabilities" => {"com.apple.Push" => {"enabled" => 1}}}
    #target.add_file_references([file])
    puts "Added to target: " + target.uuid
end
proj.root_object.attributes['TargetAttributes'] = attributes

proj.build_configurations.each do |config|
    config.build_settings.store("CODE_SIGN_ENTITLEMENTS", entitlement_path)
end
puts "Added entitlements file path: " + entitlement_path

#proj.recreate_user_schemes
proj.save

【讨论】:

    猜你喜欢
    • 2023-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-04
    • 2014-03-06
    • 2016-03-23
    • 1970-01-01
    • 2013-05-30
    相关资源
    最近更新 更多