in my app, the users can create groups. When a user creates a group, a new folder is uploaded on dropbox, and inside there is a JSON file like this:
{"group":"0864798478"}
The code you see is generated randomly in the following way:
NSString *randomKey = [NSString stringWithFormat:@"%0.10u", arc4random()];
Then I have a table view which displays all the folders (groups). But I would like the UITableView to display only the groups which mach with the codes the iPad has saved on.
So if I have:
{"group a":"0864797073"}
{"group b":"0764898478"}
{"group c":"2864758479"}
And on the iPad there is a file containing the code:
0864797073 (group a)
The table View displays only that group, not all.
How can I do this??
Thanks in advance for the help!!
You can use JSONKit or SBJson for parse JSON files and obtain NSDictionaries with the data. Then you can create a NSDictionary in wich you could save the result of comparing previous dictionaries, an then show the result in the table with method tableView:cellForRowAtIndexPath. OR, make the comparison in the method tableView:cellForRowAtIndexPath. Good Luck!
EDIT:
If the file reads:
You parse it and get a dictionary like in wich “group a” will be the KEY and the NSString “0864797073” will be the value. So to compare the dictionary wich holds group a with wich holds group b you have to do:
Where firstParsedJson and secondParsedJason are NSDictionaries that represent parsed json with, for example, SBJson.