App crashing when launching from AppStore or TestFlight but working fine elseways

 ̄綄美尐妖づ 提交于 2019-12-04 08:22:50

I found the solution of my problem.

As expected it was coming from func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool

Inside the function I had let userInfo = launchOpts[UIApplicationLaunchOptionsRemoteNotificationKey] as! NSDictionary.

I changed it to let userInfo = launchOpts[UIApplicationLaunchOptionsRemoteNotificationKey] as? NSDictionary and then checked if userInfo != nil to make all the code running userInfointo the bracket.

If it helps anyone or if anyone is struggling with this issue, check all yours ! and swap these to ? if needed (on didFinishLaunchingWithOptions) since launching from TestFlight/AppStore seems to have different options than from installed application (just a guess, not pro enough to claim it).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!