tags:

views:

39

answers:

1

How can i get data from NSMutabledata which returned by NSConection? Anybody can help me :)

Data's returned by NSConection like :

TOKEN=abcdef

A: 

As the question is tagged iPhone i think you mean NSURLConnection and not NSConnection. My answer is based on that assumption.

You will have to implement the NSURLConnectionDelegate methods and get all the data into an NSMutableData object. I hope you have already done this as you have the NSMutableData.

How to get data in the format you want depends on what type of data is being returned by the connection. If its an XML or JSON you will have to use a parser. An XML parser is available in objective c. If it is a sipmle string, you can directly convert it to a string in your connectionDidFinishLoading delegate method and use it:

NSString *receivedDataString = [[NSString alloc] initWithData:receivedMutableData encoding:NSUTF8StringEncoding];
lukya
Thanks for your help!
leduchuy89vn