My issue (background notifications):
I am using React Native Firebase. Everything is fine until recently I updated to version 6.7.1 of the library. After the update background notification(while app is closed) stopped working. Foreground is working.
I found a suggestion here, to turn FirebaseAppDelegateProxyEnabled
to YES
in info.plist.
And it did work! I can receive notifications fine now.
But what is swizzling?
I don't really understand what is this method of swizzling do, and what is the difference between setting it YES
or NO
do?
I read about it in firebase documentation: Method swizzling in Firebase Cloud Messaging. I couldn't get it really.
Can someone explain in a clearer way, and what difference does it make?
By enabling FirebaseAppDelegateProxyEnabled (method swizzling) you allow Firebase frameworks to get all necessary work done without your code. They now can use their own method implementations for registering to receive remote notifications and probably handling them.
Method swizzling: to make story short, it is about exchanging method's implementations. For example, if you have a UIViewController and it has method viewDidLoad()
, it does some work under the hood (at least when you call super.viewDidLoad()
). So you can swizzle it with your custom implementation and do whatever you want there
Important: With the Firebase Unity SDK on iOS, do not disable method swizzling. Swizzling is required by the SDK, and without it key Firebase features such as FCM token handling do not function properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With