0

目前我正與Azure的通知的問題 - 我已經配置好了一切生產,並證實了這一點,通過發送測試通知工作。然而,在應用程序中的第一個「registerForPushNotifications」之後,下一次我打開它,我得到記錄以下錯誤:Azure的通知中心400註冊推送

PID[11096] Information Sending response: 400.0 <Error><Code>400</Code><Detail>Installation validation failed with following error(s):&#xD; An invalid tag(s) '_UserId:facebook|10211219930003961,NewVenue' was supplied. Valid tag characters are alphanumeric, _, @, -, ., : and #..TrackingId:9315e728-8777-4cad-a475-956c38dcde36_G6,TimeStamp:4/23/2017 9:09:06 AM</Detail></Error>

我使用的樣板代碼(離子)申請註冊爲推動從科爾多瓦提供。我不明白我出錯的地方。我想解決這個問題,因爲這是生產中的一個問題。

訂閱代碼:

function registerForPushNotifications() { 
     pushRegistration = PushNotification.init({ 
     android: { 
      senderID: '<id>' 
     }, 
     ios: { 
      alert: 'true', 
      badge: 'true', 
      sound: 'true' 
     }, 
     wns: {} 
     }); 

     // Handle the registration event. 
     pushRegistration.on('registration', function(data) { 
     // Get the native platform of the device. 
     if (device) { 
      debugger 
      var platform = device.platform; 
      // Get the handle returned during registration. 
      var handle = data.registrationId; 
      // Set the device-specific message template. 
      if (platform == 'android' || platform == 'Android') { 
      // Register for GCM notifications. 
      window.azureClient.push.register('gcm', handle.replace("|",""), { 
       mytemplate: { 
       body: { 
        data: { 
        message: "{$(messageParam)}" 
        } 
       } 
       } 
      }); 
      } else if (device.platform === 'iOS') { 
      // Register for notifications. 
      window.azureClient.push.register('apns', handle.replace("|",""), { 
       mytemplate: { 
       body: { 
        aps: { 
        alert: "{$(messageParam)}" 
        } 
       } 
       } 
      }); 
      } else if (device.platform === 'windows') { 
      // Register for WNS notifications. 
      window.azureClient.push.register('wns', handle.replace("|",""), { 
       myTemplate: { 
       body: '<toast><visual><binding template="ToastText01"><text id="1">$(messageParam)</text></binding></visual></toast>', 
       headers: { 
        'X-WNS-Type': 'wns/toast' 
       } 
       } 
      }); 
      } 
     } 
     }); 

     pushRegistration.on('notification', function(data, d2) { 
     alert('Push Received: ' + data.message); 
     }); 

     pushRegistration.on('error', function(err) { 
     console.warn("error", err) 
     }); 
    } 
+0

將是很好的告訴我們你是如何註冊?它是通過Azure應用服務還是直接通知到通知中心?你的安裝對象是什麼樣的?你已經明顯改變了鍋爐板,因爲你添加了「NewVenue」,這在鍋爐板中不是標準的。 –

+0

我已經啓用了Azure移動應用程序下的刀片服務器。我使用我在編輯中添加的代碼從應用程序註冊。我不知道'newVenue'來自哪裏 - 我確實將它創建爲推刀片中的一個標籤,並選擇了「自動添加」。 –

回答

0

Azure的移動應用SDK爲Apache科爾多瓦不安裝工作,並能。你需要做一個HTTP POST請求/push/installations/{applicationId}端點(這就是推動葉片爲您配置端點)。正文必須是通知中心的有效安裝對象。

我整個過程談了這一點使用C#在我的書(http://aka.ms/zumobook)的語言。由於您發送的是與推送對象直接相關的配置對象,因此您可以對發送的推送參數進行微調。

+0

太好了,謝謝你會給我一個機會。儘管我發誓此事在我的其他應用程序之前工作過,但是有些事情發生了變化?還是我瘋了? –

+0

另外,我在哪裏獲得{applicationId}值? –

+0

代碼進行分析後,我發現與Facebook權威性和Azure的應用服務推動葉片的錯誤。我正在努力爲您解決問題。您可以通過[email protected]與我聯繫,我們會獲得更多信息排序。 applicationID在SDK中可用於client.getApplicationInstallationId() –

相關問題