Understanding this use of "(Private)" in @interface declaration
I've seen some code written this way:
@interface AViewController(Private)
I wanted to开发者_运维知识库 know if that (Private)
means something when submitting to the App Store? What does it mean in general?
It's a category called 'Private'.
Have a look in the Categories and Extensions chapter of the Objective-C programming reference
What it means is that it is an addition to the AViewControler class that has been named 'Private' for convenience. It could have been called anything or even left blank to create a class extension.
You can create private methods in your own code that your app can call. This is actually good practice because it indicates proper encapsulation (although there is no such thing as a private method in Objective-C). What you aren't allowed to do is to use private methods of the iOS frameworks in your code if you don't want your app rejected from the App Store.
(Private)
in this case deals with principles of Object Oriented Programming.
This does not necessarily denote a Private API, which would violate the Apple iPhone Developer Agreement.
Note: App Store approval is very black-box, so I can not guarantee that such code would not indeed result in rejection during the approval process.
Private is just a way to define a category on an object. Does not mean much to Apple but I would recommend using a unique name whenever adding categories to well known libraries such as ones in the FoundationFramework. If your naming convention is a prefix of AV then add a category like this.
@interface AViewController(AVPrivate);
精彩评论