Are performSelector and respondsToSelector banned by App Store?

删除回忆录丶 提交于 2019-11-27 16:09:14

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)];

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.

dlopen

dlsym

respondsToSelector

performSelector

method_exchangeImplementations

Sometimes some people used to think all above methods are banned but the exact issue is, those methods are restricted to use parameters that are generated at runtime. For example,

when we use,

SEL selector = NSSelectorFromString(@"stopProgress");

Its allowed, but

when we use,

SEL selector = NSSelectorFromString(@"%@", runtimeFunction);

Its not allowed!

The app store notice told you exactly what the situation is.

The functions in question are not banned. What is banned is using those functions to circumvent the app store review process and do things like call private APIs or download and execute code. App store apps are required to have all of the code that they run compiled into them. They are also not allowed to use private APIs from iOS. If an API isn't documented, it's off limits.

My guess is that you know exactly what they are talking about, and you are trying to bypass the rules.

If you are not calling private APIs, downloading scripts and using performSelector to call them, then you should submit an appeal to the app review board, explaining what you are doing, in detail, and how it is not a violation of the app store guidelines. If you're truly not breaking the rules and have a legitimate reason for what you're doing then you will very likely be able to get your rejection overturned, but you will need to offer full disclosure and a compelling argument as to why what you are doing is not breaking Apple's rules.

Their field, their ball, their rules. If you're not willing to play by Apple's rules your only real alternative is to try to distribute your app for jailbroken devices, but that will likely cost you your developer program membership.

EDIT:

Based on your comment below, it sounds like the problem is that the framework Rollout.io that you're using is doing js injection, which Apple now bans. I suggest searching on "Rollout.io iOS app store ban" or similar.

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