煎茶触摸2 +苹果推送通知+ Ext.device.Push [英] Sencha touch 2 + Apple push notifications + Ext.device.Push

查看:173
本文介绍了煎茶触摸2 +苹果推送通知+ Ext.device.Push的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我开始与煎茶触摸2开发,此刻我正在建立,需要对苹果的支持推送通知的应用程序。

I recently started developing with Sencha Touch 2, at the moment i'm creating an app that needs support for Apple Push Notifications.

所以我创建的苹果开发者中心neccesary证书,并用它们来包装与煎茶触摸SDK工具的应用。一切顺利的话,我能到我的设备上运行这个程序。

So I've created the neccesary certificates at the Apple developer center and used them to package the application with the Sencha Touch SDK tools. All went well and I'm able to run this app on my device.

在应用程序我添加了一个按钮,接收设备令牌。当我轻点按钮,它执行以下code:

In the app I added a button to receive the device token. When I tap the button it executes the following code:

    Ext.device.Push.register({
        type: Ext.device.Push.ALERT | Ext.device.Push.BADGE | Ext.device.Push.SOUND,
        success: function (token) {
            console.log('# Push notification registration successful:');
            Ext.Msg.alert('    token: ' + token);
        },
        failure: function (error) {
            console.log('# Push notification registration unsuccessful:');
            Ext.Msg.alert('     error: ' + error);
        },
        received: function (notifications) {
            console.log('# Push notification received:');
            Ext.Msg.alert('    ' + JSON.stringify(notifications));
        }



    //    Ext.device.Notification.show({
    //        title: 'My Title',
    //        message: 'A message',
    //        style: "login",
    //        buttons: ["Cancel", "Login"],
    //        callback: function (button, values, options) {
    //              //When the user taps a button, show another notification
    //              Ext.device.Notification.show({
    //                   message: 'You typed: "' + values + '"'
    //              });
    //                    }
    //        });
},

当Ext.device.Notificaion.show是注释掉,我得到一个消息,所以我敢肯定这件作品code的被执行。现在我的问题是我不从Ext.device.Push.register得到任何消息。没有成功,失败或接收到的事件触发。有没有人在这里成功地得到这个工作,或者我究竟做错了什么?

When the Ext.device.Notificaion.show is uncommented, I get a message so I'm sure this piece of code gets executed. Now my problem is I don't get any message from the Ext.device.Push.register. No success, failure or received event gets fired. Has anyone over here managed to get this working, or what am I doing wrong?

推荐答案

我已经张贴在我的博客如何配置和建立IOS推送通知一个煎茶触摸应用程序 - 的http://isolasoftware.it/2013/09/17/ios-push-notifications-using-sencha-touch-2/.

I've post on my blog how to configure and build a Sencha Touch application for IOS Push Notifications - http://isolasoftware.it/2013/09/17/ios-push-notifications-using-sencha-touch-2/.

最重要的步骤是:


  • 配置的applicationName,和的applicationID在bundleSeedId的package.json

  • 在您的应用程序执行手动授权

  • 生成的.pem证书(或或.p12)为正确推送服务器

这篇关于煎茶触摸2 +苹果推送通知+ Ext.device.Push的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆