NSURLConnection crash on POST

Mark Christian mchristian at v1labs.com
Tue Sep 4 11:48:57 PDT 2007


Hi, folks;
I've got a weird crash that's driving me crazy. Hopefully someone out  
there can shed some light on the situation.

I have a method that navigates a WebView to a particular URL.  
Sometimes, it posts data along with the request, sometimes not. The  
POST data is sorted in an NSData called pendingData, and the function  
looks something like this:


	if (pendingData == nil) {
		//	Simple request
		urlRequest = [NSURLRequest requestWithURL:url];
	} else {
		//	POST request
		urlRequest = [NSMutableURLRequest requestWithURL:url];
		[urlRequest setHTTPMethod:@"POST"];
		
		//	Encode data
		//	(snipped)
	}
	
	[self loadURLRequest:urlRequest];

In the case where pendingData is nil, everything works perfectly. In  
the case where it's not nil, I get an NSURLConnection. My POST data  
encoding definitely works, because it has worked in the past --  
something else got broken. Just setting the HTTP method to "POST" is  
enough to cause the crash.

Here's the crash log:
#0  0x90a594c7 in objc_msgSend ()
#1  0xbfffe9e8 in ?? ()
#2  0x92859ee4 in -[NSURLConnection(NSURLConnectionInternal)  
_sendCallbacks] ()
#3  0x92859ab5 in _sendCallbacks ()
#4  0x9082cf92 in CFRunLoopRunSpecific ()
#5  0x9082cace in CFRunLoopRunInMode ()
#6  0x92ded8d8 in RunCurrentEventLoopInMode ()
#7  0x92decfe2 in ReceiveNextEventCommon ()
#8  0x92dece39 in BlockUntilNextEventMatchingListInMode ()
#9  0x93293465 in _DPSNextEvent ()
#10 0x93293056 in -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#11 0x9328cddb in -[NSApplication run] ()
#12 0x93280d2f in NSApplicationMain ()
#13 0x0000231e in main (argc=1, argv=0xbffff88c) at /Users/mark/Work/ 
Provisioning/Macintosh/trunk/Provisioning Wizard/main.m:31

If anyone out there can help, I'd be really appreciative. Thank you  
in advance;
Mark


More information about the MacOSX-dev mailing list