• 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: Sherm Pendley <email@hidden>
  • Date: Thu, 13 Feb 2003 10:57:12 -0500

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: Marc Weil <email@hidden>
References: 
 >[NSString stringWithContentsOfURL:] question (From: Marc Weil <email@hidden>)

  • Prev by Date: Re: windowDidLoad
  • Next by Date: Re: [Newbie] NSOutlineView and icons
  • Previous by thread: [NSString stringWithContentsOfURL:] question
  • Next by thread: Re: [NSString stringWithContentsOfURL:] question
  • Index(es):
    • Date
    • Thread