我们有几个iOS用户的应用程序在更新内部通信用户时崩溃。所有的都有iOS10.3.2。
这就是我们如何在注册后更新用户的对讲机
registerIntercomUser(userNo: self.gbl.getUserNo())
_ = dispatch_after(1) {
updateIntercomUser(userObj: userObj!, userNo:self.gbl.getUserNo())
}
下面是我们的日志
Crashed: com.apple.main-thread
0 Evolution 0x100061b84 specialized updateIntercomUser(userObj : User, userNo : Int) -> () (IntercomLogger.swift:1543)
1 Evolution 0x1000d97e4 partial apply for ViewController.(checkLogin() -> ()).(closure #1) (ViewController.swift)
2 Evolution 0x100148b28 partial apply for (dispatch_after(Double, queue : DispatchQueue, closure : () -> ()) -> () -> ()?).(closure #2) (Util.swift)
3 libdispatch.dylib 0x190fce9a0 _dispatch_client_callout + 16
4 libdispatch.dylib 0x190fdb604 _dispatch_continuation_pop + 448
5 libdispatch.dylib 0x190fe7c1c _dispatch_source_latch_and_call + 204
6 libdispatch.dylib 0x190fd08a0 _dispatch_source_invoke + 804
7 libdispatch.dylib 0x190fd34a0 _dispatch_main_queue_callback_4CF + 668
8 CoreFoundation 0x1920c50c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
9 CoreFoundation 0x1920c2ce4 __CFRunLoopRun + 1572
10 CoreFoundation 0x191ff2da4 CFRunLoopRunSpecific + 424
11 GraphicsServices 0x193a5c074 GSEventRunModal + 100
12 UIKit 0x1982ad058 UIApplicationMain + 208
13 Evolution 0x10005ea28 main (IntercomLogger.swift:17)
14 libdyld.dylib 0x19100159c start + 4
请帮助我找到问题。
最佳答案
崩溃是由于在主线程上调用内部通信的updateuser方法所致。把所有的调用放在后台线程上修复了崩溃。