Re: NSURLRequest : Unable to Quit App after Syn call to Server. SOLVED???
Re: NSURLRequest : Unable to Quit App after Syn call to Server. SOLVED???
- Subject: Re: NSURLRequest : Unable to Quit App after Syn call to Server. SOLVED???
- From: email@hidden
- Date: Fri, 16 May 2008 07:32:56 -0700 (PDT)
I needed to modify the default 'GET' Response of the NSURLRequest to a 'POST'...
So I changed 'NSURLRequest' to a 'NSMutableURLRequest' to modify the HTTPMethod:
// -----------------------
// 2) Create the request.
NSMutableURLRequest *theRequest=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:theServerURL]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
// -----------------------
// 2a) Modify the Request from default 'GET' to 'POST':
[theRequest setHTTPMethod:@"POST"];
====
Now, I can QUIT (via [NSAPP Terminate:self] without residual errors, etc.
I'm not sure why...
..but it <appears to be> "solved".
Ric.
On 05/16/2008 06:32 email@hidden wrote ..
> On 05/15/2008 17:56 Jens Alfke wrote ..
>
> "...You should call [NSApp terminate: self] instead. "
>
> I did that; and repeated it.
>
> I'm running in debug mode. The program "works" till I QUIT via [NSApp terminate:self].
>
> Now I'm getting (via gdb console {Running as a Cocoa App on my MacBookPro):
>
> Running
> 2008-05-16 09:18:52.868 iPhoneSOAP (Cocoa version)[553:817]
> {AppDelegate} startSOAP start
> 2008-05-16 09:18:53.079 iPhoneSOAP (Cocoa version)[553:817]
> {startSoap} end.
> Program received signal: EXC_BAD_ACCESS.
> (gdb)
>
> Here's a piece of the Error Report:
> ..
> Date/Time: 2008-05-16 09:33:54.449 -0400
> OS Version: Mac OS X 10.5.2 (9C7010)
> Report Version: 6
>
> Exception Type: EXC_BAD_ACCESS (SIGBUS)
> Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000010
> Crashed Thread: 0
> ..
>
> I don't know why this is happening; of course I'm suspecting the SYNCHRONOUS connection
> to the server is the source...
>
> Does NSURLRequest need to be CLOSED before exit?
> I don't remember seeing NSURLRequest closer in the doc.
>
> Any ideas/remedies for the EXC_BAD_ACCESS (SIGBUS)?
>
> Ric.
>
>
>
> On 05/15/2008 17:56 Jens Alfke wrote ..
> >
> > On 15 May '08, at 2:21 PM, email@hidden wrote:
> >
> > > The Cocoa code below "works". I get data back from the server.
> > > However, I'm unable to QUIT this application after this particular
> > > routine passes through. I checked the Activity Monitor and can see
> > > a bunch of threads still in session:
> >
> > That's expected, and not a problem. CFNetwork uses a background thread
> > to perform its I/O.
> >
> > > [NSApp stop:self]; // <-------- Does not work when above
> > > routine was performed.
> >
> > That's your problem. You should call [NSApp terminate: self] instead.
> > Although you shouldn't even need that the standard Quit menu command
> > is already bound to that action.
> >
> > Jens
_______________________________________________
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