亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        iPhone取得用戶的電話本代碼

        字號:


            //取得用戶的電話本 代碼
            -(void)getUserAddressBook{
            //reDic = {"7":"數(shù)碼先鋒","1":"最愛街拍"} //打開電話本數(shù)據(jù)庫
            ABAddressBookRef addressRef=ABAddressBookCreate();
            //返回所有聯(lián)系人到一個數(shù)組中
            CFArrayRef personArray = ABAddressBookCopyArrayOfAllPeople(addressRef);
            NSMutableDictionary *jsonDictionary = [[NSMutableDictionary alloc]init];
            //循環(huán)讀取每個聯(lián)系人
            for (int i =0;i< p>
            //得到當前聯(lián)系人
            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(@"); //用于循環(huán)計數(shù) int j; //用于保存有多項的屬性值 ABMultiValueRef values ; //==============================================================================
            //循環(huán)讀出該項的所有值,如果需要修改讀出其它具有多項值的屬性,只需修改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(@");}