sohel14_cse_ju
sohel14_cse_ju

Reputation: 2521

NSData dataWithContentsOfURL issue

I have a string with url.Please take a look at the following code.I am not getting what's the error.Getting an exception like :

Exception :

[NSCFString isFileURL]: unrecognized selector sent to instance 0x4b69700
2011-04-22 00:16:30.520 SC.Pandit[15098:207] *** Terminating app due to uncaught           

exception 'NSInvalidArgumentException', reason: '-[NSCFString isFileURL]: unrecognized selector sent to instance 0x4b69700'

My Code :

NSURL *url =(NSURL *) imageURL;
NSLog(@"%@",url);
NSData *data = [NSData dataWithContentsOfURL:url];

Upvotes: 0

Views: 1450

Answers (1)

Roger
Roger

Reputation: 15813

This worries me;

NSURL *url =(NSURL *) imageURL;

Looks like you are maybe casting a string to a NSURL? How is imageURL defined?

If so, don't do that, do it properly with something like;

NSURL *url = [NSURL URLWithString:imageURL];

Of course if imageURL is not NSString, then you will need to get it into that to start with.

But could you give an example of what your URL actually looks like, that could be the issue.

Upvotes: 1

Related Questions