现象:连接电脑可以正常启动程序,不连接电脑启动程序就崩溃。

崩溃信息:

BSXPCMessage received error for message: Connection invalid

HW kbd: Failed to set (null) as keyboard focus

UNNotificationRegistrarConnectionListener connection invalidated

UNNotificationSchedulerConnectionListener connection invalidated

com.apple.xpc.launchd[1] (UIKitApplication:com.wuba.zhuanzhuan[0x58ac][1073]) <Notice>: Service exited due to signal: Segmentation fault: 11

这种崩溃信息比较浪,导致这种崩溃的可能性比较多,最终定位问题是程序中用了一个c的方法 strcmp,原因是向这个方法中传递的参数中有nil,所以导致崩溃。