5

I know that there are some restricted api's or code that are not allowed to be in your app when you submit it to the app store.

How do you know what they are? Is there a way to check your app before you submit it to ensure you have not used such api's?

It is probably better to avoid this problem at the design stage, than trying to fix it later, so I was wondering if there is any tool in Xcode, or document to determine this.

4
  • If you only use documented interfaces, you're fine.
    – Carl Norum
    Mar 14, 2012 at 3:22
  • Can you explain what you mean? The method's I would like to use are method_exchangeImplementations and class_getInstanceMethod. Both of these have public documentation that you can google. Does that mean I can use them?
    – Rahul Iyer
    Mar 14, 2012 at 3:49
  • @PterieDaktyl Yes, you can use the two functions you mention.
    – Costique
    Mar 14, 2012 at 5:02
  • 1
    @Costique, using method_exchangeImplementations is method swizzling. Apple might not care if you swizzle one of your own methods, or maybe that of a non-Apple library that you use, but they don't want you swizzling methods from iOS itself. So, it depends.
    – Nate
    May 18, 2012 at 23:44

4 Answers 4

10

The way Apple intends for you to do this is to use XCode's Validation feature. When you're submitting an app, you build for achiving (or Archive from the XCode menu). Then, you open up Organizer to see the archive you just created. At this point, you can press the Validate button in Organizer. That will perform a validation, without actually submitting the app. It will tell you if you're using Private APIs. Depending on how you use them, it might identify what the violation is:

Organizer screenshot

There's definitely ways that code can fool this validation step, and "get away" with using Private APIs until the reviewer looks at the bundle. But, as far as I know, those ways would all be intentional methods of hiding Private API usage, and it sounds like you're trying to discover accidental usage.

If you fail this Validation test, then you might want to use something like AppScanner, mentioned in alan duncan's answer. But, for completeness, I wanted to make sure people knew that this Validation step is available in XCode, and checking for Private API usage is one of the things it's doing before you submit (and have to wait a few days to be told what you did wrong). Also, even if you don't use the Validate button in Organizer, but just use Submit, the tool is performing a Validation for you. The only difference is whether the bundle actually gets uploaded to iTunes Connect.

2

If you stick to documented interfaces as suggested above, you're fine. The only issue is with third-party libraries whose implementation may be opaque to you.

There is a Mac app called AppScanner that scans from private API usage. I have no experience with it, though.

1
  • Thanks for the suggestion. I will look into the app. It would be great if there was some way I could do this using Apple's tools, or documentation though.
    – Rahul Iyer
    Mar 14, 2012 at 3:52
1

You will get more information on Apple approval process from

2
  • I am aware that during the approval process they do some kind of scan to check if I am using a private api. But I would like to know this now, so that I can come up with the right design. Trying to change my design later may be too difficult. I was wondering if there is some way I can determine this myself?
    – Rahul Iyer
    Mar 14, 2012 at 3:51
  • You can create your app only by using standard apple code, if you had designed it according to iOS human interface guidelines. The term Private APIs means any Un-documented APIs.
    – jay
    Mar 14, 2012 at 4:04
1
  1. get the private API list.
  2. use class-dump to process the Mach-O file, and get the processed string.
  3. use regex to get the interface, class, or method in the string.
  4. match the API to private API list.

then GOT it~

I opened a porject to do this, but because the reason of my company, canceled. very sorry for this.

2
  • 2
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Nov 9, 2015 at 20:32
  • because the reson of my company, the project is now not open source. very sorry~
    – atool
    May 26, 2016 at 8:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.