Reputation:
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?
Upvotes: 0
Views: 1598
Reputation: 52565
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.
Upvotes: 1
Reputation: 10167
NSHost is a private API on the iPhone and is thus not supported on the actual device.
Upvotes: 1