UnkwnTech
UnkwnTech

Reputation: 90911

No stringWithContentsofURL method found

I'm following this tutorial, attempting to learn a bit about iPhone development, and there come a point where the author uses the stringWithContentsofURL method but xcode is telling me that there is no stringWithContentsofURL method found. I've done some searching and I've not been able to come up with a solution. This is a screen shot of the xcode window displaying the error: alt text http://mywebprogrammer.com/so/obj-c%20problem%200.png

Upvotes: 0

Views: 603

Answers (2)

grassyburrito
grassyburrito

Reputation: 1243

Its [NSString stringWithContentsOfURL]. Note: its the capital 'O' (in Of) not small 'o' as given by you. Also Its a static method so cannot be used against an object.

Upvotes: 1

newacct
newacct

Reputation: 122489

stringWithContentsofURL: is a class method, not an instance method, so you have to use it as

[NSString stringWithContentsOfURL:myURL]

or if you want to allocate it yourself, you would do:

[[NSString alloc] initWithContentsOfURL:myURL]

but then you would have to release it later

Upvotes: 2

Related Questions