Re: What's NSError **?
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.