简体   繁体   English

子视图可以算作在iOS中使用未记录的API吗?

[英]Can subviews count as using undocumented APIs in iOS?

Does using (for example) UIWebView 's subviews count as using undocumented APIs? 使用(例如) UIWebView的子视图是否算作使用未公开的API? There is no documentation on the fact that the first subview of a UIWebView is a UIScrollView . 没有文档说明UIWebView的第一个子视图是UIScrollView Does that mean that I am not allowed to add children to this UISCrollView ? 这是否意味着不允许我向此UISCrollView添加子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. 在iOS 3.1中, UIWebView的第一个子视图是一个名为"UIScroller"的类的实例,该类与UIScrollView几乎相同,但未在任何地方进行记录。 What is allowed exactly? 到底允许什么?

From UIView Class Reference UIView类参考

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. 对于在UIKit和其他系统框架中声明的复杂视图,该视图的任何子视图通常被视为私有视图,并且随时可能更改。 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 : 根据《 App Store审查指南》

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 如Apple iOS人机界面指南所述,未正确使用系统提供的项目(如按钮和图标)的应用可能会被拒绝

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. 此外,如果您确实以与Apple设计和用户期望不符的方式修改了标准组件,则您的应用可能会被拒绝。

Modifying the private subviews of UIWebView seems like a poor plan. 修改UIWebView的私有子视图似乎是一个糟糕的计划。

I don't think it counts as using private APIs (correct me if I'm wrong), but I wouldn't recommend it. 我认为这不算是使用私有API(如果我输入错了,请纠正我),但是我不建议这样做。 As you say: "in iOS 3.1" it works that way, but it's not guaranteed to work the same on other versions. 如您所说:“在iOS 3.1中”它可以那样工作,但不能保证在其他版本上也可以工作。 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. 顺便说一句,很少有人使用iOS 3.1,所以我建议您看一下它在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. 编辑:我从没有将应用程序上载到应用程序商店,但我可以告诉你很多:您不向Apple提交任何源代码。 They run your executable in a tool that will detect if you call any private API methods. 它们在工具中运行您的可执行文件,该工具将检测您是否调用任何私有API方法。

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. 我无法保证,因为我没有参与Apple的审查程序,但是如果他们由于这个原因拒绝您的应用程序,我将感到非常惊讶。

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. 如果您将应用提交到应用商店并获得批准,请返回并发表评论。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM