在设备中运行NSHost会显示NSHost.h错误 [英] NSHost run in device gives an NSHost.h error
问题描述
NSHost不支持iphone ...当我在模拟器中运行它时,它工作正常……但是当我想在设备中运行时,它给出了NSHost.h错误....
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?
推荐答案
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:
您可以通过利用 NSStream与 CFStream.使用 CFStreamCreatePairWithSocketToHost到 创建CFStreams到主机,然后 将产生的CFStreams强制转换为 NSStreams.
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.
这篇关于在设备中运行NSHost会显示NSHost.h错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!