Greetings:
    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:

Call graph:
    1922 Thread_2503
      1922 start
        1922 main
          1922 NSApplicationMain
            1922 -[NSApplication run]
              1922 -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
                1922 _DPSNextEvent
                  1922 BlockUntilNextEventMatchingListInMode
                    1922 ReceiveNextEventCommon
                      1922 RunCurrentEventLoopInMode
                        1922 CFRunLoopRunInMode
                          1922 CFRunLoopRunSpecific
                            1922 mach_msg
                              1922 mach_msg_trap
                                1922 mach_msg_trap
    1922 Thread_2603
      1922 thread_start
        1922 _pthread_start
..
..
'
===================================

It's supposed to be SYNCHRONOUS (get data one-time & exit).  Yet I see threads 
dangling.
Question: How can I safely END this routine?  

Code follows:
-----------------


- (IBAction)startSOAP:(id)sender {
    NSError **myError;
    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];

        // -----------------------
        // 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];

        // -----------------------
        // 4)  Convert Synchronous Data into Human-Readable String (Unicode 8) 
format:        
        NSString *serverDataString = [[[NSString alloc] initWithData:serverData 
encoding:NSUTF8StringEncoding] 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.
}

-------

Regards,
Ric.

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to