PhoneGap中文网

 找回密码
 立即注册
查看: 21221|回复: 4
打印 上一主题 下一主题

求助,极光推送案例程序IOS版。

[复制链接]

7

主题

25

帖子

173

积分

注册会员

Rank: 2

积分
173
跳转到指定楼层
楼主
发表于 2015-12-15 08:53:34 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
各位朋友我在github.com下载的极光推送案例程序都布置好了,我在iOS下真机上可以收到APNS消息通知,但是前台始终收不到,我看见XCODE控制台显示

这个那个主界面内容全是空

PushConfig.plist 里面的APP_KEY的值也设定好了,不然消息通知肯定收不到。

回复

使用道具 举报

7

主题

25

帖子

173

积分

注册会员

Rank: 2

积分
173
沙发
 楼主| 发表于 2015-12-15 09:33:49 | 只看该作者
安装后网页部分js似乎没执行
<!DOCTYPE html>
<html>
   
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
            <title>Phonegap Sample App</title>
            <link href="css/jquery.mobile-1.1.1.css" rel="stylesheet" type="text/css"/>
            <script type="text/javascript" src="js/jquery.js"></script>
            <script type="text/javascript" src="js/jquery.mobile-1.1.1.js"></script>
            <script type="text/javascript" src="cordova.js"></script>
            <script type="text/javascript">
            var onDeviceReady   = function(){
                console.log("JPushPlugin:Device ready!")
                initiateUI();
            }
            var onGetRegistradionID = function(data) {
                try{
                    console.log("JPushPlugin:registrationID is "+data)
                    
                    $("#registrationid").html(data);
                }
                catch(exception){
                    console.log(exception);
                }
            }

            var onTagsWithAlias = function(event){
                try{
                    console.log("onTagsWithAlias");   
                    var result="result code:"+event.resultCode+" ";
                    result+="tags:"+event.tags+" ";
                    result+="alias:"+event.alias+" ";
                    $("#tagAliasResult").html(result);
                }
                catch(exception){
                    console.log(exception)
                }
            }
            var onOpenNotification = function(event){
                try{
                    var alertContent
                    if(device.platform == "Android"){
                        alertContent=window.plugins.jPushPlugin.openNotification.alert;
                    }else{
                        alertContent   = event.aps.alert;
                    }
                    alert("open Notificaiton:"+alertContent);
                    
                }
                catch(exception){
                    console.log("JPushPlugin:onOpenNotification"+exception);
                }
            }
            var onReceiveNotification = function(event){
                try{
                        var alertContent
                    if(device.platform == "Android"){
                                   alertContent = window.plugins.jPushPlugin.receiveNotification.alert;
                    }else{
                         alertContent   = event.aps.alert;
                    }
                    $("#notificationResult").html(alertContent);
                    
                }
                catch(exeption){
                    console.log(exception)
                }
            }
            var onReceiveMessage = function(event){
                try{
               
                    var message
                    if(device.platform == "Android"){
                                   message = window.plugins.jPushPlugin.receiveMessage.message;
                    }else{
                         message   = event.content;
                    }                    
                     //var extras = window.plugins.jPushPlugin.extras
   
                     $("#messageResult").html(message);
                     
                }
                catch(exception){
                    console.log("JPushPlugin:onReceiveMessage-->"+exception);
                }
            }

            var initiateUI = function(){
            
                    try{
                    window.plugins.jPushPlugin.init();
                    window.plugins.jPushPlugin.getRegistrationID(onGetRegistradionID);
                    
                    if(device.platform != "Android"){
                        window.plugins.jPushPlugin.setDebugModeFromIos();
                        window.plugins.jPushPlugin.setApplicationIconBadgeNumber(0);
                    }else{
                        window.plugins.jPushPlugin.setDebugMode(true);
                    }
                    }
                    catch(exception){
                            console.log(exception);
                    }
               $("#setTagWithAliasButton").click(function(ev) {
                    try{
                        var tag1 = $("#tagText1").attr("value");
                        var tag2 = $("#tagText2").attr("value");
                        var tag3 = $("#tagText3").attr("value");
                        var alias = $("#aliasText").attr("value");
                        var dd = [];
                           
                        if(tag1==""&&tag2==""&&tag3==""){                          
                        }
                        else{
                            if(tag1 != ""){
                                dd.push(tag1);
                            }
                            if(tag2 != ""){
                                dd.push(tag2);
                            }
                            if(tag3 != ""){
                                dd.push(tag3);
                            }
                        }
                        window.plugins.jPushPlugin.setTagsWithAlias(dd,alias);
                        
                    }
                    catch(exception){
                        console.log(exception);
                    }
                })
            }
            document.addEventListener("jpush.setTagsWithAlias", onTagsWithAlias, false);
            document.addEventListener("deviceready", onDeviceReady, false);
            document.addEventListener("jpush.openNotification", onOpenNotification, false);
            document.addEventListener("jpush.receiveNotification", onReceiveNotification, false);
            document.addEventListener("jpush.receiveMessage", onReceiveMessage, false);


            //jpush.receiveMessage
        </script>
    </head>
    <body>
        <div data-role="page" id="page">
            
            <div data-role="content">
                <form>
                    <div class="ui-body ui-body-b">
                        
                        <div data-role="fieldcontain">
                            <center><h3>JPushPlugin Example</h3></center>
                            <span name="alias" id="alias"></span><hr />
                            <label>RegistrationID: </label>
                            <label id="registrationid">null</label>
                        </div>
                        <div data-role="fieldcontain">
                            <label>Tags: </label>
                            <table>
                                <tr>
                                    <td>
                                        <input type="text"  id="tagText1"/>
                                    </td>                                    
                                </tr>
                                <tr>
                                    <td>
                                        <input type="text"  id="tagText2"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        <input type="text"  id="tagText3">
                                    </td>
                                </tr>
                            </table>
                            <label>Alias: </label>
                            <table>
                                <tr>
                                    <td>
                                        <input type="text"   id="aliasText">
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div data-role="fieldcontain">
                            <input type="button" id="setTagWithAliasButton" value="Add tag and alias" />
                        </div>
                        <div data-role="fieldcontain">
                            <label id="tagAliasPrompt" >设置tag/alias结果:  </label>
                            <label id="tagAliasResult" >null</label>
                        </div>
                        <div data-role="fieldcontain">
                            <label id="notificationPrompt" >接受的通知内容:</label>
                            <label id="notificationResult" >null</label>
                        </div>
                        <div data-role="fieldcontain">
                            <label id="messagePrompt" >接受的自定义消息:</label>
                            <label id="messageResult" >null</label>
                        </div>


                    </div>
                </form>
            </div>
            
        </div>
    </body>
</html>

回复 支持 反对

使用道具 举报

7

主题

25

帖子

173

积分

注册会员

Rank: 2

积分
173
板凳
 楼主| 发表于 2015-12-15 10:09:44 | 只看该作者
本帖最后由 jbxp 于 2015-12-15 12:32 编辑

快来帮忙啊,我的工作有工期啊,照着文档资料都搞不定啊
回复 支持 反对

使用道具 举报

0

主题

3

帖子

28

积分

新手上路

Rank: 1

积分
28
地板
发表于 2016-10-31 14:06:38 | 只看该作者
楼主解决没?怎么解决的呢
回复 支持 反对

使用道具 举报

0

主题

3

帖子

28

积分

新手上路

Rank: 1

积分
28
5#
发表于 2016-10-31 14:07:16 | 只看该作者
#楼主解决没?怎么解决的呢?#
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐 上一条 /1 下一条

ionic4视频教程

Archiver|手机版|小黑屋| PhoneGap中文网 ( 京ICP备13027796号-1 )  

GMT+8, 2024-4-27 10:42 , Processed in 0.051206 second(s), 36 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表