• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSURLConnection doesn't post
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURLConnection doesn't post


  • Subject: NSURLConnection doesn't post
  • From: Micha Fuhrmann <email@hidden>
  • Date: Thu, 10 Apr 2008 14:27:37 +0200

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 (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


  • Follow-Ups:
    • Re: NSURLConnection doesn't post
      • From: Matt Burnett <email@hidden>
    • Re: NSURLConnection doesn't post
      • From: "Tom Harrington" <email@hidden>
    • Re: NSURLConnection doesn't post
      • From: Michael Vannorsdel <email@hidden>
    • Re: NSURLConnection doesn't post
      • From: Michael Vannorsdel <email@hidden>
  • Prev by Date: Re: some questions about creating image thumbnails
  • Next by Date: Re: Capture youtube image in webview
  • Previous by thread: Re: NSString value mangled in NSDictionary with Garbage Collection
  • Next by thread: Re: NSURLConnection doesn't post
  • Index(es):
    • Date
    • Thread