-
Notifications
You must be signed in to change notification settings - Fork 323
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot build on iOS #39
Comments
Hey there. Is this just a specific problem for me or does anyone else run into this. |
I was unable to reproduce your error. What steps did you take to create your iOS app? Try modifying the messaging method below in your local code:
|
Hi. Thanks for your answer. I was just normally building my app via "flutter clean" followed by "flutter build ios" and the error occured.
to the following
But I just don't know why I had to do this. |
You are rigth. My messaging method is deprecated, thats why you couldnt compile the final version in your app. I gonna update it. Edited: I put your mod into my project and XCode complained back:
Better! Do you wanna do a fork and send me this fix? Your name will be included as this project contributor. |
I use FirebaseMessaging 7.1.0. That is the version installed by cocoapods.
Does this mean you experience the same problem after updating to the above version? Prepared the pull request. You can decide if you want to merge. Thanks for your answers. |
Im did not experienced this issue. For me, when i applied your changes, XCode complains about the override operation not being possible due to the different messaging method. But send me your fork. This way i can merge your source and see every change that you did to figure out whats goin on. |
In fact, ive merged your changes into my local files, and the messaging firebase method that you sent always complain about the override operation not being possible. In this way, i could not reproduce your error. But i guess im figuring out whats going on. You said that youre using FirebaseMessaging 7.1.0, but you want to say This plugin is not necessary to send push notifications using awesome_notifications. All that you need is inside awesome_notifications plugin and you only need to follow the steps extrictely inside Using Firebase Services (Optional) topic. Is not necessary to use any other plugin or implement any kotlin or java extra script. Maybe firebase_messaging version is conflicting with my awesome_notifications firebase library, because firebase_messaging is using another library version, that overides mine. |
Bingo! That was exactely what happened! After update my libraries with On the newer Firebase version, the firebase team did a lot of changes, including change the method messaging without keep a deprecated version. So, all the sources bellow 7.1.0 will break. And they also changed a lot of things on Android sdk, like making the entire FirebaseInstanceID obsolete. (iOS) Version 7.1.0 - 11/10/2020 You got the newer firebase version after install a firebase plugin or update your pod files. Thats why you have those issues. All the others awesome_notification developers gonna face the same after update the firebase package. So your change is entirely legit. The problem that i facing is how to keep both methods working on the same time to not injure the olders projects. Can you cancel the current pull request to |
Yeah that is exactly what I was hoping was not happening.
Consider it done :) |
Ive merged your pull request and included a suport for older versions, as the code bellow. This way, both library versions are compatible with the core code being reusable: // For Firebase Messaging versions older than 7.0
// https://github.com/rafaelsetragni/awesome_notifications/issues/39
public func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
didReceiveRegistrationToken(messaging, fcmToken: fcmToken)
}
public func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
if let unwrapped = fcmToken {
didReceiveRegistrationToken(messaging, fcmToken: unwrapped)
}
}
private func didReceiveRegistrationToken(_ messaging: Messaging, fcmToken: String){
print("Firebase registration token: \(fcmToken)")
let dataDict:[String: String] = ["token": fcmToken]
NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
} |
As the title states, i cannot build my app using your library on iOS.
Ich do not use the lib on iOS at all, i just need it for android and cannot exclude it from iOS build.
Environment:
It throws the following error:
awesome_notifications-0.0.5+2/ios/Classes/lib/SwiftAwesomeNotificationsPlugin.swift:104:17: error: parameter of 'messaging(:didReceiveRegistrationToken:)' has different optionality than required by protocol 'MessagingDelegate'
public func messaging( messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
^
?
FirebaseMessaging.MessagingDelegate:2:19: note: requirement 'messaging(:didReceiveRegistrationToken:)' declared here
optional func messaging( messaging: Messaging, didReceiveRegistrationToken fcmToken: String?)
Suggesting the parameter must be optional. I made it optional and unwrapped inside your swift plugin and the build succeeded. Maybe you can give more insight.
The text was updated successfully, but these errors were encountered: