Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are performSelector and respondsToSelector banned by App Store?

My latest build was accepted into the Apple app store, but I got the notice quoted below a couple of days later.

My app also uses Rollout.io, and I asked explicitly if this was the problem. No response yet.

If respondsToSelector or performSelector are banned, are there any replacements?

Dear Developer,

Your app, extension, and/or linked framework appears to contain code designed explicitly with the capability to change your app’s behavior or functionality after App Review approval, which is not in compliance with section 3.3.2 of the Apple Developer Program License Agreement and App Store Review Guideline 2.5.2. This code, combined with a remote resource, can facilitate significant changes to your app’s behavior compared to when it was initially reviewed for the App Store. While you may not be using this functionality currently, it has the potential to load private frameworks, private methods, and enable future feature changes.

This includes any code which passes arbitrary parameters to dynamic methods such as dlopen(), dlsym(), respondsToSelector:, performSelector:, method_exchangeImplementations(), and running remote scripts in order to change app behavior or call SPI, based on the contents of the downloaded script. Even if the remote resource is not intentionally malicious, it could easily be hijacked via a Man In The Middle (MiTM) attack, which can pose a serious security vulnerability to users of your app.

Please perform an in-depth review of your app and remove any code, frameworks, or SDKs that fall in line with the functionality described above before submitting the next update for your app for review.

EDIT: Apple forum mentions this: https://forums.developer.apple.com/thread/73640

like image 866
Rayfleck Avatar asked Mar 08 '17 02:03

Rayfleck


2 Answers

It is not respondsToSelector:, performSelector: that are banned. The ban is on putting dynamic content as a parameter to this method. For example, this is not banned:

if([self.delegate respondsToSelector: @selector(myDelegateMethod)]) {
   [self.delegate performSelector: @selector(myDelegateMethod)];
}

However, this code might be banned:

NSString *remotelyLoadedString = .... (download from your backend)
[self performSelector: NSSelectorFromString(remotelyLoadedString)];
like image 103
Terminus Avatar answered Nov 01 '22 14:11

Terminus


On March 8th 2017, Apple warned all the developers of JS injection. This includes libraries like:

  • JSPatch
  • Rollout.io
  • AMapFoundation as it includes JSPatch [edit: they now provide a new version without it]
  • Bugly as it includes JSPatch [edit: they now provide a new version without it]
  • GTSDK as it includes JSPatch [edit: they now provide a new version without it]
  • ...

If you are directly using a service like JSPatch or Rollout.io, you should stop using it.

If you are using a third-party that was depending on JSPatch indirectly, you should request an updated version of your third-party that does not include JSPatch anymore.

like image 30
Cœur Avatar answered Nov 01 '22 13:11

Cœur