iOS 应用程序不断崩溃以供审核,但在现场测试中运行良好
iOS App keeps crashing for reviewer, but works fine in field tests
我的 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 应用程序在 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 安全字符。