iPhone 取得用户的电话本 代码
2010-12-18 08:05:48 来源:WEB开发网values = (ABMultiValueRef) ABRecordCopyValue(personRef , kABPersonPhoneProperty);
//NSLog(@"values===%@",values);
NSString *getPhoneNum;
for(j = 0 ;j < ABMultiValueGetCount(values); j++) {
getPhoneNum = [NSString stringWithFormat:@"%@", (NSString *)ABMultiValueCopyValueAtIndex(values, j)]; }if(ABMultiValueGetCount(values)==0){
getPhoneNum=@"空";
}//NSLog(@"getPhoneNum=====%@",getPhoneNum); // values = (ABMultiValueRef) ABRecordCopyValue(personRef , kABPersonEmailProperty);// for( j = 0 ;j < ABMultiValueGetCount(values); j++)// { // NSLog(@"1-%@", (NSString *)ABMultiValueCopyValueAtIndex(values, j));// // }// // values = (ABMultiValueRef) ABRecordCopyValue(personRef , kABPersonAddressProperty);// for( j = 0 ;j < ABMultiValueGetCount(values); j++)// { // NSLog(@"2-%@", (NSString *)ABMultiValueCopyValueAtIndex(values, j));// // }[jsonDictionary setObject:getPhoneNum forKey:allName] ; //============================================================================== }
//NSLog(@"addressbook=%@",jsonDictionary); NSString *str = [jsonDictionary JSONRepresentation];NSLog(@"str===%@",str); // NSString *d = [str JSONValue];[jsonDictionary release];
// NSString *str = [jsonDictionary JSONRepresentation];// NSMutableDictionary *d = [jsonDictionary JSONValue];// NSLog(@"%@" , [d description]); // [dlist release];//NSLog(@"addressbook=%@",jsonDictionary);}
更多精彩
赞助商链接