Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 类型错误:';未定义';在收到推送通知后不是对象(正在评估';registeredEventSources[pendindPushEvent.alias]。回调';)_Ios_Authentication_Apple Push Notifications_Ibm Mobilefirst - Fatal编程技术网

Ios 类型错误:';未定义';在收到推送通知后不是对象(正在评估';registeredEventSources[pendindPushEvent.alias]。回调';)

Ios 类型错误:';未定义';在收到推送通知后不是对象(正在评估';registeredEventSources[pendindPushEvent.alias]。回调';),ios,authentication,apple-push-notifications,ibm-mobilefirst,Ios,Authentication,Apple Push Notifications,Ibm Mobilefirst,我正在Worklight 6中开发一个混合应用程序,并尝试为我的iOS环境设置推送通知。我已经能够在iOS设备上成功订阅和接收推送通知。但是,当我试图通过单击收到的推送通知打开应用程序时,我看到以下错误: TypeError:“undefined”不是对象(正在计算“registeredEventSources[pendindPushEvent.alias].callback]” 这似乎是在我尝试连接到Worklight服务器进行身份验证(WL.Client.login)并随后阻止执行任何登录回

我正在Worklight 6中开发一个混合应用程序,并尝试为我的iOS环境设置推送通知。我已经能够在iOS设备上成功订阅和接收推送通知。但是,当我试图通过单击收到的推送通知打开应用程序时,我看到以下错误:

TypeError:“undefined”不是对象(正在计算“registeredEventSources[pendindPushEvent.alias].callback]”

这似乎是在我尝试连接到Worklight服务器进行身份验证(WL.Client.login)并随后阻止执行任何登录回调之后发生的。奇怪的是,它似乎引用的事件源回调确实被调用。我传递到WL.Client.Push.registerEventSourceCallback的函数正在执行并正确显示通知payload.msg

注意:如果在没有推送通知的情况下打开应用程序,则身份验证似乎工作正常


我在别处找不到关于这个错误的任何信息。有人能解释一下这个问题吗?

看起来您需要为推送通知定义回调:

WL.Client.Push.registerEventSourceCallback(
            "myPush", 
            "PushAdapter", 
            "PushEventSource", 
            pushNotificationReceivedCallBack);


是否可以再次检查在事件源中注册的回调函数?可能在“registerEventSourceCallback”调用中定义的函数与实际函数实现之间存在键入错误?

实际上,这是一个缺陷。它在Android中是固定的,但在iOS中显然不是。我打开了一个关于它的缺陷。

我刚刚编辑了我的问题。我对此感到困惑的部分原因是我的回调实际上正在执行。我看到的唯一真正的副作用是,我似乎无法执行身份验证回调。嗯,javascript是否有可能在pushNotificationReceivedCallBack中失败?你能发布回调的代码吗?现在我只是显示一个警报。(哪种方法有效)var receivedPushNotification=function(props,payload){alert(payload.msg);}您的Worklight版本是什么?
function pushNotificationReceivedCallBack(props, payload){
    alert("pushNotificationReceived invoked");
}