当点击通知

时间:2017-01-25 07:23:08

标签: ios iphone cordova ibm-mobilefirst onesignal

  

2017-01-25 12:48:02.057770 onesignaldemo [1009:314358] [DEBUG] [WL_PUSH] - [推送processRemotePushNotification:]在Push.m中:426 :: Push:didReceive远程通知   2017-01-25 12:48:03.065772 onesignaldemo [1009:314358] [致命] [工作灯]未捕获异常: * - [__ NSSingleObjectArrayI objectAtIndex:]:索引1超出边界[0 .. 0]   2017-01-25 12:48:03.093979 onesignaldemo [1009:314358] 由于未捕获的异常终止应用' NSRangeException',原因:&#39 ; - [__ NSSingleObjectArrayI objectAtIndex:]:索引1超出边界[0 .. 0]'   * 第一次抛出调用堆栈:   (0x190eed1b8 0x18f92455c 0x190ede420 0x10011d514 0x10011cfb8 0x1919ea46c 0x190e9b1d8 0x190e9aeec 0x190e9a7a8 0x190e983a4 0x190dc62b8 0x19287a198 0x197041510 0x197254c3c 0x19725885c 0x190ef3150 0x190de5eac 0x190dea95c 0x196a8bdd4 0x190ef1070 0x190dea80c 0x196abc92c 0x195bea254 0x19613dba0 0x195519044 0x19551862c 0x195518a6c 0x1955185c8 0x19551862c 0x1955185c8 0x19551862c 0x195512328 0x1953e4a68 0x194e1e770 0x195101f50 0x19663edec 0x19663fc0c 0x196aca61c 0x197256dd4 0x10039f5c0 0x191a01048 0x190e9ab5c 0x190e9a434 0x190e980a4 0x190dc62b8 0x19287a198 0x196e0d7fc 0x196e08534 0x1000183d0 0x18fda95b8)   libc ++ abi.dylib:以NSException类型的未捕获异常终止   块引用

这是我在应用中获得的有效负载

cordova.require('cordova/exec').nativeCallback('OneSignalPush998202862',1,
  {
    "shown" : true,
    "payload" : {
      "body" : "wwww",
      "sound" : "default",
      "notificationID" : "93d30e95-8af8-4e47-a50d-e09af9fd9498",
      "rawPayload" : {
        "aps" : {
          "alert" : "wwww",
          "sound" : "default"
        },
        "custom" : {
          "a" : {
            "foo" : "bar"
          },
          "i" : "93d30e95-8af8-4e47-a50d-e09af9fd9498"
        }
      },
      "additionalData" : {
        "foo" : "bar"
      }
    },
    "isAppInFocus" : true,
    "displayType" : 2
  }
,1)

Worklight版本为7.1

此CDVCommandDelegateImpl.m代码出错

- (void)evalJsHelper2:(NSString*)js
{
    CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
    NSString* commandsJSON = [_viewController.webView stringByEvaluatingJavaScriptFromString:js];
    if ([commandsJSON length] > 0) {
        CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
    }

    [_commandQueue enqueueCommandBatch:commandsJSON];
    [_commandQueue executePending];
}

错误再现

推送通知工作正常 应用程序可以接收通知

应用程序处于非活动状态:如果我点击通知,应用程序将会打开,它会在应用内显示通知提醒并突然退出。

应用程序处于活动状态:通知将自动显示在应用程序中,应用程序将停留在那里。

1 个答案:

答案 0 :(得分:2)

  

我可以在我的ios应用程序中集成Onesignal。   问题出在config.xml中   我评论了config.xml中的推送相关标签。