PhoneGap插件的onReceiveNotificationEvent資料問題
這兩天透過Phonegap插件開發時, 遇到個問題
送出window.JMessage.sendInvitationRequest(username, appkey, reason, successCallback, errorCallback)後
接收端會收到onReceiveNotificationEvent的event, "eventType":"51"
類似像以下的資訊
{
"eveventDescriptionentD":"test API",
"username":"Bbbccc",
"reason":"test API",
"eventType":"51",
"user":
"{
"eveventDescriptionentD":"test API",
"username":"Bbbccc",
"reason":"test API",
"eventType":"51"
}"
}
這邊有3個問題
- username看來顯示的並不是好友邀請發送端的username, 不知道抓的是userinfo的哪個欄位?
不是username, 也不是signature的樣子 - user這個參數底下, container外面還包了" " , 這樣在一般的json parser下似乎會出錯, 還要再特別處理, 這是刻意的嗎?
- user參數底下的資訊, 似乎跟上層資料都重複了, 請問這樣的結構有甚麼特別意思嗎? 如果是為了接收多種eventType, 那麼上層似乎就不該放eventType, 直接放在user這個container下即可
開發資訊如下:
手機iOS版本:iPod Touch iOS 10.3
Cordova Platform iOS : 4.3.1
Xcode: 8.3.3
cordova-plugin-jcore 1.1.4
jmessage-phonegap-plugin 2.4.4
source code來源:https://github.com/jpush/jmessage-phonegap-plugin