今月、Azure Mobileサービスを使用する前にAzure App Serviceを使い始めました。タグ付きの登録サービストークンはかなり簡単ですが、それはセキュリティ上の問題のために削除されたので、私はカスタムAPIでそれを行う必要があります。Azure App ServiceのトラブルシューティングiOSのタグを使用したNotFication登録のプッシュ
私は特定のuser.Howeverに通知を送信するタグとしてユーザーIDを設定する必要があるように(私のクライアントが望んでいないので、紺色の認証サービスではない))カスタム認証を使用していますデバイストークン登録がOKである(私はタグなしで皆にプッシュを送信することができます)タグが機能していない場合であっても、私はこれらのブログの記事
マイカスタムAPIを以下ました直面する問題(updateNotification.js)
私は(私はこのfunc application(application: UIApplication,
didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
let keychain = KeychainSwift()
let id : NSString = keychain.get("userID")! as String
let client = MSClient(applicationURLString: "https://XXXX.XXXX.XXX")
var deviceTokenString = "\(deviceToken)"
deviceTokenString = deviceTokenString.stringByReplacingOccurrencesOfString("<", withString: "")
deviceTokenString = deviceTokenString.stringByReplacingOccurrencesOfString(">", withString: "")
deviceTokenString = deviceTokenString.stringByReplacingOccurrencesOfString(" ", withString: "-")
client.push?.registerDeviceToken(deviceToken, completion: { (error) in
if let err = error {
print("ERROR ", err)
}else{
client.invokeAPI("updateNotification", body: nil, HTTPMethod: "Post", parameters: ["id" : deviceTokenString , "userID" : id], headers: nil) { (result, response, error) in
if response?.statusCode != 200 {
NSLog("ERROR %@", error!)
} else {
print("Tags Successfully Implemented")
}
}
}
})
}
すべては私のデバイスはトークン、私のコンソールに私は自分のユーザーIDを見ることができ、今の罰金だとユーザーIDは次のようにここでやっていた私のAppDelegate.swiftクラスで
var api = {
get: (request,response,next) => {
var push = request.azureMobile.push;
var installationId = request.query.id;
push.getInstallation(installationId, function(error, installation, res){
if (error){
console.log('An error occurred when retrieving installation : ' + error);
response.status(error.statusCode).send(error.detail);
}
else{
// Return an array of current tags.
response.json(installation.tags);
}
});
},
post: (request, response, next) => {
var push = request.azureMobile.push;
var installationId = request.query.id;
var tags = request.query.userID;
var updateOperation = [{
"op": "add",
"path": "/tags",
"value": tags.toString()
}];
push.patchInstallation(installationId, updateOperation, function(error, res){
if(error){
console.log(error)
response.status(error.statusCode).send(error.detail);
}
else{
console.log("Success");
console.log("Tags : " + tags);
response.status(200).send(tags);
}
});
}
};
module.exports = api;
その途中のプッX:そのために残念D)
deviceToken = 22afedf6-a08f1ce9-XXXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXX-db431577-2dfbbee1 ユーザID = 88d06c97-XXXXXXXX-XXXX-042215c46575
しかし、私はこのエラーを取得しています、デバイスIDのタグを表示する
client.invokeAPI("updateNotification", body: nil, HTTPMethod: "GET", parameters: ["id" : deviceTokenString], headers: nil) { (result, response, error) in
if response?.statusCode != 200 {
NSLog("ERROR %@", error!)
} else {
print(result)
}
}
このGETメソッドをしようとしたとき:
エラードメイン= com.Microsoft.MicrosoftAzureMobile.ErrorDomainコード= -1302 "インストールではない found.TrackingId:57239dd3-XXXX-XXXX-XXXX-0bd9579c660e_G1、タイムスタンプ:2016年7月18日 八時22分05秒PM」
どのように私はこのエラーメッセージを解決しますか。ここ
から得ることinstallationId送信してupdateNotificationのGETメソッドを呼び出すことにより、タグを確認することができもらえです[診断ガイドライン](https://azure.microsoft.com/en-us/documentation/articles/notification-hubs-push-notification-fixer/)に従ってください。問題が解決しない場合は、完全なトラッキングIDをここに貼り付けますか? (それについては何も敏感ではありません。ランダムな文字列です) –
@NikitaG。ここで私の追跡IDはc5c802bd - c94f - 46f7 - b87d - bddbe0e277d4_G6です – KBB