Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Including OHHTTPStubs in project cause for rejection from AppStore #7

Closed
jcole opened this issue Nov 19, 2012 · 5 comments
Closed

Including OHHTTPStubs in project cause for rejection from AppStore #7

jcole opened this issue Nov 19, 2012 · 5 comments

Comments

@jcole
Copy link

jcole commented Nov 19, 2012

Hi, I included OHHTTPStubs in a project I submitted to the AppStore, but was subsequently rejected. The cause was "We found that your app uses one or more non-public APIs". After looking through the code, it turned out to be the bit in OHHTTPStubs.m, lines 168-175:

// Undocumented initializer obtained by class-dump
// Don't use this in production code destined for the App Store
@interface NSHTTPURLResponse(UndocumentedInitializer)
- (id)initWithURL:(NSURL*)URL
       statusCode:(NSInteger)statusCode
     headerFields:(NSDictionary*)headerFields
      requestTime:(double)requestTime;
@end

Maybe I missed it, but it would be very helpful to have this in the documentation (near the top? in the installation section?) highlighting this caveat.

@netbe
Copy link

netbe commented Nov 19, 2012

In my opinion, you should not have OHHTTPStubs code in you real app, only in the tests target, check where your headers are included.

@jcole
Copy link
Author

jcole commented Nov 19, 2012

Thanks -- I thought I did follow the instructions on the wiki for only adding it to the Test target, but it's certainly possible I screwed that up.

@AliSoftware
Copy link
Owner

Yes that's not really an issue because you should only use OHHTTPStubs in your tests & debug code, not in production (and normally if you don't use the OHHTTPStubs symbols anywhere in your code, the code won't be included by the linker to reduce the final binary size, except if you used -all_load).

You should only need to use stubs in your tests & debug code, it doesn't have any sense to use it in production code.
I'll probably add something in the README about this anyway.

If you guys have any idea if it is possible to detect if an application is being compiled with a production certificate using #if directives (I hardly doubt it, except if the Xcode compile adds -D flags automatically in such cases but it's doubtful) so I can add a #warning or #error in such case to prevent the compilation/linking with OHHTTPStubs in production code?

AliSoftware added a commit that referenced this issue Nov 21, 2012
…roduction code.

Only link it in your Unit Tests or inside #if directives to avoid using this code for AppStore builds (see #7)
@aceysmith
Copy link

Is this still an issue? It appears that the mentioned initializer isn't used anymore. Is there any other private API use with this library? I'd like to switch to including OHHTTPStubs via cocoapods, but cocoapods doesn't have conditional linking based on build configurations quite yet.

@AliSoftware
Copy link
Owner

Nope every use of any private API have been removed since this issue and no new private API have been introduced since the numerous new versions since.

So this lib won't make your app being rejected from AppStore submission.

Note that I still recommend to remove it before submitting, not because it would be rejected but because it had little sense to keep a lib in a release version of your app if you don't use it (you rarely stub requests in your final app 😉) and it will make your app size lighter.

Also note that the conditional linking based on build configurations has been recently added to the master branch of CocoaPods and will thus be available in the next release of CocoaPods !

AliSoftware added a commit that referenced this issue Nov 3, 2015
…roduction code.

Only link it in your Unit Tests or inside #if directives to avoid using this code for AppStore builds (see #7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants