• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [NSString stringWithContentsOfURL:] question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: [NSString stringWithContentsOfURL:] question
      • From: Scott Anguish <email@hidden>
References: 
 >Re: [NSString stringWithContentsOfURL:] question (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Drawing a well like DrawThemeGenericWell but with Cocoa or CoreGraphics?
  • Next by Date: Scaling image to fit NSButton
  • Previous by thread: Re: [NSString stringWithContentsOfURL:] question
  • Next by thread: Re: [NSString stringWithContentsOfURL:] question
  • Index(es):
    • Date
    • Thread