phonegap build和pushwoosh获取错误aps环境未找到?

时间:2013-08-22 11:11:40

标签: phonegap-build pushwoosh

我试图让pushwoosh插件在phonegap构建应用程序中工作,我得到的是一个警告错误,找不到aps环境。

这是我采取的步骤。

  1. 创建了一个新的appID,我启用了推送通知。
  2. 创建了新的APNs开发证书。并下载了它。
  3. 创建了一个新的移动配置文件并下载并将其安装在我的手机上。
  4. 检查了移动配置文件,其中包含“aps-environment”和“developer”。
  5. 在密钥链中,我右键点击了aps证书并导出了.cer和.p12文件,并将它们上传到我在pushwoosh.com上新创建的应用程序
  6. 我在我的索引文件中写了pushwoosh应用程序ID,在配置文件中写了正确的id(与我的移动配置文件中的相同)
  7. 我在钥匙链中右键单击了我的iPhone开发人员证书并导出了一个.p12文件,用于phonegap并将其称为mypushapp.p12。
  8. 我在phonegap build上创建了一个新密钥并上传了mypushapp.p12和移动版本文件,然后我构建了我的应用程序。
  9. 应用程序本身应该正常工作,但是我得到了这个aps错误,它无法注册?

    在我的索引文件中,我在deviceready函数中初始化pushwoosh,这是我的pushwooshcode。

    function initPushwoosh() {
                alert("init pushwoosh");
        var pushNotification = window.plugins.pushNotification;
        pushNotification.onDeviceReady();
    
        pushNotification.registerDevice({alert:true, badge:true, sound:true, pw_appid:"5FB5C-E3F1F", appname:"newpushtest"},
                                        function(status) {
                                            var deviceToken = status['deviceToken'];
                                            console.warn('registerDevice: ' + deviceToken);
                                        },
                                        function(status) {
                                            console.warn('failed to register : ' + JSON.stringify(status));
                                            navigator.notification.alert(JSON.stringify(['failed to register ', status]));
                                        });
    
        pushNotification.setApplicationIconBadgeNumber(0);
    
        pushNotification.getTags(function(tags) {
                                    console.warn('tags for the device: ' + JSON.stringify(tags));
                                 },
                                 function(error) {
                                    console.warn('get tags error: ' + JSON.stringify(error));
                                 });
    
        //start geo tracking. PWTrackSignificantLocationChanges - Uses GPS in foreground, Cell Triangulation in background. 
        pushNotification.startLocationTracking('PWTrackSignificantLocationChanges',
                                        function() {
                                               console.warn('Location Tracking Started');
                                        });
    
        document.addEventListener('push-notification', function(event) {
                                    var notification = event.notification;
    
                                    navigator.notification.alert(notification.aps.alert);
    
                                    //to view full push payload
                                    //navigator.notification.alert(JSON.stringify(notification));
    
                                    pushNotification.setApplicationIconBadgeNumber(0);
                                  });
    }
    

    我不知道哪里出错,所以任何意见都表示感谢。

0 个答案:

没有答案
相关问题