NSMutableArray *jsonArray = [[NSMutableArray alloc] init];
NSArray *json1 = [NSJSONSerialization JSONObjectWithData:data1 ...];
if (json1 != nil) {
[jsonArray addObjectsFromArray:json1];
} else {
// JSON error in data1
}
NSArray *json2 = [NSJSONSerialization JSONObjectWithData:data2 ...];
if (json2 != nil) {
[jsonArray addObjectsFromArray:json2];
} else {
// JSON error in data2
}
Add two NSJSONSerialization objects to a singular NSMutableArray
-
30-06-2022 - |
Question
I have one NSMutableArray
that a UITableView
pulls data from. I'd like to add two [NSJSONSerialization JSONObjectWithData:data]
to this singular array. Doing the following only replaces the information previously added to the array, I want to add the new request below.
jsonArray = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow