Reputation: 403
Suppose I have the following code:
...
var data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil];
NSLog.trace(@"getdData:" + [data rawString]);
...
How do I convert the content of [data rawString] to a string (NSString)?
How do I convert the content of [data rawString] to an array (NSArray)?
Upvotes: 0
Views: 254
Reputation: 8482
To convert the data into a string, have a look at the – initWithBytes:length:encoding:
method of NSString
.
With arrays, this is a bit more difficult, since there is no standard definition of what an array is. So it depends on the data format you are using. If it's JSON take a look here.
Upvotes: 1