Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Method Swizzling in iOS 5?

Has Apple blocked Method Swizzling in iOS 5?

I was doing a little playing around and discovered that an app with Method Swizzling works on iOS 4 but not on iOS 5.

NOTE: The app works on iOS 5 but not the part when Method Swizzling is used.

like image 552
Jash Sayani Avatar asked Oct 11 '11 02:10

Jash Sayani


People also ask

What is method swizzling in iOS?

Method swizzling is the process of replacing the implementation of a function at runtime. Swift, as a static, strongly typed language, did not previously have any built-in mechanism that would allow to dynamically change the implementation of a function.

How does method swizzling work?

Method swizzling is the process of changing the implementation of an existing selector. It's a technique made possible by the fact that method invocations in Objective-C can be changed at runtime, by changing how selectors are mapped to underlying functions in a class's dispatch table.

How do I disable method swizzling?

Method swizzling in Firebase Cloud Messaging Developers who prefer not to use swizzling can disable it by adding the flag FirebaseAppDelegateProxyEnabled in the app's Info. plist file and setting it to NO (boolean value).


1 Answers

Apple sent an email a while ago to some devs that were found to be using method swizzling in App Store apps:

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.

Looks like they wanted to get rid of it, so I'd say chances are pretty high that they've now blocked it completely.

like image 90
Jordan Smith Avatar answered Sep 21 '22 13:09

Jordan Smith