iOS 应用程序不断崩溃,但在现场测试中运行良好

标签 ios swift appstore-approval

我的 iOS 应用程序在 iOS 审查团队中不断崩溃,但在所有类型的试飞设备上运行良好 (~10)。我无法重现该问题。

审阅团队发给我的崩溃日志状态

Incident Identifier: 6686BE5C-DCC1-48C1-9AC2-FCFF85F3EBC2
...
Version:             4 (2.1)
Code Type:           ARM-64 (Native)
...
Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0000000000000001, 0x000000010012e218
Triggered by Thread:  5
...

Thread 5 name:  Dispatch queue: com.apple.root.default-qos
Thread 5 Crashed:
0   Alamofire                       0x000000010012e218 Alamofire.request (Alamofire.Method, Alamofire.URLStringConvertible, parameters : [Swift.String : Swift.AnyObject]?, encoding : Alamofire.ParameterEncoding) -> Alamofire.Request (Alamofire.swift:1522)
1   Alamofire                       0x000000010012e058 Alamofire.request (Alamofire.Method, Alamofire.URLStringConvertible, parameters : [Swift.String : Swift.AnyObject]?, encoding : Alamofire.ParameterEncoding) -> Alamofire.Request (Alamofire.swift:1522)
2   Stundenplan                     0x000000010009d4c4 function signature specialization <Arg[0] = Owned To Guaranteed> of Stundenplan.TimeTableManager.loadRemote (Stundenplan.TimeTableManager)() -> () (TimeTableManager.swift:103)
3   Stundenplan                     0x000000010009e434 Stundenplan.TimeTableManager.(reload (Stundenplan.TimeTableManager) -> () -> ()).(closure #1) (TimeTableManager.swift:58)
4   libdispatch.dylib               0x0000000197b29990 _dispatch_call_block_and_release + 20
5   libdispatch.dylib               0x0000000197b29950 _dispatch_client_callout + 12
6   libdispatch.dylib               0x0000000197b3677c _dispatch_root_queue_drain + 1844
7   libdispatch.dylib               0x0000000197b37c48 _dispatch_worker_thread3 + 104
8   libsystem_pthread.dylib         0x0000000197d09228 _pthread_wqthread + 812
9   libsystem_pthread.dylib         0x0000000197d08eec start_wqthread + 0

这似乎指向 Alamofire,但我还没有找到任何与此接近的报告。

我仔细检查了我的代码是否有任何可能出错的地方,但我仍然不知道为什么它总是崩溃。

func loadRemote() {
    if let timeTableName = NSUserDefaults.standardUserDefaults().stringForKey("timeTable") {
        // Prevent server flooding
        if let lastUpdate = lastUpdate where lastCourse == timeTableName {
            if NSDate.minutesBetween(date1: lastUpdate, date2: NSDate()) < 5 {
                return ;
            }
        }

        lastUpdate = NSDate()
        lastCourse = timeTableName

        let icalLink = "http://****/ical/\(timeTableName).ics"
        UIApplication.sharedApplication().networkActivityIndicatorVisible = true
        Alamofire.request(.GET, icalLink).responseString { (_, _, data, err) in
            UIApplication.sharedApplication().networkActivityIndicatorVisible = false
            if(err != nil) {
                PiwikTracker.sharedInstance().sendExceptionWithDescription("Server unreachable.", isFatal: true)
            } else {
                if let cache = NSUserDefaults.standardUserDefaults().stringForKey("icsCache") {
                    if data == cache {
                        return
                    }
                }
                TimeTable(icalString: data!, success: { (timeTable) in
                    self.currentData = timeTable
                    NSUserDefaults.standardUserDefaults().setValue(data, forKey: "icsCache")
                    }, error: {
                        println("error parsing timetable")
                })
            }
        }
    }
}

非常感谢任何帮助。

提前致谢!

最佳答案

SIGTRAP 可能意味着抛出了异常。

我可以找到 at least one instance in which AlamoFire could raise an exception .那是去年十月修好的。虽然您可能没有更新 AlamoFire 的副本,但我认为 URL 线索中的无效字符可能会有所帮助,因为您是通过直接粘贴用户默认值的字符串来形成 URL。

因此,我建议修复方法是在创建期间将 timeTableName 清理为仅 URL 安全字符。

关于iOS 应用程序不断崩溃,但在现场测试中运行良好,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30493743/

相关文章:

ios - iOS 上的 Phonegap 插件不调用 native 代码

Flutter Appstore 拒绝包含混淆代码或选择器修改

iOS 应用程序因 Flurry 发送 Mac 地址而被拒绝?

objective-c - 帮助我理解堆栈跟踪

ios - AVAudioRecorder后台录音,如何在红条上显示时间?

iphone - Insert 语句不检查重复值

ios - 我可以通过删除旧应用程序来发布具有旧包标识符的新应用程序吗?

swift - 为什么我不能在 if 子句中使用这个 bool 表达式?

swift - “ fatal error :在展开可选值时意外发现nil”是什么意思?

linux - 在 Ubuntu Linux 的 Swift 3 中将字符串写入文件