Creating an NSURL
Creating an NSURL
- Subject: Creating an NSURL
- From: Darrin Cardani <email@hidden>
- Date: Thu, 13 Nov 2003 15:42:45 -0600
I have an NSMovieView, and I want to save the reference to the movie
file it contains. I get the movie's URL by doing this:
NSMovie* theMovie = [ movieView movie ];
NSURL* movieURL = [ theMovie URL ];
NSString* movieStr = [ movieURL absoluteString];
This gives me a string containing URL of this type:
file://localhost/path/to/movie.mov
I save that in an XML file. I can open the XML file in a text editor
and look at it, and it is correctly saved.
However, when I attempt to read it back in, I have the string above
in an NSString, and I do the following:
NSString* moviePath = the string from the XML file
NSURL* movieURL = [ NSURL URLWithString:moviePath ];
That returns nil for movieURL, which would lead me to believe that
moviePath isn't well-formed according to RFC 2396, since that's the
one case the docs for [ NSURL URLWithString ] mention as returning
nil. I've logged the moviePath string to the console and it looks
correct. The string contains only letters, numbers and path
separators. There are no spaces, colons, extra slashes, etc. What am
I doing wrong? Should I not have the "file://localhost/" in there? Or
is there something else I'm missing?
Thanks,
Darrin
--
Darrin Cardani - email@hidden
President, Buena Software, Inc.
<
http://www.buena.com/>
Video, Image and Audio Processing Development
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.