Reputation: 6037
Apologies- i'm new to xcode/cocoa/objective-c...
I'm struggling to understand what is wrong with:
NSHost *host = [NSHost hostWithAddress:@"192.168.0.155"];
I'm receiving 2 errors"
No known class method for selector 'hostWithAddress:'
Receiver 'NSHost' for class message is a forward declaration
Could you help explain the errors and how I can achieve the simple task of creating an instance of NSHost pointing to 192.168.0.155.
Thanks
Lee
Upvotes: 3
Views: 3415
Reputation: 817
As mentioned NSHost is not available in iPhone, depends on what you need it for you could bypass it by using this sample code by apple: https://developer.apple.com/library/ios/qa/qa1652/_index.html
Upvotes: 0
Reputation: 6037
It turns out NSHost is not available on the iPhone! It's a shame xcode didn't highlight that for me!
I tried to use NSHost and XCode didn't recognize it
Thanks for your help,
Lee
Upvotes: 4
Reputation: 24190
According to the documentation for NSHost, you are using exactly the right method. However from looking at your error message, it says hostwithAddress
, the correct casing is hostWithAddress
, so make sure there is a capital W.
Also, make sure you have #import <Foundation/Foundation.h>
at the top of your .m file.
Remember, Objective-C is a case sensitive language.
Upvotes: 2