0

一切都被偉大的工作,那麼現在我得到以下錯誤:離子推送不再工作的1.x

ionic.bundle.js:18463 OPTIONS https://push.ionic.io/api/v1/push net::ERR_NAME_NOT_RESOLVED

我似乎無法使用發送推送以下內容:

// Encode your key 
var auth = btoa(privateKey + ':'); 

// Build the request object 
var req = { 
    method: 'POST', 
    url: 'https://push.ionic.io/api/v1/push', 
    headers: { 
     'Content-Type': 'application/json', 
     'X-Ionic-Application-Id': appId, 
     'Authorization': 'basic ' + auth 
    }, 
    data: { 
     "tokens": devices, 
     "notification": { 
      "alert": message, 
      "ios":{ 
      "priority": 10, 
      "badge": 1, 
      "payload": {"path": path} 
      } 
     } 
    } 
}; 

// Make the API call 
$http(req).success(function(resp){ 
    // Handle success 
    console.log("Ionic Push: Push success!"); 
}).error(function(error){ 
    // Handle error 
    console.log("Ionic Push: Push error..."); 
}); 

一切都停止了工作 - 之前它的工作很精美。

感謝您的幫助

回答

0

我認爲他們已經改變了URL和格式一點點。

新的URL是https://api.ionic.io/push/notifications

淨荷

{ 「令牌」:[ 「device_token_1」, 「device_token_2」], 「輪廓」: 「PROD」, 「通知」:{ 「標題「:」消息的標題「, 」消息「:」Ur消息!「 } }