Push notification crashes the app

I am building an application using IBM MobileFirst Platform Foundation 7.0 with push notification support. At this point, iOS devices can successfully receive notifications while the app is not running. However, if I touch the banner message from the notification, the app will launch and then crash immediately. Likewise, if the app is already running and a push notification appears, the app will be triggered immediately.

It's weird that I didn't always see this behavior initially. However, this now happens every time under the specified circumstances.

How can I fix this? Is there a patch I need to install? I uninstalled / reinstalled the app with no success.

Here is the payload I am posting through the Worklight REST API:

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

      

Here is the bug report on my device:

> 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.

      

+3


source to share


1 answer


If the payload received by the client is not in the correct format, the behavior observed is expected. As a first step, make sure the payload is in the correct format as indicated in the links below -

WL.Server.sendMessage



or REST API

Client side handlers are already defined within the framework and you don't need to implement it yourself. Use the appropriate client-side JS callback function to work with the payload. If you are using Tag / Broadcast notifications it will be WL.Client.Push.onMessage

0


source







All Articles