我收到此错误 [__NSDictionaryI objectAtIndex:]:无法识别的选择器发送到实例
如何逐行读取每行数据。这是我的NSMutableArray。 我需要从这个数组中读取单个代码行数据。
NSMutableArray *result = [obj objectForKey:@"quotes"];
NSLog(@"%@",result);
//dataCenter.currency_array=result;
for (int i=0; i<[result count]; i++) {
NSLog(@"%@",[result objectAtIndex:i]);
NSDictionary* obj = [result objectAtIndex:i];
//[datasource addObject:obj];
NSLog(@"%@",obj);
}
{
USDAED = "3.672304";
USDAFN = "67.503991";
USDALL = "123.503989";
USDAMD = "484.179993";
USDANG = "1.790403";
USDAOA = "165.087006";
USDARS = "15.374041";
USDAUD = "1.333604";
USDAWG = "1.79";
USDAZN = "1.702041";
USDBAM = "1.797804";
USDBBD = 2;
USDBDT = "82.089996";
USDBGN = "1.789404";
USDBHD = "0.376204";
USDBIF = "1700.75";
USDBMD = 1;
USDBND = "1.396804";
USDBOB = "6.890399";
USDBRL = "3.171604";
USDBSD = 1;
USDBTC = "0.000757";
USDBTN = "64.125041";
USDBWP = "10.422504";
USDBYN = "1.870398";
USDBYR = 20020;
USDBZD = "1.997804";
USDCAD = "1.365204";
USDCDF = "1398.949951";
USDCHF = "0.993604";
USDCLF = "0.02487";
USDCLP = "666.429993";
USDCNY = "6.889904";
USDCOP = "2937.300049";
USDCRC = "551.080017";
USDCUC = 1;
USDCUP = "1.00036";
USDCVE = "101.209999";
USDCZK = "24.615999";
USDDJF = "178.000359";
USDDKK = "6.81567";
USDDOP = "47.029999";
USDDZD = "109.047997";
USDEEK = "14.04404";
USDEGP = "18.049999";
USDERN = "15.290392";
USDETB = "22.809999";
USDEUR = "0.917704";
USDFJD = "2.097504";
USDFKP = "0.771604";
USDGBP = "0.77219";
USDGEL = "2.465104";
USDGGP = "0.772237";
USDGHS = "4.173304";
USDGIP = "0.771904";
USDGMD = "44.000355";
USDGNF = "9200.000355";
USDGTQ = "7.33804";
USDGYD = "204.460007";
USDHKD = "7.776604";
USDHNL = "23.350388";
USDHRK = "6.804904";
USDHTG = "67.709999";
USDHUF = "286.959991";
USDIDR = 13327;
USDILS = "3.61904";
USDIMP = "0.772237";
USDINR = "64.269997";
USDIQD = 1181;
USDIRR = "32439.000352";
USDISK = "106.199997";
USDJEP = "0.772237";
USDJMD = "128.130005";
USDJOD = "0.708804";
USDJPY = "111.495003";
USDKES = "102.949997";
USDKGS = "67.474998";
USDKHR = "3984.00035";
USDKMF = "461.790009";
USDKPW = "900.00035";
USDKRW = "1136.369995";
USDKWD = "0.303904";
USDKYD = "0.820383";
USDKZT = "314.51001";
USDLAK = "8194.799805000001";
USDLBP = "1506.699951";
USDLKR = "152.050003";
USDLRD = "91.000348";
USDLSL = "13.371039";
USDLTL = "3.048704";
USDLVL = "0.62055";
USDLYD = "1.407804";
USDMAD = "9.913038999999999";
USDMDL = "19.065001";
USDMGA = "3150.000347";
USDMKD = "56.189999";
USDMMK = "1358.000346";
USDMNT = "2409.000346";
USDMOP = "8.009904000000001";
USDMRO = "357.000346";
USDMUR = "34.669998";
USDMVR = "15.440378";
USDMWK = "717.969971";
USDMXN = "18.809039";
USDMYR = "4.339039";
USDMZN = "70.44000200000001";
USDNAD = "13.335039";
USDNGN = "314.503725";
USDNIO = "29.403722";
USDNOK = "8.583204";
USDNPR = "102.099998";
USDNZD = "1.455704";
USDOMR = "0.384504";
USDPAB = 1;
USDPEN = "3.243104";
USDPGK = "3.283039";
USDPHP = "50.209999";
USDPKR = "104.599998";
USDPLN = "3.878038";
USDPYG = "5558.000341";
USDQAR = "3.640804";
USDRON = "4.156704";
USDRSD = "113.024902";
USDRUB = "56.917038";
USDRWF = "819.02002";
USDSAR = "3.749604";
USDSBD = "7.840604";
USDSCR = "13.334038";
USDSDG = "6.660372";
USDSEK = "8.857404000000001";
USDSGD = "1.396038";
USDSHP = "0.771904";
USDSLL = "7450.000338";
USDSOS = "549.0003380000001";
USDSRD = "7.48037";
USDSTD = "22487.400391";
USDSVC = "8.722038";
USDSYP = "514.97998";
USDSZL = "13.337404";
USDTHB = "34.570369";
USDTJS = "8.477104000000001";
USDTMT = "3.4";
USDTND = "2.414038";
USDTOP = "2.313904";
USDTRY = "3.550604";
USDTTD = "6.709504";
USDTWD = "30.155001";
USDTZS = "2228.000335";
USDUAH = "26.525038";
USDUGX = "3640.899902";
USDUSD = 1;
USDUYU = "28.070367";
USDUZS = "3705.000334";
USDVEF = "9.974504";
USDVND = 22739;
USDVUV = "109.550003";
USDWST = "2.593604";
USDXAF = "601.590027";
USDXAG = "0.058089";
USDXAU = "0.000789";
USDXCD = "2.703604";
USDXDR = "0.729382";
USDXOF = "603.659973";
USDXPF = "108.919998";
USDYER = "249.949997";
USDZAR = "13.361604";
USDZMK = "9.325037";
USDZMW = "9.280362999999999";
USDZWL = "322.355011";
}
我如何阅读单曲。
答案 0 :(得分:1)
你有一个NSDictionary而不是NSArray。 NSDictionary无法处理索引处的对象。
如果您想循环使用NSDictionary,请使用此
for (NSString* key in [result allkeys])
{
float entry = [[result objectForKey:key] floatValue];
// do your stuff here for each entry
}
修改强>
你应该改变这一行
NSMutableArray *result = [obj objectForKey:@"quotes"];
要
NSDictionary *result = [obj objectForKey:@"quotes"];