Firebase cloud messaging - swizzle

I followed this guide, the Cloud Messaging for iOS: Push Notifications:

There it says:

By default, FirebaseMessaging uses method swizzling to handle push notifications. You’ll handle all the code yourself, so turn this off using the plist entry you just added.

FirebaseAppDelegateProxyEnabled: NO

I was wondering why should someone disable swizzling? I know it’s an override selector that helps firebase SDK do internal some overrides which helps developers to have less code implementation.

I believe someone with default behaviour with swizzling enabled, should not have any issues. right?
Except if in an app has already swizzling with similar selector methods and is causing issues (edge case I think).

Someone who reads this article might get confused that it is required / necessary to disable swizzling. Sounds misleading a bit I think. I read in the firebase documentation that it is a preference to disable swizzling.

Any thoughts about this? I think it’s not clear about this neither in the firebase documentation or in the article I read about it.

@macandyp wrote that excellent post some time back. I just pinged him as he would be the best to answer this question.

I wouldn’t say it’s bad to use swizzling. But, when you consider that it overrides something in a way you don’t necessarily understand, you may want to disable this for large/company projects. It is entirely up to you. I’ve had experiences that were difficult to track down when a library swizzled something, and never encountered issues with other libraries doing it. To say you should just allow it to happen because a library wants to do it isn’t the right answer, IMO. I’m a bit more skeptical, which led to this tutorial decision. Plus, if you handle things in a way that’s “default,” you could swap out the library without having to worry too much about the rest of your code not working. Again, all a preference, and no answer is “right.”

Thank you for your answer.
I think this explanation or some part of it would be great if it is included in the source article.

But I guess that would mean that there should be also the swizzle implementation included which would be more simple sdk setup.

This topic was automatically closed after 166 days. New replies are no longer allowed.