Re: NSURLRequest : Unable to Quit App after Syn call to Server.
Re: NSURLRequest : Unable to Quit App after Syn call to Server.
- Subject: Re: NSURLRequest : Unable to Quit App after Syn call to Server.
- From: "Frederick C. Lee" <email@hidden>
- Date: Sat, 17 May 2008 14:58:18 -0400
Thanks for the editing.
Your help is deeply appreciated!
Ric.
On May 16, 2008, at 10:53 AM, stephen joseph butler wrote:
Your code is crashing because you have numerous pointer and memory
management issues.
On Thu, May 15, 2008 at 4:21 PM, <email@hidden> wrote:
- (IBAction)startSOAP:(id)sender {
NSError **myError;
NSError *myError;
NSHTTPURLResponse **serverResponse;
NSHTTPURLResponse *serverResponse;
NSData *serverData;
@try {
// 1) The Request String. {not used yet}
// Note: smsXMLString contains the entire SMS SOAP envelope,
without the <? XML declaration command >.
NSString *smsXMLPath = [[NSBundle mainBundle]
pathForResource:@"sms" ofType:@"xml"];
self.smsXMLString = [NSString
stringWithContentsOfFile:smsXMLPath encoding:NSUTF8StringEncoding
error:myError];
Use &myError
// -----------------------
// 2) Create the request.
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL
URLWithString:theServerURL]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
// -----------------------
// 3) Get Synchronous Data:
serverData = [NSURLConnection sendSynchronousRequest:theRequest
returningResponse:serverResponse
error:myError];
Again, &myError and &serverResponse
// -----------------------
// 4) Convert Synchronous Data into Human-Readable String
(Unicode 8) format:
NSString *serverDataString = [[[NSString alloc]
initWithData:serverData encoding:NSUTF8StringEncoding] retain];
This is an extra retain.
[[soapResponse layoutManager]replaceTextStorage:
[[NSTextStorage alloc] initWithString:serverDataString]];
[serverDataString release];
} @catch (id e) {
NSLog(@"\n**** {startSOAP} EXCEPTION: %@ ****\n",e);
self.statusLine.stringValue = [NSString
stringWithFormat:@"*** Exception flagged: %@ ***",e];
} @finally {
NSLog(@"\n{startSoap} end.");
}
} // end startSOAP().
// -----------------------------------------------
- (IBAction)terminateSOAP:(id)sender {
NSLog(@"\n{terminateSOAP} GoodBye.\n");
[NSApp stop:self]; // <-------- Does not work when above
routine was performed.
}
_______________________________________________
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