IOS 的混合事件推送通知似乎尚未在 mobilefirst 7.1 上处理

Hybrid event push-notification for IOS seems like not yet handled on mobilefirst 7.1

正在尝试处理混合应用程序上的通知。通知到达设备(可以在应用程序关闭时在日志和设备上看到它)但是无法通过该代码处理它:

WL.Client.Push.registerEventSourceCallback(
    "myPush",
    "PushAdapter",
    "PushEventSource",
    function (props, payload) {
        console.log("received notification - in notifications.js")
        alert("moo");
    }
);
console.log("registered event source");

观看 mfp 插件时,似乎缺少 iOS 部分,我该如何处理该通知?

编辑:如果您正在开发 Cordova 应用程序,那么在应用程序中为 iOS 配置推送通知后,实现本身仍然是一样的,就像现在一样对于经典混合应用程序 - 如下所示。

对于这个问题,您也可以只采用混合示例并按照迁移指南将其 运行 放入 Cordova 应用程序中(没有设置,略有不同)。


看看main.js:https://github.com/MobileFirst-Platform-Developer-Center/EventSourceNotifications/blob/release71/apps/HybridEventSource/common/js/main.js

具体如下,即应用程序进入前台后处理收到的通知的函数:

function pushNotificationReceived(props, payload) {
    alert("pushNotificationReceived invoked");
    alert("props :: " + JSON.stringify(props));
    alert("payload :: " + JSON.stringify(payload));
}

据我了解,你说的问题是推送通知仅在应用程序处于后台时到达设备,但当应用程序处于前台时,应用程序将不会被推送。这只发生在 iOS?

尝试使用此示例在 MFP Cordova 应用程序中执行简单的推送,看看您是否仍然遇到同样的问题。 https://github.com/csantanapr/mfp-push-template

iOS 的设置应该非常简单。需要获取 p12 文件,配置 XCode 以使用正确的配置文件签名,在应用描述符中设置 p12 密码,在推送适配器中设置应用 ID。

您可能用过的有用指南:https://developer.ibm.com/mobilefirstplatform/documentation/getting-started-7-1/foundation/notifications/push-notifications-overview/push-notifications-in-hybrid-applications/