• 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: NSMutableURLRequest weirdness!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableURLRequest weirdness!


  • Subject: Re: NSMutableURLRequest weirdness!
  • From: Ammar Ibrahim <email@hidden>
  • Date: Fri, 5 Jun 2009 03:20:29 +0300

On Fri, Jun 5, 2009 at 3:16 AM, Shawn Erickson <email@hidden> wrote:

> On Thu, Jun 4, 2009 at 4:44 PM, Ammar Ibrahim <email@hidden>
> wrote:
>
> > Excuse me for the silly question. But I'm going to be doing hundreds of
> > requests, and I have GC ON, how do I create these connections and retain
> > them?
>
> Not sure I understand the question but as a guess...
>
> Put them in an NSMutableArray or NSMutableSet if you need to keep
> track of them? Also don't forget that the delegate methods get passed
> a pointer to the connection sending the delegate message.
>

This is exactly what I did as shown in the code snippets below.
"connections" is a class instance of an NSMutableArray. Does this seems
correct? What's so weird is that I get a log on my HTTP server that the same
URL is being called twice!


NSMutableURLRequest *newReqGet = [[NSMutableURLRequest alloc] init];

[newReqGet setHTTPMethod:@"GET"];

[newReqGet setURL:[NSURL URLWithString:[@"/media"
stringByAppendingPathComponent:[currentTrack objectForKey:@"Persistent ID"]]
relativeToURL:[self serverBaseUrl]]];

 NSURLConnection *getConnection = [[NSURLConnection alloc]
initWithRequest:newReqGet
delegate:self startImmediately:YES];

 if (getConnection == nil) {

//connection couldn't be created!

NSLog(@"Connection couldn't be created: %@", [newReqGet URL]);

 [self startSyncAfterTimeInterval];

} else {

[connections addObject:getConnection];

}
_______________________________________________

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: 
 >NSMutableURLRequest weirdness! (From: Ammar Ibrahim <email@hidden>)
 >Re: NSMutableURLRequest weirdness! (From: Keary Suska <email@hidden>)
 >Re: NSMutableURLRequest weirdness! (From: Ammar Ibrahim <email@hidden>)
 >Re: NSMutableURLRequest weirdness! (From: Mike Abdullah <email@hidden>)
 >Re: NSMutableURLRequest weirdness! (From: Ammar Ibrahim <email@hidden>)
 >Re: NSMutableURLRequest weirdness! (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: NSMutableURLRequest weirdness!
  • Next by Date: Help Book: "Ask a Question" Fails
  • Previous by thread: Re: NSMutableURLRequest weirdness!
  • Next by thread: Re: NSMutableURLRequest weirdness!
  • Index(es):
    • Date
    • Thread