My App uses MQTT Client, but NSStream Input crashes, I don't know why. Can you tell me how to solve this problem? Attached is my full crash log:
Consider the backtrace of your crashing thread:
Thread 0 name:
Thread 0 Crashed:
0 libsystem_kernel.dylib … mach_msg_trap + 8
1 libsystem_kernel.dylib … mach_msg + 76 (mach_msg.c:119)
2 CoreFoundation … __CFRunLoopServiceMachPort + 372 (CFRunLoop.c:2646)
3 CoreFoundation … __CFRunLoopRun + 1212 (CFRunLoop.c:3000)
4 CoreFoundation … CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
5 CFNetwork … SocketStream::read(__CFReadStream*, unsigned char*, long, CFStreamError*, unsigned char*) …
6 CoreFoundation … CFReadStreamRead + 456 (CFStream.c:1112)
7 Luxy … -[MQTTCFSocketDecoder stream:handleEvent:] + 252 (MQTTCFSocketDecoder.m:59)
8 Luxy … 0x100bf4000 + 10155572
9 CoreFoundation … _signalEventSync + 216 (CFStream.c:626)
Your code (frame 7) has called CFReadStreamRead
(frame 6) which has then blocked in the run loop (frame 3). CFReadStreamRead
only blocks this way if you’ve set the stream up to run synchronously. Synchronous networking on the main thread isn’t safe on iOS because, if something goes wrong with the network, you end up being killed by the watchdog.
ps Normally a watchdog termination includes the 0x8badf00d event code, but there’s recently been a problem where our crash reporting infrastructure has failed to include those custom codes.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"