Wednesday, May 1, 2013

NSURL URLByStandardizingPath example ios


URLByStandardizingPath

Returns a new URL that points to the same resource as the original URL and is an absolute path.
- (NSURL *)URLByStandardizingPath
Return Value of [NSURL URLByStandardizingPath]
A new URL that points to the same resource as the original URL and is an absolute path.
Discussion of [NSURL URLByStandardizingPath]
This method only works on URLs with the file: path scheme. This method will return an identical URL for all other URLs.
Example of [NSURL URLByStandardizingPath]
if([a isEqual:b]) {
  NSLog(@"Same"); 
}

if([[a absoluteURL] isEqual:[b absoluteURL]]) {
  NSLog(@"Same"); 
}

if([[a URLByStandardizingPath] isEqual:[b URLByStandardizingPath]]) {
  NSLog(@"Same"); 
}