How to convert NSArray to NSString in objective-c?
Whereas you are not saying that in NSArray, you can do this:
NSArray *arr = [NSArray arrayWithObjects: @"foo", @"bar", @"baz"]; [arr componentsJoinedByString: @","]
Unlike Frank's method, which works very well, you can also do
NSString *myArrayString = [array description];
By default, the NSArray implementation will print the contents in neatly formatted form.
This is how I converted my NSArray to NSString
NSArray
NSString
NSError *error = nil; NSData *data = [NSJSONSerialization dataWithJSONObject:aArray options:kNilOptions error:&error]; NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
Latest Swift 3.0 Updates
let string = array.componentsJoined(by: ",")
you can use any separator in the function that you want to separate from the array elements in the above example - ",".