cocoa - Objective-C: NSURLConnection response? -


so i'm new obj-c , i'm trying call web service , receive it's response...

after implementing example in apple docs nsurlconnection, i'm outputting results nslog. check out:

2011-04-30 01:30:24.831 cocoa_sandbox[18424:903] data was: <> 2011-04-30 01:30:25.837 cocoa_sandbox[18424:903] got response: <nshttpurlresponse: 0x100104110> 2011-04-30 01:30:25.838 cocoa_sandbox[18424:903] receieved 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 can see, data <> , received data output <3c3f786d 6c207665 7273696f 6e3d2231 2e30223f 3e3c7265 73706f6e 73653e3c 72657375 6c743e73 75636365 73733c2f 72657375 6c743e3c 2f726573 706f6e73 653e>

my php service echoing xml:

echo '<?xml version="1.0"?><response><result>success</result></response>';

can give me clue?

the response format in nsdata, , can correct me if wrong, that's gets shown if printed nslog. can convert nsstring , see if helps:

nsstring *responsestring = [[nsstring alloc] initwithdata:responsedata encoding:nsutf8stringencoding]; 

Comments