2015-08-08 101 views
3

我正在使用具有推送通知支持的IBM MobileFirst Platform Foundation 7.0创建应用。此时,iOS设备可以在应用未运行时成功接收通知。但是,如果我通过通知触摸横幅消息,则应用程序将启动并立即崩溃。同样,如果应用程序已经运行并且推送通知到达,该应用程序将立即崩溃。推送通知导致应用崩溃

奇怪的是我最初并不总是看到这种行为。但是,现在每次都是在上述情况下发生。

我该如何解决这个问题?我需要安装补丁吗?我已卸载/重新安装应用程序没有成功。

这是我送过工作灯REST API发送短消息的有效载荷:

{ 
    "message" : { 
    "alert" : "Test message", 
    }, 
    "settings" : { 
    "apns" : { 
     "badge" : 1, 
     "iosActionKey" : "Ok", 
     "payload" : "", 
     "sound" : "song.mp3" 
    } 
    }, 
    "target" : { 
    "consumerIds" : [], 
    "deviceIds" : [ ], 
    "platforms" : [ "A"], 
    "tagNames" : [], 
    }, 
} 

这里是我的设备错误报告:

> apsd[93] <Error>: Property list invalid for format: 200 (property lists cannot contain objects of type 'CFNull') [209] <Warning>: 
> [DEBUG] [WL_PUSH] -[Push processRemotePushNotification:] in Push.m:426 
> :: Push: didReceive Remote notification [209] <Warning>: [FATAL] 
> [WORKLIGHT] Uncaught Exception: *** -[__NSArrayI objectAtIndex:]: 
> index 1 beyond bounds [0 .. 0] [209] <Error>: *** Terminating app 
> due to uncaught exception 'NSRangeException', reason: '*** 
>  -[__NSArrayI objectAtIndex:]: index 1 beyond bounds [0 .. 0]'  *** First throw call stack:  (0x1863cc2d8 0x1980980e4 0x1862afb34 
> 0x1002a5afc 0x1002a558c 0x1872c0180 0x18638412c 0x186383ddc 
> 0x186381828 0x1862ad2d4 0x18fd036fc 0x18aeaaf40 0x1000ac0e0 
> 0x198742a08) ReportCrash[210] <Error>: task_set_exception_ports(B07, 
> 400, D03, 0, 0) failed with error (4: (os/kern) invalid argument) 
> ReportCrash[210] <Notice>: ReportCrash acting against PID 209 
> ReportCrash[210] <Notice>: Formulating crash report for process [209] 
> com.apple.xpc.launchd[1] 
> (UIKitApplication:com.companyname.appname.qa[0xc100][209]) <Notice>: 
> Service exited due to signal: Abort trap: 6 ReportCrash[210] 
> <Notice>: Saved report to 
> /var/mobile/Library/Logs/CrashReporter/_2015-08-07-231518_.ips 
> SpringBoard[54] <Warning>: Application 
> 'UIKitApplication:com.companyname.appname.qa[0xc100]' crashed. 
+0

尾随目标后,并且没有APN密钥。 – jarryd

+0

该文档还列出了“actionKey”而不是“isActionKey”:http://www-01.ibm.com/support/knowledgecenter/SSHS8R_7.0.0/com.ibm.worklight.apiref.doc/html/refjavascript-server/html /WL.Server.html%23sendMessage –

+0

处理推送通知负载的代码是什么样的? [你可以设置所有例外的断点](https://developer.apple.com/library/ios/recipes/xcode_help-breakpoint_navigator/articles/adding_an_exception_breakpoint.html#//apple_ref/doc/uid/TP40010433-CH1-SW1 )?这样,当抛出异常时,你会知道它来自哪一行。 –

回答

0

如果客户端收到的有效载荷不正确的格式,预期的行为。 作为第一步,确保有效载荷在正确的格式中的链接注意如下─

WL.Server.sendMessage

REST API

客户端处理程序都已经在框架内定义和你做不需要自己实现它。要处理有效负载,请在客户端使用适当的JS回调函数。如果使用标签/广播通知,这将是WL.Client.Push.onMessage

相关问题