同時集成jmessage phonegap-plugin v3.0.9跟jpush-phonegap-plugin 3.2.3 會出錯

cordova
标签: #<Tag:0x00007fb83c86f500>

(Steven Yan) #1

v3.0.9版本的jmessage phonegap-plugin, 文檔中提到 iOS版本如果要添加點即通知欄通知事件監聽
需要同時集成jpush-phonegap-plugin, 如下原始說明

/**
   * 添加点击通知栏消息通知事件监听。
   * Note: Android only, (如果想要 iOS 端 实现相同的功能,需要同时集成 jpush-phonegap-plugin)
   * @param {function} listener = function (message) {}  // 以参数形式返回消息对象。
   */
  addClickMessageNotificationListener: function (listener) {
    EventHandlers.clickMessageNotification.push(listener)
  },
  removeClickMessageNotificationListener: function (listener) {
    var handlerIndex = EventHandlers.clickMessageNotification.indexOf(listener)
    if (handlerIndex >= 0) {
      EventHandlers.clickMessageNotification.splice(handlerIndex, 1)
    }
  },

但我同時集成jmessage phonegap-plugin v3.0.9跟jpush-phonegap-plugin 3.2.3 會出錯
Error Code
Android: 871308 SDK尚未初始化
iOS: 869999 未知的SDK错误码

請問是我哪個地方出了問題嗎?
以下是我的環境

Platform
	Android 6.2.3
	iOS 4.4.0

Plugin
	jmessage-phonegap-plugin 3.0.9
	cordova-plugin-jcore 1.1.6
	jpush-phonegap-plugin 3.2.3 


Error Code
	Android: 871308 SDK尚未初始化
	iOS: 869999 未知的SDK错误码



#2

将你完整的集成日志发一下看看

你初始化做了吗?在注册登录之前


(Steven Yan) #3

有做了init()
login的時候報了錯誤

日誌如下:


2017-08-15 16:41:43.533734+0800 QChat[4733:1053266] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/B8CF28CD-A1BE-40AD-8ADE-41B6079C9691/Library/Cookies/Cookies.binarycookies
2017-08-15 16:41:43.603023+0800 QChat[4733:1053266] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2017-08-15 16:41:43.610825+0800 QChat[4733:1053266] Apache Cordova native platform version 4.4.0 is starting.
2017-08-15 16:41:43.611027+0800 QChat[4733:1053266] Multi-tasking -> Device: YES, App: YES
2017-08-15 16:41:43.625883+0800 QChat[4733:1053266] 

Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file
2017-08-15 16:41:43.772598+0800 QChat[4733:1053266] Using UIWebView
2017-08-15 16:41:43.775852+0800 QChat[4733:1053266] [CDVTimer][handleopenurl] 0.168025ms
2017-08-15 16:41:43.781289+0800 QChat[4733:1053266] Unlimited access to network resources
2017-08-15 16:41:43.781496+0800 QChat[4733:1053266] [CDVTimer][intentandnavigationfilter] 5.501986ms
2017-08-15 16:41:43.781928+0800 QChat[4733:1053266] [CDVTimer][gesturehandler] 0.354052ms
2017-08-15 16:41:43.782076+0800 QChat[4733:1053266] [CDVTimer][TotalPluginStartup] 6.457984ms
2017-08-15 16:41:45.048883+0800 QChat[4733:1053315]  | JIGUANG | I - [JIGUANGService] 
--------------------------- JPush Log ----------------------------
--------------------JPush SDK Version:3.0.6--build:40----------
--------------------JCore Lib Version:1.1.5--build:25----------
-----------------AppKey:f1007b6d14755a1e17e74195----------------
----------------------------------------------------------------
2017-08-15 16:41:45.051711+0800 QChat[4733:1053315]  | JIGUANG | I - [JIGUANGClientController] Action - jpush setup
2017-08-15 16:41:45.053140+0800 QChat[4733:1053315]  | JIGUANG | I - [JIGUANGClientController] Action - setup
2017-08-15 16:41:45.110573+0800 QChat[4733:1053307] libMobileGestalt MobileGestaltSupport.m:153: pid 4733 (QChat) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-08-15 16:41:45.110652+0800 QChat[4733:1053307] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
2017-08-15 16:41:45.270739+0800 QChat[4733:1053327] Could not successfully update network info during initialization.
2017-08-15 16:41:45.324765+0800 QChat[4733:1053315]  | JIGUANG | W - [JIGUANGService] 请将JPush的初始化方法,添加到[UIApplication application: didFinishLaunchingWithOptions:]方法中,否则JPush将不能准确的统计到通知的点击数量。参考文档:https://docs.jiguang.cn/jpush/client/iOS/ios_guide_new/#_6
2017-08-15 16:41:46.414854+0800 QChat[4733:1053366]  | JIGUANG | I - [JIGUANGSessionController] connecting with coreAddr 47.90.66.178,port 7006
2017-08-15 16:41:46.465073+0800 QChat[4733:1053266] Resetting plugins due to page load.
2017-08-15 16:41:46.617927+0800 QChat[4733:1053307]  | JIGUANG | I - [JIGUANGRegistration] 
----- register info -----
Appkey: f1007b6d14755a1e17e74195
token:(null)  
 advertisingIdentifier: 
2017-08-15 16:41:47.280017+0800 QChat[4733:1053266] Finished load of: file:///var/containers/Bundle/Application/73AA5D4E-AD12-4E25-84E1-374B258BF5F3/QChat.app/www/index.html
2017-08-15 16:41:47.582086+0800 QChat[4733:1053315]  | JIGUANG | I - [JIGUANGRegistration] 
----- register result -----
uid: 10582971349
registrationID:18171adc03389449c98 
2017-08-15 16:41:47.675866+0800 QChat[4733:1053315]  | JIGUANG | I - [JIGUANGLogin] 
----- login result -----
uid:10582971349 
registrationID:18171adc03389449c98
2017-08-15 16:41:47.738123+0800 QChat[4733:1053327] Could not successfully update network info during initialization.
2017-08-15 16:41:47.741852+0800 QChat[4733:1053327] Could not successfully update network info during initialization.
2017-08-15 16:41:47.744246+0800 QChat[4733:1053327] Could not successfully update network info during initialization.
2017-08-15 16:41:48.660960+0800 QChat[4733:1053315]  | JIGUANG | W - [JIGUANGClientController] Not get deviceToken yet. Maybe: your certificate not configured APNs? or current network is not so good so APNs registration failed?  or there is no APNs register code? Please refer to JPush docs.
2017-08-15 16:41:50.642226+0800 QChat[4733:1053309]  | JIGUANG | W - [JIGUANGClientController] Not get deviceToken yet. Maybe: your certificate not configured APNs? or current network is not so good so APNs registration failed?  or there is no APNs register code? Please refer to JPush docs.
2017-08-15 16:41:53.709379+0800 QChat[4733:1053366]  | JIGUANG | W - [JIGUANGClientController] Not get deviceToken yet. Maybe: your certificate not configured APNs? or current network is not so good so APNs registration failed?  or there is no APNs register code? Please refer to JPush docs.
2017-08-15 16:41:53.986700+0800 QChat[4733:1053266] ### pluginInitialize
2017-08-15 16:41:53.987309+0800 QChat[4733:1053266] username {
    password = d6cc33086d04edf30692a24d2836aead;
    username = "Darren.K.Ti";
}
2017-08-15 16:41:54.004063+0800 QChat[4733:1053308]  | JIGUANG | I - [JMSGUser] TCP is not link to success,wait a moment
2017-08-15 16:41:54.005189+0800 QChat[4733:1053266] THREAD WARNING: ['JMessagePlugin'] took '18.163086' ms. Plugin should use a background thread.
2017-08-15 16:41:54.005498+0800 QChat[4733:1053330]  | JIGUANG | I - [JMessage] this is official version SDK.
2017-08-15 16:41:54.014919+0800 QChat[4733:1053308]  | JIGUANG | E - [JMSGStoreFileManager] Unexpected - username not exist, user:<JMSGUser, 0x1741c2940> - [ARRAY - uid:0, username:<null>, nickname:<null>, noteName:<null>, noteText:<null>, gender:0, birthday:<null>, avatar:<null>, region:<null>, siganature:<null>, address:<null>, createTime:<null>, appKey:f1007b6d14755a1e17e74195]
2017-08-15 16:41:54.016243+0800 QChat[4733:1053308]  | JIGUANG | W - [JMSGDBManager] Unexpected - username is nil
2017-08-15 16:41:54.018347+0800 QChat[4733:1053308]  | JIGUANG | E - [JMSGStoreFileManager] Unexpected - username not exist, user:<JMSGUser, 0x1741c2940> - [ARRAY - uid:0, username:<null>, nickname:<null>, noteName:<null>, noteText:<null>, gender:0, birthday:<null>, avatar:<null>, region:<null>, siganature:<null>, address:<null>, createTime:<null>, appKey:f1007b6d14755a1e17e74195]
2017-08-15 16:41:54.019475+0800 QChat[4733:1053308]  | JIGUANG | W - [JMSGDBManager] Unexpected - username is nil
2017-08-15 16:41:54.021427+0800 QChat[4733:1053308]  | JIGUANG | I - [JMSGClientController] 
------------------- JMessage SDK --------------------
------------------ JMessage SDK version:3.2.0, buildId:45 ---------
--------------------JCore Lib Version:1.1.5----------------------------
-----------------AppKey:f1007b6d14755a1e17e74195----------------
----------------------------------------------------------------
2017-08-15 16:41:54.022547+0800 QChat[4733:1053266] THREAD WARNING: ['JMessagePlugin'] took '16.520020' ms. Plugin should use a background thread.
2017-08-15 16:41:54.023488+0800 QChat[4733:1053308]  | JIGUANG | I - [JMSGClientController] Action - jmessage setup
2017-08-15 16:41:54.039627+0800 QChat[4733:1053330]  | JIGUANG | E - [JMessage+JMSGInner] user didn't login, please login first! 
2017-08-15 16:41:54.040968+0800 QChat[4733:1053330]  | JIGUANG | E - [JMessage+JMSGInner] user didn't login, please login first! 
2017-08-15 16:41:54.041956+0800 QChat[4733:1053366]  | JIGUANG | E - [JMessage+JMSGInner] user didn't login, please login first! 
2017-08-15 16:41:54.042777+0800 QChat[4733:1053309]  | JIGUANG | E - [JMessage+JMSGInner] user didn't login, please login first! 
2017-08-15 16:41:54.646583+0800 QChat[4733:1053366]  | JIGUANG | W - [JIGUANGClientController] Not get deviceToken yet. Maybe: your certificate not configured APNs? or current network is not so good so APNs registration failed?  or there is no APNs register code? Please refer to JPush docs.
2017-08-15 16:41:56.643330+0800 QChat[4733:1053309]  | JIGUANG | W - [JIGUANGClientController] Not get deviceToken yet. Maybe: your certificate not configured APNs? or current network is not so good so APNs registration failed?  or there is no APNs register code? Please refer to JPush docs.


#4

你JMessage得先注册,你看日志里面说[quote=“StevenYanBI30, post:3, topic:20121”]
Unexpected - username not exist
[/quote]


(Steven Yan) #5

之前用的是v2.4.9的plugin
所以帳號都是曾經註冊過的
怎麼會改用v3.0.9就拋了username not exist (到極光後台也有看到此帳號…)


#6

你检查登录的方法写在哪里的,在初始化之后 进行,这里显示的你传的数据都是null


(HuminiOS) #7

V3 版本的 api 用法和之前的有很大的改动, 看看传的参数有没有错误。


(Steven Yan) #8

login方法確實是寫在init之後
如果不安裝jpush plugin, 上述這些數據都可以正常拿到


(Steven Yan) #9

有確認過參數
就是想按v3.0.9重新開發
才故意去改v2.4.9的使用方法

不過我有注意到

JIGUANG | W - [JIGUANGClientController] Not get deviceToken yet. Maybe: your certificate not configured APNs? or current network is not so good so APNs registration failed?  or there is no APNs register code? Please refer to JPush docs.

這種錯誤可能的原因是甚麼
certification是驗證過的
怎會說沒有APNs驗證過


#10

这个错误是 集成JPush时出现的


(Steven Yan) #11

原先v2.4.9版本都可以正常推播跟發訊息
假設是我申請的新的key有問題
所以我安裝v3.0.9 plugin時, 就用回舊的app_key (v2.4.9版本可以正常work所用的key)
沒有再拋出APNs這類的錯誤
但一樣是死在login

ClientController] Not get deviceTok
iOS: 869999 未知的SDK错误码

我的部分代碼如下,都是按v3版本去使用的
如果不安裝JPush Plugin, 就可以正常login


var JM = {
    init: function() {

        var params = {
            'isOpenMessageRoaming': false
        };
        window.JMessage.init(params);

        JM.login();
    },
    login: function() {

        var params = {
            'username': "Darren.K.Ti",
            'password': jmessagePWD
        };

        window.JMessage.login(params, function(data) {
            console.log("----login success");
            console.log(data);

            /*
            JM.User.getMyInfo();
            JM.User.getUserInfo("Darren.K.Ti");
            JM.Chatroom.getGroupIds();
            JM.Chatroom.getGroupInfo(23135211);
            JM.Chatroom.getGroupMembers(23135211);
            */

        }, function(errorStr) {
            console.log("----login Error");
            console.log(errorStr);
        });
    }
};

JM.init();

#12

要不试一下其他的用户账号?
有没有可能是你之前登录过一个账号没有下线,然后又重复登录了一次呢?

我再反馈给开发看看


(Steven Yan) #13

好的, 謝謝

以下我再提供套用之前v2.4.9版本可以work的key
改安裝v3.0.9時, 實際執行login時的log
沒看到APNs相關的錯誤
但最後還是拋了無法進一步識別錯誤原因的
869999 未知的SDK错误码

但是安裝android就一切正常, 也可以login
差別自然是iOS版本需要額外安裝jpush phonegap plugin v3.2.3
就導致login失敗

另外問一下, 有可能是jmessage v3.0.9有要求cordova版本這類其他套件有最小需求嗎?
我用的是cordova-plugin-jcore 1.1.6

真的不行
就得回到v2.4.9, 蠻可惜不能使用結構較好的v3.0版本


2017-08-16 17:05:29.204667+0800 ENS[427:33189] You've implemented -[<UIApplicationDelegate> application:didReceiveRemoteNotification:fetchCompletionHandler:], but you still need to add "remote-notification" to the list of your supported UIBackgroundModes in your Info.plist.
2017-08-16 17:05:29.212102+0800 ENS[427:33189] Apache Cordova native platform version 4.4.0 is starting.
2017-08-16 17:05:29.212273+0800 ENS[427:33189] Multi-tasking -> Device: YES, App: YES
2017-08-16 17:05:29.222146+0800 ENS[427:33189] 

Started backup to iCloud! Please be careful.
Your application might be rejected by Apple if you store too much data.
For more information please read "iOS Data Storage Guidelines" at:
https://developer.apple.com/icloud/documentation/data-storage/
To disable web storage backup to iCloud, set the BackupWebStorage preference to "local" in the Cordova config.xml file
2017-08-16 17:05:29.390868+0800 ENS[427:33189] Using UIWebView
2017-08-16 17:05:29.393381+0800 ENS[427:33189] [CDVTimer][handleopenurl] 0.184000ms
2017-08-16 17:05:29.399031+0800 ENS[427:33189] Unlimited access to network resources
2017-08-16 17:05:29.399220+0800 ENS[427:33189] [CDVTimer][intentandnavigationfilter] 5.704045ms
2017-08-16 17:05:29.399686+0800 ENS[427:33189] [CDVTimer][gesturehandler] 0.374019ms
2017-08-16 17:05:29.399812+0800 ENS[427:33189] [CDVTimer][TotalPluginStartup] 6.669998ms
2017-08-16 17:05:29.445238+0800 ENS[427:33241]  | JIGUANG | I - [JIGUANGService] 
--------------------------- JPush Log ----------------------------
--------------------JPush SDK Version:3.0.6--build:40----------
--------------------JCore Lib Version:1.1.5--build:25----------
-----------------AppKey:6e51cf3c174910d247ac76f3----------------
----------------------------------------------------------------
2017-08-16 17:05:29.448645+0800 ENS[427:33233]  | JIGUANG | I - [JIGUANGClientController] Action - jpush setup
2017-08-16 17:05:29.450390+0800 ENS[427:33233]  | JIGUANG | I - [JIGUANGClientController] Action - setup
2017-08-16 17:05:29.559383+0800 ENS[427:33233] libMobileGestalt MobileGestaltSupport.m:153: pid 427 (ENS) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-08-16 17:05:29.559513+0800 ENS[427:33233] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
2017-08-16 17:05:30.830891+0800 ENS[427:33239]  | JIGUANG | W - [JIGUANGService] 请将JPush的初始化方法,添加到[UIApplication application: didFinishLaunchingWithOptions:]方法中,否则JPush将不能准确的统计到通知的点击数量。参考文档:https://docs.jiguang.cn/jpush/client/iOS/ios_guide_new/#_6
2017-08-16 17:05:31.928177+0800 ENS[427:33252] Could not successfully update network info during initialization.
2017-08-16 17:05:32.044301+0800 ENS[427:33189] Resetting plugins due to page load.
2017-08-16 17:05:32.125963+0800 ENS[427:33234]  | JIGUANG | I - [JIGUANGSessionController] connecting with coreAddr 207.226.143.113,port 7007
2017-08-16 17:05:32.267994+0800 ENS[427:33275]  | JIGUANG | I - [JIGUANGLogin] 
----- login result -----
uid:10253695516 
registrationID:1114a897929d865111d
2017-08-16 17:05:32.783682+0800 ENS[427:33189] Finished load of: file:///var/containers/Bundle/Application/A1E004CB-6A8F-4C99-9F94-DAC09F440F30/ENS.app/www/index.html
2017-08-16 17:05:35.450697+0800 ENS[427:33189] ### pluginInitialize
2017-08-16 17:05:35.456248+0800 ENS[427:33234]  | JIGUANG | I - [JMessage] this is official version SDK.
2017-08-16 17:05:35.517655+0800 ENS[427:33232]  | JIGUANG | I - [JMSGClientController] 
------------------- JMessage SDK --------------------
------------------ JMessage SDK version:3.2.0, buildId:45 ---------
--------------------JCore Lib Version:1.1.5----------------------------
-----------------AppKey:6e51cf3c174910d247ac76f3----------------
----------------------------------------------------------------
2017-08-16 17:05:35.518780+0800 ENS[427:33189] THREAD WARNING: ['JMessagePlugin'] took '67.784912' ms. Plugin should use a background thread.
2017-08-16 17:05:35.519502+0800 ENS[427:33189] username {
    password = d6cc33086d04edf30692a24d2836aead;
    username = "Darren.K.Ti";
}
2017-08-16 17:05:35.520433+0800 ENS[427:33232]  | JIGUANG | I - [JMSGClientController] Action - jmessage setup
2017-08-16 17:05:35.523447+0800 ENS[427:33232]  | JIGUANG | I - [JMSGUser] TCP is not link to success,wait a moment
2017-08-16 17:05:35.524015+0800 ENS[427:33189] ### pluginInitialize
2017-08-16 17:05:35.908958+0800 ENS[427:33275]  | JIGUANG | I - [JIGUANGBadgeNumberReport] set badge:0 succeed
2017-08-16 17:05:36.889022+0800 ENS[427:33232]  | JIGUANG | I - [JIGUANGBadgeNumberReport] set badge:0 succeed


(HuminiOS) #14

可以加我 Q:380108184,进一步了解情况。


(Steven Yan) #15

[quote=“HuminiOS, post:14, topic:20121”]
可以加我 Q:380108184,进一步了解情况。
[/quote] 好的, 我請相關的開發人員明天跟您聯繫
感謝!