OGeek|极客世界-中国程序员成长平台

标题: ios - UrbanAirShip 集成在我的项目中。它在 Swift3 中运行不佳 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 18:12
标题: ios - UrbanAirShip 集成在我的项目中。它在 Swift3 中运行不佳

我创建了一个新的 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 :在展开可选值时意外发现 nil。

我调试并发现 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>

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



Best Answer-推荐答案


useWKWebView 好像早就失效了:

2018-12-11 15:32:10.228876+0300 V4 P97 Dev[4468:2691527] [D] -[UAConfig setValue:forUndefinedKey:] [Line 404] Ignoring invalid UAConfig key: useWKWebView

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

关于ios - UrbanAirShip 集成在我的项目中。它在 Swift3 中运行不佳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44974325/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4