Is there any current information on wether or not method swizzling is legal/illegal on the App Store?
The only data point I can find is the Three20 framework shakeup a while back, which started with this notice:
Your application, xxx, currently posted to the App Store is using method_exchangeImplementations to exchange the implementation of Apple provided APIs with your own implementations. Because of upcoming changes, this behavior in your application may cause a crash or cause user data loss on iPhone OS 4.0.
xxx uses method_exchangeImplementations to exchange the implementation of dealloc with your method ttdealloc. It also exchanges the implementation of the method popViewControllerAnimated: with your method popViewControllerAnimated2:.
Please resolve this issue immediately and upload your new binary to iTunes Connect. We may remove your application if we believe that doing so is prudent or necessary.
When I'm searching around, every recent conversation I can find about swizzling and the app store seems to reference the same Three20 incident. The notice seems to be pretty specific, and I'm wondering if the issue was specific changes issues with the changes Three20 had made or if method_exchangeImplementations is universally banned.
Are there any other data points about whether or not the practice is allowed? Are there any devs with Apps in the store that are using swizzling?
Thanks!
AFNetworking, a lib widely (IMO) used for network-requests, used swizzling up to at least version 1.3.4 to support additional acceptable status-codes and content-types in class-methods.
So it seems legit to do it.
Note: They used class_replaceMethod and not method_exchangeImplementations.
Normally swizzling would be for debugging to see when a specific method is called, or in situation you can't subclass something or use a category for it. If you don't have a tight schedule on putting your Application on the app store, I guess you could try to send your application using method swizzling and see if it's accepted. No all application are reviewed the same way, sometimes it's just really up to the reviewer.
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