2016-04-02 60 views
0

我試圖從web(Javascript)發送推送推送消息已成功添加到隊列中的quickblox帳戶和狀態發送,但我沒有收到它在設備上(iPhone )。當我從Web控制檯發送推送時,我能夠成功接收它。請告訴我代碼有什麼問題或需要進行任何設置。無法使用QuickBlox接收推送通知

enter image description here

發送推送的代碼如下:

var params = { 
       login: ....., 
       password: ..... 
      } 
QB.createSession(params, function(err, result) { 
       if(!err){ 

        var pushCustomParams = { 
         message: 'Message sent successfully', 
         ios_badge: 1, 
         ios_sound: 'ringtone.wav', 
         user_id: app.caller.id 

        } 

        var params1 = { 
         notification_type: 'push', 

         user: {ids: [recp_id]}, // recipients. 
         environment: 'development', // environment, can be 'production' as well. 
         message: QB.pushnotifications.base64Encode(JSON.stringify(pushCustomParams)) // See how to form iOS or Android spesific push notifications 
        }; 

        QB.pushnotifications.events.create(params1, function(err, response) { 
         if (err) { 
          console.log(err); 

         } else { 
          // success 


         } 
        }); 
       } 
      }); 

回答

0

嘗試這樣的:

var params1 = { 
    notification_type: 'push', 
    push_type: 'apns', // http://quickblox.com/developers/Messages#Create_event 
    user: {ids: [recp_id]}, 
    environment: 'development', 
    message: QB.pushnotifications.base64Encode(JSON.stringify(pushCustomParams)) 
}; 

我希望這會有所幫助。