ios - Separate a String By Semicolon -


i using following code separate string multiple strings , getting error

nsarray *arr = [randomstr componentsseparatedbystring:@";"]; 

error:

-[__nsdictionarym componentsseparatedbystring:]: unrecognized selector sent instance 0x1758f230 -[__nsdictionarym componentsseparatedbystring:]: unrecognized selector sent instance 0x1758f230

this sample data

nsarray *data = {     {     name = "name1";     address = "rwp";     id = 0; },     {     name = "name2";     address = "rwp";     id = 1; },     {     name = "name3";     address = "rwp";     id = 2; },}  nsstring *randomstr = data[0]; 

what's wrong in code

you have array of dictionaries, not strings. there nothing split.

you want this:

nsdictionary *dict = data[0]; nsstring *name = dict[@"name"]; nsstring *address = dict[@"address"]; 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -