FROM : stephen joseph butler
DATE : Fri May 16 16:53:21 2008
Your code is crashing because you have numerous pointer and memory
management issues.
On Thu, May 15, 2008 at 4:21 PM, <<email_removed>> 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**** EXCEPTION: %@ ****\n",e);
> self.statusLine.stringValue = [NSString stringWithFormat:@"*** Exception flagged: %@ ***",e];
> } @finally {
>
> NSLog(@"\n end.");
> }
>
>
> } // end startSOAP().
>
> // -----------------------------------------------
>
> - (IBAction)terminateSOAP:(id)sender {
> NSLog(@"\n GoodBye.\n");
> [NSApp stop:self]; // <-------- Does not work when above routine was performed.
> }
DATE : Fri May 16 16:53:21 2008
Your code is crashing because you have numerous pointer and memory
management issues.
On Thu, May 15, 2008 at 4:21 PM, <<email_removed>> 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**** EXCEPTION: %@ ****\n",e);
> self.statusLine.stringValue = [NSString stringWithFormat:@"*** Exception flagged: %@ ***",e];
> } @finally {
>
> NSLog(@"\n end.");
> }
>
>
> } // end startSOAP().
>
> // -----------------------------------------------
>
> - (IBAction)terminateSOAP:(id)sender {
> NSLog(@"\n GoodBye.\n");
> [NSApp stop:self]; // <-------- Does not work when above routine was performed.
> }
| Related mails | Author | Date |
|---|---|---|
| fclee | May 15, 23:21 | |
| Jens Alfke | May 16, 02:56 | |
| fclee | May 16, 15:32 | |
| stephen joseph but… | May 16, 16:53 | |
| Frederick C. Lee | May 17, 20:58 | |
| Dominik Pich | May 17, 21:23 |






Cocoa mail archive

