Playing with URLs, more specifically, increasing them from the other, from the URLs searched In doing so, I want to use the NSURL object instead of manipulating NSStrings, just to get the prudential investigation and URL-specific methods linked to the URL category.
Unfortunately, it seems that there is no one there for how I would like to join the following:
NSURL * base = [NSURL URLWithString: @ "Http: //my.url/path"]; NSString * suffix = @ "sub / path";
I want to add to get them:
But the best I can get:
NSURL * final = [NSURL URLWithString: Relative Relativity: url: base];
Which is a corefoundation function:
CFURLRef CFURLCreateCopyAppendingPathComponent (
Which trims off the path on the basis of which:
CFA Locator Rough Allocate, CFRRRR URL, CF Stringerface Path Blanket, Boolean Issa Directory);
That works fine, but jumping and annoying is the jolting behind the C from the objc ... I just manipulate stars ... am I missing something? Other than being extremely aware of the course. This purpose is - If you do not need NSURL, add an extension category.
@interface NSURL (extension) - (ns URL *) urlBeeAppendingPathComponent: (NSString *) component; @end @implementation NSURL (extension) - (ns URL *) urlBeeAppendingPathComponent: (NSString *) component; {CFURLRef newURL = CFRCrack PapappingPathConponent (KCFAALOcter Default, (CFRRIFF) [Self Absolute URL], (CFString RFF Component), [Component Hysfix: @ "/"]); Return [NSMakeCollectable (newURL) autorelease]; } @end and after that:
* base = [NSURL URLWithString: @ "http: //my.url/path"]; * Suffix = @ "sub / path"; NSURL * Final = [base urlByAppendingPathComponent: suffix]; NSLog (@ "% @", last); // displays http: //my.url/path/sub/path
Comments
Post a Comment