Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/107.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.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
Adobe PhoneGap构建(iOS)和PushWoosh_Ios_Push Notification_Cordova_Token - Fatal编程技术网

Adobe PhoneGap构建(iOS)和PushWoosh

Adobe PhoneGap构建(iOS)和PushWoosh,ios,push-notification,cordova,token,Ios,Push Notification,Cordova,Token,根据PushWhoosh的文件: 我应该能够使用Adobe的Build cloud服务来构建PhoneGap应用程序。我已经按照文档中的说明进行了操作,但无法让我的应用程序注册PushWhoosh服务(即:它没有发送设备令牌) 我认为这个问题与插件在config.xml中的注册有关。根据Adobe Build docs,唯一受支持的推送插件是他们的“GenericPush”,我将其添加到我的config.xml文件中,如下所示: 我还将pushwhoosh.com域名列入了白名单 在inde

根据PushWhoosh的文件:

我应该能够使用Adobe的Build cloud服务来构建PhoneGap应用程序。我已经按照文档中的说明进行了操作,但无法让我的应用程序注册PushWhoosh服务(即:它没有发送设备令牌)

我认为这个问题与插件在
config.xml
中的注册有关。根据Adobe Build docs,唯一受支持的推送插件是他们的“GenericPush”,我将其添加到我的
config.xml
文件中,如下所示:

我还将pushwhoosh.com域名列入了白名单

在index.html文件中,我有initPushwhoosh函数,当设备准备就绪时调用该函数:

function initPushwoosh() {
        try {
            var pushNotification;
            pushNotification = window.plugins.pushNotification;

            if (device.platform == 'android' || device.platform == 'Android') {
                pushNotification.register(successHandler, errorHandler, { "senderID": "replace_with_sender_id", "ecb": "onNotificationGCM" });
            }
            else {
                pushNotification.register(tokenHandler, errorHandler, { "badge": "true", "sound": "true", "alert": "true", "ecb": "onNotificationAPN" });
            }
        }
        catch (err) {
            alert(err.message + "\n\n" + err.name);
        }

    }
我的tokenHandler函数(我正在为iOS构建)如下所示:

function tokenHandler(result) {
        // Your iOS push server needs to know the token before it can push to this device
        // here is where you might want to send it the token for later use.
        PushWoosh.appCode = "E0313-D27FA";
        PushWoosh.register(result, function (data) {
            alert("PushWoosh register success: " + JSON.stringify(data));
        }, function (errorregistration) {
            alert("Couldn't register with PushWoosh" + errorregistration);
        });
    }
通过调试,看起来“pushNotification.register”函数从未被调用,try/catch语句也没有显示任何错误消息。该职能是:

// Call this to register for push notifications. Content of [options] depends on whether we are working with APNS (iOS) or GCM (Android)
PushNotification.prototype.register = function (successCallback, errorCallback, options) {
alert("about to register");
if (errorCallback == null) { errorCallback = function () { } }

if (typeof errorCallback != "function") {
    alert("PushNotification.register failure: failure parameter not a function");
    return;
}

if (typeof successCallback != "function") {
    alert("PushNotification.register failure: success callback parameter must be a function");
    return;
}

cordova.exec(successCallback, errorCallback, "GenericPush", "register", [options]);
})

我的想法是它与
config.xml
中的插件声明(
)有关;我尝试将其更改为(基于我找到的其他一些示例代码):

完整代码可在此处找到:

我已经检查了我的PushWhoosh应用程序ID是否正确,但我无法使该应用程序在我的PushWhoosh控制面板中显示为注册设备


有什么想法吗?

我对PushWoosh不太熟悉,但他们确实有一个如何通过Build实现这一点的指南:


您是否遵循了每个步骤?

我对PushWoosh不熟悉,但他们确实提供了如何使用Build实现此目的的指南:


您是否遵循了每个步骤?

您确定此代码正确吗

pushNotification.register(successHandler,errorHandler,{“senderID”:“将_替换为_sender_id”,“ecb”:“onNotificationGCM”})


它不应该是来自GCM的项目ID吗?这可能解释了为什么设备没有注册推送通知。

您确定此代码正确吗

pushNotification.register(successHandler,errorHandler,{“senderID”:“将_替换为_sender_id”,“ecb”:“onNotificationGCM”})


它不应该是来自GCM的项目ID吗?这可能解释了为什么设备没有注册推送通知。

如果您仍然没有成功(我希望您已经成功),请尝试以下指南:

现在我自己已经使用推送通知构建了一个解决方案,发现我最大的问题是我没有设置证书。这本指南很完美


还要记住,推送通知在emulator中不起作用,只能在真实设备上使用。

如果您仍然没有成功(我希望您已经成功),请尝试以下指南:

现在我自己已经使用推送通知构建了一个解决方案,发现我最大的问题是我没有设置证书。这本指南很完美


还要记住,推送通知在模拟器中不起作用,只能在真实设备上使用。

是的,这是我参考的指南,也是我遵循的指南。仍然无法让它注册设备。是的,这是我参考的指南,也是我遵循的指南。仍然无法让它注册设备。该代码段用于在Androids上注册推送通知;当我在iOS设备上测试时,该代码段永远不会执行。问题可能出在您的MobileProvision配置文件中。它是否包含“aps环境”字符串?如果是的话,它说什么呢?这个代码片段是用来在Androids上注册推送通知的;当我在iOS设备上测试时,该代码段永远不会执行。问题可能出在您的MobileProvision配置文件中。它是否包含“aps环境”字符串?如果是的话,它说了什么?
<gap:plugin name="PushPlugin"/>
cordova.exec(successCallback, errorCallback, "GenericPush", "register", [options]);
cordova.exec(successCallback, errorCallback, "PushPlugin", "register", [options]);