Re: [NSString stringWithContentsOfURL:] question
Re: [NSString stringWithContentsOfURL:] question
- Subject: Re: [NSString stringWithContentsOfURL:] question
- From: Marc Weil <email@hidden>
- Date: Thu, 13 Feb 2003 13:34:51 -0500
That file doesn't exist because I can't give the URL to the *real* script.
It's secret :-D. So I just typed in a fake one.
The reason why I thought it was expecting an NSString in the file is people
stringWithContentsOfURL seems to parallel stringWithContentsOfFile. Maybe
I'll try to access the text file directly rather than going through a script
to see if that works. At least then I will be able to tell whether it is a
problem with the Perl script or a problem with receiving plaintext using
NSString.
-- Marc Weil
On 2/13/03 10:57 AM, "Sherm Pendley" <email@hidden> wrote:
>
On Thursday, February 13, 2003, at 09:11 AM, Marc Weil wrote:
>
>
> NSString *serverSideList = [NSString stringWithContentsOfURL:[NSURL
>
> URLWithString:@"http://www.northsoftproductions.com/cgi-
>
> bin/access.cgi"]];
>
>
>
> Whenever this line of code is executed, serverSideList becomes
>
> "(invalid)"
>
> when in gdb, and it's memory address becomes 0x0.
>
>
stringWithContentsOfURL: return nil if the URL can't be loaded. Have you
>
tried the URL in a browser, or with Curl? I tried the one you gave, and
>
it returned a "404 - Not Found" page.
>
>
> I am assuming this is
>
> happening because -stringWithContentsOfURL is probably expecting an
>
> NSString
>
> object, not a normal string (not even a cstring, I don't believe, just
>
> plain
>
> old text in a .txt file).
>
>
It's not expecting some sort of serialized NSString object, if that's
>
what you mean - what you're doing should work with any resource of type
>
text/*. I don't know what would happen if the URL pointed to something
>
other than text, though - for example to a GIF or JPEG image.
>
>
sherm--
>
>
If you listen to a UNIX shell, can you hear the C?
_______________________________________________
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.