user179169
user179169

Reputation:

Having trouble with this NSURL method

Can anybody tell me excatly how I should execute this method on an NSURL object?

URLByResolvingSymlinksInPath

Compiler says that the method can't be found when I execute it.

Thanks a lot.

This is where I am trying to implement the code:

- (void)data
{
NSURL *url = [[NSURL alloc] initWithString: [[user data] objectAtIndex: 5]];
NSURL * url2 = [[NSURL alloc] init];
url2 = [url URLByResolvingSymlinksInPath];

NSData *newImage = [[NSData alloc] initWithContentsOfURL:url2];
NSImage *image = [[NSImage alloc] initWithData:newImage];

imageView.layer.masksToBounds = YES;
imageView.layer.cornerRadius = 3.0;

[imageView setImage:image];

[user autorelease];
}

Upvotes: 0

Views: 182

Answers (1)

Jason Jenkins
Jason Jenkins

Reputation: 5372

Assuming that you have NSURL named something like myURLWithSymlinks, you would do something like:

NSURL * myURLWithoutSymlinks = [myURLWithSymlinks URLByResolvingSymlinksInPath];

Note that according to the docs, URLByResolvingSymlinksInPath is only available in iOS4.0 or above and MacOSX 10.6. If you are using an older version of iOS (or MacOSX), that could be the cause of your problem.

Upvotes: 1

Related Questions