足球游戏_中国足彩网¥体育资讯$

iphone取得用户的电话本代码
来源:易贤网 阅读:598 次 日期:2015-03-12 14:19:54
温馨提示:易贤网小编为您整理了“iphone取得用户的电话本代码”,方便广大网友查阅!

//取得用户的电话本 代码

-(void)getuseraddressbook{

//redic = {7:数码先锋,1:最爱街拍} //打开电话本数据库

abaddressbookref addressref=abaddressbookcreate();

//返回所有联系人到一个数组中

cfarrayref personarray = abaddressbookcopyarrayofallpeople(addressref);

nsmutabledictionary *jsondictionary = [[nsmutabledictionary alloc]init];

//循环读取每个联系人

for (int i =0;i< p>

//得到当前联系人

abrecordref personref=cfarraygetvalueatindex(personarray, i); //==============================================================================

cfstringref firstname=abrecordcopyvalue(personref, kabpersonfirstnameproperty);

cfstringref lastname=abrecordcopyvalue(personref, kabpersonlastnameproperty);

//cfstringref userphone = abrecordcopyvalue(personref,kabpersonphoneproperty );

nsstring *allname;if([firstname isequaltostring:@]||firstname==nil){if([lastname isequaltostring:@]||lastname==nil){

allname=@空;

}

}else if([lastname isequaltostring:@]||lastname==nil){allname=[nsstring stringwithformat:@];

}else if([firstname isequaltostring:@]||firstname==nil){allname=[nsstring stringwithformat:@>];

}else{

allname=[nsstring stringwithformat:@];

} // nslog(@); //============================================================================== // nslog(@); //用于循环计数 int j; //用于保存有多项的属性值 abmultivalueref values ; //==============================================================================

//循环读出该项的所有值,如果需要修改读出其它具有多项值的属性,只需修改kab...property //具有多项值的属性有电话,地址,email

values = (abmultivalueref) abrecordcopyvalue(personref , kabpersonphoneproperty);

//nslog(@);

nsstring *getphonenum;

for(j = 0 ;j < abmultivaluegetcount(values); j++) {

getphonenum = [nsstring stringwithformat:@%@, (nsstring *)abmultivaluecopyvalueatindex(values, j)]; }if(abmultivaluegetcount(values)==0){

getphonenum=@空;

}//nslog(@); // 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(@); nsstring *str = [jsondictionary jsonrepresentation];nslog(@); // nsstring *d = [str jsonvalue];[jsondictionary release];

// nsstring *str = [jsondictionary jsonrepresentation];// nsmutabledictionary *d = [jsondictionary jsonvalue];// nslog(@%@ , [d description]); // [dlist release];//nslog(@);}

中国足彩网信息请查看IT技术专栏

中国足彩网信息请查看技术文章
易贤网手机网站地址:iphone取得用户的电话本代码
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
关于我们 | 联系我们 | 人才招聘 | 网站声明 | 网站帮助 | 非正式的简要咨询 | 简要咨询须知 | 加入群交流 | 手机站点 | 投诉建议
工业和信息化部备案号:滇ICP备2023014141号-1 足球游戏_中国足彩网¥体育资讯$ 滇公网安备53010202001879号 人力资源服务许可证:(云)人服证字(2023)第0102001523号
云南网警备案专用图标
联系电话:0871-65317125(9:00—18:00) 获取招聘考试信息及咨询关注公众号:hfpxwx
咨询QQ:526150442(9:00—18:00)版权所有:易贤网
云南网警报警专用图标