iOS应用程序不断为审阅者崩溃,但在现场测试中工作正常

时间:2015-05-27 21:48:37

标签: 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")
                })
            }
        }
    }
}

非常感谢任何帮助。

提前谢谢!

1 个答案:

答案 0 :(得分:1)

SIGTRAP可能意味着抛出异常。

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

因此我建议修复是在创建过程中将timeTableName清理为仅限URL安全的字符。