tags:

views:

19

answers:

1

Hi,

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];
}
+2  A: 

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.

Jason Jenkins
I just get: 'NSURL' may not respond to -URLByResolvingSymlinkInPath. I'm running 10.6.4 btw.
James Eggers
You may be _running_ on 10.6 but what OS are you _targeting_ when you build your app?
Stephen Darlington