I’ve a undertaking that makes use of cloud capabilities to ship out push notifications based mostly on matter person chosen .
person subscribe to matter :
await FirebaseMessaging.occasion.subscribeToTopic(('mytopic'));
Then my cloud perform :
const capabilities = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(capabilities.config().firebase);
const fcm = admin.messaging();
var payload = {
"notification": {
"title": msgData.identify,
"physique": msgData.title,
"click_action": 'FLUTTER_NOTIFICATION_CLICK',
"android_channel_id": "my_channel_id",
},
"knowledge": {
"content material": msgData.content material,
"title": msgData.title,
}
};
return fcm.sendToTopic("/matters/" + 'mytopic', payload);
On Android it really works 100% . Each in debug and on actual system and when downloaded from Play Retailer .
On actual iOS system it solely works in debug mode . No notifications are acquired once I obtain from App Retailer
I famous this error at begin up on my actual iOS system however unsure what it means :
[FirebaseMessaging][I-FCM002022] APNS system token not set earlier than retrieving FCM Token for Sender ID '123456789'. Notifications to this FCM Token is not going to be delivered over APNS.You should definitely re-retrieve the FCM token as soon as the APNS system token is ready.
Please additionally see Xcode screenshots :
I attempted including beneath into AppDelegate.swift in addition to talked about in similiar subject:
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func software(
_ software: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
software.registerForRemoteNotifications()//I ADDED THIS TO ATTEMPT FOR iOS push messaging to work in Launch/Manufacturing Mode
return tremendous.software(software, didFinishLaunchingWithOptions: launchOptions)
}
}
I have been struggling to get this fastened . If anybody can help . I might add extra data if it could resolve the difficulty . Thanks