NSHost run in device gives an NSHost.h error

我怕爱的太早我们不能终老 提交于 2019-12-12 01:15:21

问题


NSHost doesnot support to iphone... When I run this in simulator it works fine... But when I want to run in device means it gives an NSHost.h error....

I want to do this in device also. How could I fix this?


回答1:


NSHost is a private API on the iPhone and is thus not supported on the actual device.




回答2:


Apple have published a technical note (QA1652) on "Using NSStreams For A TCP Connection Without NSHost."

There's a code sample on that page, but here's a summary:

You can do this by exploiting the toll-free bridge between NSStream and CFStream. Use CFStreamCreatePairWithSocketToHost to create CFStreams to the host, and then cast the resulting CFStreams to NSStreams.



来源:https://stackoverflow.com/questions/1006754/nshost-problem

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!