Ios 如何访问objective c中的数组值?

Ios 如何访问objective c中的数组值?,ios,objective-c,arrays,json,uitableview,Ios,Objective C,Arrays,Json,Uitableview,phonenumber值为 ( ( 9834677334 ), ( 9977655456 ), ( 9976367777 ), ( 9654567877 ), ( 9834777347 ), ( 9994157837 ), ( 9978855544 ), ( 9873667378 ) ) 代码 我已经获取了所有的联系人记录…我得到了上面提到的电话号码值,我的问题是,我

phonenumber值为

(
    (
    9834677334
),
    (
    9977655456
),
    (
    9976367777
),
    (
    9654567877
),
    (
    9834777347
),
    (
    9994157837
),
    (
    9978855544
),
    (
    9873667378
)
)
代码


我已经获取了所有的联系人记录…我得到了上面提到的电话号码值,我的问题是,我不知道如何访问数组值…当我尝试将其存储为数组并填充到tableview中时,我得到了一个错误,我只能访问第一个值。有人能帮助我如何访问并填充到tableview中吗

NSString * items = [[contact.phoneNumbers valueForKey:@"value"] valueForKey:@"digits"]; 
NSLog(@"The phone value is %@",items); 
[phonenumber addObject:items]; 
删除电话号码中的特殊字符
()
,将字符串附加到
phonenumber
数组并填充到表中

例如

NSString * items = [[contact.phoneNumbers valueForKey:@"value"] valueForKey:@"digits"]; 
NSCharacterSet *filterstr = [[NSCharacterSet characterSetWithCharactersInString:@"1234567890"] invertedSet];
NSString *resultString = [[items componentsSeparatedByCharactersInSet:filterstr] componentsJoinedByString:@""];
[phonenumber addObject:items]; 
.... continue your same work ...
您得到的电话号码数组如下所示


我只能访问第一个值-->您获得第0个索引,显示您尝试过的代码共享一些您尝试过的代码。-(无效)parseContactWithContact:(CNContact*)联系人{NSString*firstName=contact.givenName;NSLog(@“firstName值为%@”,firstName);[tableData addObject:firstName];NSString*items=[[contact.phoneNumbers valueForKey:@“value”]valueForKey:@“digits”];NSLog(@“电话值为%@”,items);[phonenumber addObject:items];NSString*email=[contact.emailAddresses valueForKey:@“value”];NSLog(@“电子邮件值为%@”,email);NSArray*addrar=[self parseAddressWithContac:contact];]@M.Kavitha-在您使用此
电话号码的地方,显示一些附加代码,同时打印此
NSLog(@“电话值为%@”,项目);
此代码不起作用….***由于未捕获的异常“NSInvalidArgumentException”终止应用程序,原因:'-[\u nsarayi组件由字符分离设置:]:无法识别的选择器发送到实例0x7fbe80e03000'@M.Kavitha-哈哈哈,我知道,你能打印这个
NSLog(@“电话值是%@”,items)
项目值是(9834677334)@M.Kavitha-如果你得到的结果是
(9834677334)
,我的代码肯定能工作100%以上对不起,我不能工作…NSString*resultString=[[items ComponentSeparatedByCharactersSet:filterstr]componentsJoinedByString:@”“];…这里我得到了UIKit错误
NSString * items = [[contact.phoneNumbers valueForKey:@"value"] valueForKey:@"digits"]; 
NSCharacterSet *filterstr = [[NSCharacterSet characterSetWithCharactersInString:@"1234567890"] invertedSet];
NSString *resultString = [[items componentsSeparatedByCharactersInSet:filterstr] componentsJoinedByString:@""];
[phonenumber addObject:items]; 
.... continue your same work ...