Closed andiosdev closed 3 months ago
@andiosdev Please check this issue, I wrote solution there: https://github.com/mirzemehdi/KMPNotifier/issues/3
Add this line in info.plist will fix FirebaseAppDelegateProxyEnabled / Boolean / NO
@chen-lihan still getting the error. Not sure if it's the reason for not receiving notification in iOS.
APNS device token not set before retrieving FCM Token for Sender ID '-----'.Be sure to re-retrieve the FCM token once the APNS device token is set.
Declining request for FCM Token since no APNS Token specified
Error while getting token: Error Domain=com.google.fcm Code=505 "No APNS token specified before fetching FCM Token" UserInfo={NSLocalizedFailureReason=No APNS token specified before fetching FCM Token}
@andiosdev ,ohh! Could you check your ios code? i forgot it . i add this line on application block .
application.registerForRemoteNotifications()
class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
NotifierManager.shared.initialize(configuration: NotificationPlatformConfigurationIos(showPushNotification: true, askNotificationPermissionOnStart: false)
)
application.registerForRemoteNotifications()
`
And Notice Your APNS KEY Is Correct
I have similar code in my AppDelegate and still error exists. Where do I check if my APNS Key is correct?
@andiosdev Your Firebase And Apple Developer Account Page
@chen-lihan Thank you. I was to able to get this running.
@mirzemehdi I don't know what I missed but I'm getting this error "Cannot find 'NotifierManager' in scope" inside iOSApp.swift. I have the following imports:
import SwiftUI
import ComposeApp
import FirebaseCore
import FirebaseMessaging
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) async -> UIBackgroundFetchResult {
NotifierManager.shared.onApplicationDidReceiveRemoteNotification(userInfo: userInfo)
return UIBackgroundFetchResult.newData
}
@andiosdev maybe for ios part you didn't export library in app build gradle file, that's why it is not visible in swift side
listOf(
iosX64(),
iosArm64(),
iosSimulatorArm64()
).forEach { iosTarget ->
iosTarget.binaries.framework {
export(libs.kmpnotifier)
baseName = "sample"
isStatic = true
}
}
Closing this issue due to inactivity. If this is still an issue or need a help, please feel free to reopen the issue and provide additional context or updates. Thank you.
Hi,
Followed everything and got push notification working ion Android but in iOS I'm getting this error:
Error Domain=com.google.fcm Code=505 "No APNS token specified before fetching FCM Token" UserInfo={NSLocalizedFailureReason=No APNS token specified before fetching FCM Token}