Hi there,

I'm running into a problem with NSURLConnection and I can't solve it, any help greatly appreciated.

in my main (Shared Instance) class i have the following code to post crash logs:

- (IBAction)test:(id)sender{

        [self sendLogs];
}

- (void)sendLogs
{
        NSMutableString* logsPath = [[NSMutableString alloc]init];
        [logsPath appendString:[[NSBundle mainBundle]bundlePath]];
        [logsPath appendString:@"/Contents/logs/"];
        NSDate *currentDate = [NSDate date];
NSString * theTime = [[currentDate dateWithCalendarFormat:@"%Y-%m-%d %H:%M:%S" timeZone:[NSTimeZone localTimeZone]]description];
        NSFileManager *manager = [NSFileManager defaultManager];
        bool doesTheLogsFolderExist = [manager fileExistsAtPath:logsPath];
        NSMutableString * theDate = [[NSMutableString alloc]init];
        [theDate appendString:@"error_"];
[theDate appendString:[[currentDate dateWithCalendarFormat:@"%d_%m_ %Y" timeZone:[NSTimeZone localTimeZone]]description]];
        [theDate appendString:@".log"];
        [logsPath appendString:theDate];
NSString* theXmlAsString = [NSString stringWithContentsOfFile:logsPath encoding:NSUTF8StringEncoding error:NULL]; NSXMLDocument* theLogsXmlData = [[NSXMLDocument alloc] initWithXMLString:theXmlAsString options:NSXMLDocumentTidyHTML error:nil]; NSString* content = [@"xmlData=" stringByAppendingString: [theLogsXmlData XMLString]]; NSURL* url = [NSURL URLWithString:@"http://www.theappstore.net/support/logs_reports.php "]; NSMutableURLRequest* urlRequest = [[NSMutableURLRequest alloc] initWithURL:url];
        [urlRequest setHTTPMethod:@"POST"];
[urlRequest setHTTPBody:[content dataUsingEncoding:NSUTF8StringEncoding]]; NSURLConnection *connectionResponse = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
}

- (void)connection:(NSURLConnection *)connection didReceiveData: (NSData *)data

{
NSString* thhhe = [[NSString alloc]initWithData:data encoding:NSASCIIStringEncoding];
}

Now if I place a button on my interface and call test everything is fine, the post is submitted and the delegate method is called. Suffice I call the test method from another class and nothing gets posted (break points show me the sendLogs method is indeed called), the didReceiveData method is not called either. I've looked into adding the NSURLConnection into an array so it wouldn't be scraped, created a separate send class just for the post etc. to no avail, I really don't know what I'm doing wrong.

Any help very much appreciated.

Micha
_______________________________________________

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