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?
Comments
3 comments