开发者

Can subviews count as using undocumented APIs in iOS?

Does using (for example) UIWebView's subviews count as using undocumented APIs? There is no documentation on the fact that the first subview of a UIWebView is a UIScrollView. Does that mean that I am not allowed to add chil开发者_Go百科dren to this UISCrollView?

I'm not using any private calls, but it isn't documented anywhere. In iOS 3.1 the first subview of a UIWebView is an instance of a class called "UIScroller", which is almost identical to the UIScrollView, but not documented anywhere. What is allowed exactly?


From UIView Class Reference

For complex views declared in UIKit and other system frameworks, any subviews of the view are generally considered private and subject to change at any time. Therefore, you should not attempt to retrieve or modify subviews for these types of system-supplied views. If you do, your code may break during a future system update.

From App Store Review Guidelines:

Apps that do not use system provided items, such as buttons and icons, correctly and as described in the Apple iOS Human Interface Guidelines may be rejected

Taken together, I read these as saying: You can look at the subviews of standard components, but mess with them at your own peril -- things will change with no notice, and you'll have nobody to blame but yourself when they break. Furthermore, if you do modify a standard component in a way that's out of keeping with what Apple designed and users expect, your app will likely be rejected.

Modifying the private subviews of UIWebView seems like a poor plan.


I don't think it counts as using private APIs (correct me if I'm wrong), but I wouldn't recommend it. As you say: "in iOS 3.1" it works that way, but it's not guaranteed to work the same on other versions. It may change with an update and the application will break.

By the way, very few use iOS 3.1, so I would recommend looking at how it works in 4.3.

EDIT: I have never uploaded an app to app store where I've done this, but I can tell you this much: You do not submit any source code to Apple. They run your executable in a tool that will detect if you call any private API methods.

Looping through subviews is allowed. So is adding subviews. They don't even mention this in the guidelines. I can't make any guarantees, since I'm not involved in Apple's review process, but I would be very surprised if they would reject your app for this reason.

If you feel like it would add value to your app I would go ahead and do it. If you submit your app to the app store and get it approved, please come back and leave a comment.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜