Maz
Maz

Reputation: 255

UrbanAirShip integrated in my project. its not working well in Swift3

I created a new urbanairship account and i followed all the documentation stated on their link but when i setup the AppDelegate part as they mentioned:

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;
}

my code crashes on UAirship.push().defaultPresentationOptions = [.alert, .badge, .sound] saying: fatal error: unexpectedly found nil while unwrapping an Optional value.

I debugged and found out that UAirship.push() is resulting in a nil.

Also note that i have created the AirshipConfig.pList file as requested on the same page and i have pasted the following:

<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>

Can somebody tell me what im doing wrong here?

Upvotes: 3

Views: 494

Answers (1)

Anton Tropashko
Anton Tropashko

Reputation: 5816

useWKWebView seems to be long invalid:

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

probably it's on by default though you can't tell by the size of the font inside that WKWebView ;^)

Upvotes: 1

Related Questions