为什么使用 NSHost 的代码可以使用 iPhone SDK 正确编译?
我有一些为 Mac OS X 编写的代码,它大量使用了 NSHost
类。在我努力将此代码引入 iPhone 的过程中,我发现 NSHost
在 iPhone SDK 中不可用,而应替换为 NSStream
和相关的网络类。
无论如何,我一直在努力将其移植到 iPhone,我注意到即使不删除 NSHost
代码,它仍然可以编译而没有任何错误。这是针对设备 SDK(而非模拟器)进行编译。当然,如果该类不在 iPhone SDK 中,它应该会给我一个编译错误,说它找不到符号或其他东西?
难道 NSHost
在 iPhone 上可用,但设为私有?
I have some code that was written for Mac OS X and it makes a lot of use of the NSHost
class. During my efforts to bring this code to the iPhone, I discovered that NSHost
isn't available in the iPhone SDK, and should instead be replaced with NSStream
and the related networking classes.
Anywho, I've been working on it to port it over to the iPhone and I noticed that even without removing the NSHost
code, it still compiles without any errors. This is compiling against the device SDK (not simulator). Surely if the class isn't in the iPhone SDK it should give me a compile error saying it couldn't find the symbols or something?
Could it be that NSHost
is available on the iPhone, but made private?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来它是私有 API,但仍然可用。 不过,它应该会给您一些编译器警告。您是否尝试过清理构建?
Looks like it's private API but still available. Still, it should give you some compiler warnings. Have you tried cleaning the build?