【问题标题】:UrbanAirShip integrated in my project. its not working well in Swift3UrbanAirShip 集成在我的项目中。它在 Swift3 中运行不佳
【发布时间】:2017-07-07 15:16:47
【问题描述】:

我创建了一个新的urbanairship 帐户,并遵循了their link 中所述的所有文档,但是当我按照他们提到的那样设置AppDelegate 部分时:

func application(_ application: UIApplication,
                 didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    let config = UAConfig.default();
    UAirship.takeOff(config);
    UAirship.push().defaultPresentationOptions = [.alert, .badge, .sound]
    UAirship.push().userPushNotificationsEnabled = true;
    return true;
}

我的代码在UAirship.push().defaultPresentationOptions = [.alert, .badge, .sound] 上崩溃说:fatal error: unexpectedly found nil while unwrapping an Optional value.

我调试并发现UAirship.push() 导致为零。

另请注意,我已按照同一页面上的要求创建了 AirshipConfig.pList 文件,并且我粘贴了以下内容:

<plist version="1.0">
<dict>
    <key>developmentAppKey</key>
    <string>Your Development App Key</string>
    <key>developmentAppSecret</key>
    <string>Your Development App Secret</string>
    <key>productionAppKey</key>
    <string>Your Production App Key</string>
    <key>productionAppSecret</key>
    <string>Your Production App Secret</string>
    <key>useWKWebView</key>
    <true/>
</dict>

谁能告诉我我在这里做错了什么?

【问题讨论】:

  • 您是否已将Your Development App ... 占位符文本替换为您的实际应用程序密钥和秘密? (不要在此处粘贴它们 - 只需确认)
  • 感谢回复,没有,我真的不知道从哪里得到,请告诉我。
  • 你关注这里的所有内容了吗:docs.urbanairship.com/engage/getting-started 并且你下载了他们的示例 iOS Swift 应用程序吗?
  • 如果 UAirship 单例设置不正确,它将为零。遵循@DonMag 的建议,您应该一切顺利。
  • 注意:Airship 的入职流程存在 UX 错误(截至 2019 年 5 月 16 日)。在完成“入门”教程之前,您可以查看应用程序密钥和秘密,但您需要这些才能成功发送推送通知,这是最后一步。要解决这个问题,只需点击发送按钮并单击“我收到通知”复选框。然后,您将能够访问仪表板,您可以在其中查看设置>API 和集成 中的键

标签: ios swift3 apple-push-notifications urbanairship.com


【解决方案1】:

useWKWebView 好像早就失效了:

2018-12-11 15:32:10.228876+0300 V4 P97 开发[4468:2691527] [D] -[UAConfig setValue:forUndefinedKey:] [第 404 行] 忽略无效的 UAConfig 键:useWKWebView

可能默认情况下它是打开的,虽然你不能通过字体的大小来判断 里面WKWebView ;^)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多