KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm working through Cocoa smoothly, but this problem seems so basic it cancels out all the cool stuff I learned. :/ I have a generated file path, and it needs to be in NSURL format. From research, this is the code I wrote: NSLog(@"Old path = %@", pathToFile); NSURL *xmlURL = [[[NSURL alloc] init] fileURLWithPath:pathToFile]; NSLog(@"New path = %@", [xmlURL absoluteString]); And the output: 2010-01-27 15:39:22.105 MusicLibraryStats[28574:a0f] Old path = file://localhost/Users/[username]/Music/iTunes/iTunes%20Music%20Library.xml 2010-01-27 15:39:22.105 MusicLibraryStats[28574:a0f] New path = (null) First off, the alloc-init shouldn't even be necessary; other people seem to get away with it . In this case, if I don't alloc-init, I get an 'unrecognized selector' error on that line. Of course, now I'm just getting plain old (null). Where did I goof? Thanks!
Tags (comma-separated)
Save Edits
Cancel