App Store - Method Swizzling Legality [closed]

≯℡__Kan透↙ 提交于 2019-12-18 04:30:11

问题


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!


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8834294/app-store-method-swizzling-legality

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!