我目前正在iOS上尝试推送通知。发送类型4的通知时,应用程序运行时应用程序会直接崩溃。如果它没有运行,则推送通知会正确显示,但是当点击通知时,应用程序会在以下例外启动时崩溃:
由于未捕获的异常终止应用' NSInvalidArgumentException',原因:' - [__ NSCFDictionary UTF8String]:无法识别的选择器发送到实例0x17fd5aa0'
从我的iPad完整登录:
Jun 8 15:31:56 iPad-von TCApp[562] <Warning>: Received notification while running: {
aps = {
alert = {
body = "Test Body";
title = "Notification Test";
};
sound = default;
};
}
Jun 8 15:31:56 iPad-von TCApp[562] <Error>: -[__NSCFDictionary UTF8String]: unrecognized selector sent to instance 0x17fd5aa0
Jun 8 15:31:56 iPad-von TCApp[562] <Error>: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFDictionary UTF8String]: unrecognized selector sent to instance 0x17fd5aa0'
*** First throw call stack:
(0x22efb91b 0x22696e17 0x22f012b5 0x22efeee1 0x22e2a238 0x36511 0x38ed3 0x27723e01 0x27712ecb 0x2459ec07 0x2459eab9 0x2459edb9 0x22ebddff 0x22ebd9ed 0x22ebbd5b 0x22e0b229 0x22e0b015 0x243fbac9 0x274dd189 0x4671af 0x894e3 0x1da62b 0x434187 0x4341bf 0x29e58)
Jun 8 15:31:56 iPad-von SpringBoard[47] <Warning>: HW kbd: Failed to set (null) as keyboard focus
Jun 8 15:31:56 iPad-von com.apple.xpc.launchd[1] (UIKitApplication:de.mypackage.in.TCAppcn1[0x812c][562]) <Notice>: Service exited due to signal: Abort trap: 6
Jun 8 15:31:56 iPad-von SpringBoard[47] <Warning>: Application 'UIKitApplication:de.mypackage.in.TCAppcn1[0x812c]' crashed.
Jun 8 15:31:56 iPad-von UserEventAgent[23] <Warning>: 1764032310646: id=de.mypackage.in.TCAppcn1 pid=562, state=0
Jun 8 15:31:56 iPad-von ReportCrash[564] <Error>: assertion failed: 13F69: libsystem_trace.dylib + 15927 [FCFC8D6B-F8E1-3577-84A7-8A591C88D819]: 0x0
Jun 8 15:31:56 iPad-von Unknown[564] <Error>:
Jun 8 15:31:56 iPad-von ReportCrash[564] <Warning>: os_activity_diagnostic_for_pid() failed!
Jun 8 15:31:56 iPad-von ReportCrash[564] <Notice>: Formulating report for corpse[562] TCApp
Jun 8 15:31:56 iPad-von ReportCrash[564] <Warning>: Saved type '109(109_TCApp)' report (5 of max 25) at /var/mobile/Library/Logs/CrashReporter/TCApp-2016-06-08-153156.ips
我将邮件以url编码格式发送给新推送服务器https://push.codenameone.com/push/push。 (当我通过PHP发送通知时,我得到了同样的例外)
token:****
type:4
auth:****
certPassword:***
cert:****
body:Notification Test;Test Body
production:false
device:cn1-ios-****
对于调试,我没有在PushCallback的push方法中实现任何东西。请注意,它不会因类型3而崩溃。