Push通知を送ってみる
Pushを送ってみる
curl -X POST \ https://fcm.googleapis.com/fcm/send \ -H 'authorization: {{{{key=サーバキー}}}}' \ -H 'cache-control: no-cache' \ -H 'content-type: application/json' \ -d '{ "to" : "{{{{fcmToken}}}}", "priority" : "high", "mutable_content" : true, "content_available": true, "sound": "", "notification" : { "body" : "新着メッセージがあります。", "title" : "", "badge" : "5" } }'
もしパーミッションの許可がでない場合は下記のコードがあるか確認してください
(UIApplication.shared.delegate as? AppDelegate)?.requestPushNotificationPermission()