So I’m new to Obj-C and I’m trying to call a web service and receive it’s response…
After implementing the example in the Apple docs for NSURLConnection, I’m outputting my results to NSLog. Check this out:
2011-04-30 01:30:24.831 Cocoa_Sandbox[18424:903] The data was: <>
2011-04-30 01:30:25.837 Cocoa_Sandbox[18424:903] Got the response: <NSHTTPURLResponse: 0x100104110>
2011-04-30 01:30:25.838 Cocoa_Sandbox[18424:903] Receieved the data: <3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c7265 73706f6e 73653e3c 72657375 6c743e73 75636365 73733c2f 72657375 6c743e3c 2f726573 706f6e73 653e>
2011-04-30 01:30:25.838 Cocoa_Sandbox[18424:903] Connection finished loading.
As you can see, the data is <> and the received data output is <3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c7265 73706f6e 73653e3c 72657375 6c743e73 75636365 73733c2f 72657375 6c743e3c 2f726573 706f6e73 653e>
My PHP service is just echoing some XML:
echo '<?xml version="1.0"?><response><result>success</result></response>';
Can someone give me a clue?
The response format is in
NSData, and someone can correct me if I am wrong, but that’s what gets shown if printed withNSLog. You can convert it to anNSStringlike this and see if it helps: