NSURL objects are immutable so there is no way to change the base URL after creating it. Your best bet is creating a new NSURL instance with URLWithString:relativeToURL: . However, I still think what you want will not work.
The docs for -NSURL relativePath state that if the receiver is an absolute URL (which your example is), this method returns the same value as path .
Up vote 0 down vote favorite share g+ share fb share tw.
I have a NSURL to a local file with no base url. I want to change the base URL to another local directory, with the relative path being in respect to that URL. For example NSURL *path = NSURL fileURLWithPath: @"/Users/username/Desktop/Photos/Photo1.
Jpg"; Now, say I want to change the base part to /Users/username/Desktop/SomeFolder, then I would want the NSString returned by path relativePath; to be "../Photos/Photo1. Jpg" Is there an easy way to do this? I can't seem to find any NSURL methods that do this.
I could go through the path components of the new base and old absolute paths to construct the relative part my self, but is there an easier way? Objective-c cocoa nsurl link|improve this question asked Nov 25 '09 at 19:34David Brown3,0211313 100% accept rate.
NSURL objects are immutable so there is no way to change the base URL after creating it. Your best bet is creating a new NSURL instance with URLWithString:relativeToURL:. However, I still think what you want will not work.
The docs for -NSURL relativePath state that if the receiver is an absolute URL (which your example is), this method returns the same value as path.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.