WEB开发网
开发学院手机开发iPhone 开发 iPhone 取得用户的电话本 代码 阅读

iPhone 取得用户的电话本 代码

 2010-12-18 08:05:48 来源:WEB开发网   
核心提示:values = (ABMultiValueRef) ABRecordCopyValue(personRef , kABPersonPhoneProperty);//NSLog(@"values===%@",values);NSString *getPhoneNum;for(j = 0 ;j <

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);}

上一页  1 2 

Tags:iPhone 取得 用户

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接