Comments (10)
Hey there.
Is this just a specific problem for me or does anyone else run into this.
from awesome_notifications.
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:
from awesome_notifications.
Hi. Thanks for your answer.
I was just normally building my app via "flutter clean" followed by "flutter build ios" and the error occured.
I already did modify the following code:
public func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) {
print("Firebase registration token: \(fcmToken)")
let dataDict:[String: String] = ["token": fcmToken]
NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
// TODO: If necessary send token to application server.
// Note: This callback is fired at each app startup and whenever a new token is generated.
}
to the following
public func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
if let unwrapped = fcmToken {
print("Firebase registration token: \(unwrapped)")
let dataDict:[String: String] = ["token": unwrapped]
NotificationCenter.default.post(name: Notification.Name("FCMToken"), object: nil, userInfo: dataDict)
// TODO: If necessary send token to application server.
// Note: This callback is fired at each app startup and whenever a new token is generated.
}
}
But I just don't know why I had to do this.
from awesome_notifications.
You are rigth. My messaging method is deprecated, thats why you couldnt compile the final version in your app. I gonna update it.
Did you use another firebase services in your app? What version are they?
Edited:
I put your mod into my project and XCode complained back:
Parameter of 'messaging(_:didReceiveRegistrationToken:)' has different optionality than expected by protocol 'MessagingDelegate'
Remove '?'
Better! Do you wanna do a fork and send me this fix? Your name will be included as this project contributor.
from awesome_notifications.
You are rigth. My messaging method is deprecated, thats why you couldnt compile the final version in your app. I gonna update it.
Did you use another firebase services in your app? What version are they?
I use FirebaseMessaging 7.1.0. That is the version installed by cocoapods.
Better! Do you wanna do a fork and send me this fix? Your name will be included as this project contributor.
Does this mean you experience the same problem after updating to the above version?
If so, I gladly provide the fix. Just don't want to break it for somebody else.
Prepared the pull request. You can decide if you want to merge. Thanks for your answers.
from awesome_notifications.
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.
from awesome_notifications.
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 firebase_messaging: ^7.1.0
instead?
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.
from awesome_notifications.
Bingo! That was exactely what happened!
After update my libraries with pod update
, i got your error!
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
(Android) Cloud Messaging version 21.0.0
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 master
branch and send the same pull request to update-firebase-sdk
branch instead? Theres a lot changes to do on Android side as well.
from awesome_notifications.
Yeah that is exactly what I was hoping was not happening.
But now that we now the problem it is maybe fixable.
If you need anything else from me, don't hesitate to ask. Thanks for your effort :)
Can you cancel the current pull request to master branch and send the same pull request to update-firebase-sdk branch instead? Theres a lot changes to do on Android side as well.
Consider it done :)
from awesome_notifications.
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)
}
from awesome_notifications.
Related Issues (20)
- Use String or UUID not integer to identify Notification Schedules! Integer is not Unique.. HOT 1
- IOS communication notifications & Android conversation notifications HOT 1
- Multiple XCode error on version 0.8.2 HOT 4
- Notification Badge Count not updating if multiple Notifications are shown. HOT 1
- Notification Badge Count not updating if multiple Notifications are shown. iOS HOT 2
- onActionReceivedMethod always returns the FIRST Notification HOT 2
- Check if user has actually denied permissions HOT 1
- Bug release - Firebase service is not available HOT 2
- Doc: Steps for non-xcode IDE like vscode in configuring IOS HOT 1
- Using locked: true with NotificationContent produces notifications that are still dismissable (Android) HOT 2
- Cannot set BUILD_LIBRARY_FOR_DISTRIBUTION and APPLICATION_EXTENSION_API_ONLY to Codemagic HOT 2
- Unable to instantiate service me.carda.awesome_notifications.core.managers.StatusBarManager HOT 1
- No Dart Background Handler Registered HOT 2
- Support for More Image Formats HOT 1
- Need more clarification about playing sound in background simultaneously with the notification. HOT 1
- Compiling for iOS 11.0, but module 'IosAwnCore' has a minimum deployment target of iOS 12.0 HOT 1
- 'addApplicationDelegate' is unavailable in application extensions for iOS HOT 35
- After the vibration mode is enabled, the notification is triggered several times, and only one vibration is generated HOT 1
- Awesome Notifications not initializing caused by setListeners HOT 2
- Readme flutter_background_fetch dose not exist HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from awesome_notifications.