2. 1 PERFORMANCE: APP COMPLETENESS Performance

来源:互联网 发布:sql沉思录 编辑:程序博客网 时间:2024/06/14 18:00

2. 1 PERFORMANCE: APP COMPLETENESS
Performance - 2.1
We were unable to review your app as it crashed on launch. We have attached detailed crash logs to help troubleshoot this issue.

情况不一,仅仅说下自己的情况。

提交审核连续被苹果拒绝,日志提示打开App即闪退,自己测试无法复现,思索良久,使用TestFlight测试找到问题才复现。


先说现象:通过TestFlight点击open打开app闪退,点击图标打开不闪退!

应设计要求需要处理推送数据,然而通过TestFlight进入,didFinishLaunchingWithOptions会带参(launchOptions不为空),若该函数中有对该参数进行解析,并且不严谨会导致程序crash!

错误写法:

if launchOptions !=nil {

            launchOptions

             let userInfo = launchOptions!["UIApplicationLaunchOptionsRemoteNotificationKey"]as! NSDictionary

            let isShow =self.parsePushData(userInfo)

            if !isShow {

                popFeedBack()

            }

        }else {

            popFeedBack()

        }


正确写法:

if launchOptions !=nil {

            if launchOptions!.keys.contains("UIApplicationLaunchOptionsRemoteNotificationKey") {

                let userInfo = launchOptions!["UIApplicationLaunchOptionsRemoteNotificationKey"]as! NSDictionary

                let isShow =self.parsePushData(userInfo)

                if isShow {

                    popFeedBack()

                    returntrue

                }

            }

        }

此例仅针对本人应用!


0 0