• 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: NSURLConnection failing [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSURLConnection failing [SOLVED]


  • Subject: Re: NSURLConnection failing [SOLVED]
  • From: Nir Soffer <email@hidden>
  • Date: Tue, 26 Feb 2008 23:14:07 +0200


On Feb 25, 2008, at 18:18, Doug Penny wrote:

 NSURLConnection *imageConnection = [[NSURLConnection alloc]
 initWithRequest:request

                                     delegate:self];

 if (!imageConnection) {
    NSLog(@"A problem was encountered while trying to download an
 image from %@", imageURL);
 }


[sniped]

Turns out garbage collection was doing me in.  When the
NSURLConnection object was hanging out waiting for a response, it
would get collected.  To work around this, after creating the
NSURLConnection object I just stick it in a NSMutableSet.  When the
delegate gets the -connectionDidFinishLoading: message I remove the
connection object from the set.  Works great now.

Any object you create on the stack will be gone when the method is finished :-)


You must keep a reference to the connection.


Best Regards,

Nir Soffer

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Re: NSURLConnection failing [SOLVED] (From: "Doug Penny" <email@hidden>)

  • Prev by Date: Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item
  • Next by Date: Re: - outlineView:willDisplayCell:forTableColumn:item: and selected item
  • Previous by thread: Re: NSURLConnection failing [SOLVED]
  • Next by thread: Does NSStream's SSL or TLS support work?
  • Index(es):
    • Date
    • Thread