• 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: What's NSError **?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's NSError **?


  • Subject: Re: What's NSError **?
  • From: James Spencer <email@hidden>
  • Date: Thu, 13 Nov 2003 20:06:53 -0600

On Nov 13, 2003, at 1:24 PM, Jason McInnes wrote:

OK, another fundamental question which I should know
the answer to, but...I'm new.

Anyway, the method declaration
+ (NSData *)sendSynchronousRequest:(NSURLRequest
*)request returningResponse:(NSURLResponse **)response
error:(NSError **)error

calls for an NSError ** and an NSURLResponse **...

Are these handles (pointers to pointers)? How do I
allocate those in Objective C?

I am assuming that when I call sendSynchronousRequest
I have to pass in allocated objects, rather than
unallocated handles. (I tried sending in unallocated
handles and got a bad access error.)

Since sendSynchronousReponse is supposed to set the
response and error by reference if necessary, how do I
construct the objects to pass in?


You don't construct the objects, you merely pass references to where you want NSURLConnection to put the objects it will create as necessary. When it creates one of these objects, what it will return to you is a pointer to that object. In order to do so, it needs a pointer to the place to put that pointer:

NSURLResponse *theResponse;
NSError *theError;
NSData *theData;
...
[NSURLConnection sendSynchronousRequest:theRequest
returningResponse:&theResponse
error:&theError];

Spence

James P. Spencer
Rochester, MN

email@hidden

"Badges?? We don't need no stinkin badges!"
_______________________________________________
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.

References: 
 >What's NSError **? (From: Jason McInnes <email@hidden>)

  • Prev by Date: Re: Two dimensional array
  • Next by Date: Re: Two dimensional array
  • Previous by thread: What's NSError **?
  • Next by thread: Re: What's NSError **?
  • Index(es):
    • Date
    • Thread