아이폰 시뮬레이터에서 모든 연락처 정보를 얻고 싶습니다. 이미이 질문과 관련된 다른 질문을 읽었지만 아직 할 수 없습니다. 나는 처음부터 나를 도와 아이폰 프로그래밍에 새로운 사람이다. 모든 것을 단계적으로 정의하는 자습서 링크를 제공하십시오.iphone 시뮬레이터에서 연락처를 얻는 방법
1
A
답변
2
다음 코드.
0
ABAddressBookCopyArrayOfAllPeopleInSource
은 ABPersonRef입니다. 액세스하는 주소록
- (void)viewDidLoad {
[super viewDidLoad];
contactList=[[NSMutableArray alloc] init];
ABAddressBookRef m_addressbook = ABAddressBookCreate();
if (!m_addressbook) {
NSLog(@"opening address book");
}
CFArrayRef allPeople = ABAddressBookCopyArrayOfAllPeople(m_addressbook);
CFIndex nPeople = ABAddressBookGetPersonCount(m_addressbook);
for (int i=0;i < nPeople;i++) {
NSMutableDictionary *dOfPerson=[NSMutableDictionary dictionary];
ABRecordRef ref = CFArrayGetValueAtIndex(allPeople,i);
//For username and surname
ABMultiValueRef phones =(NSString*)ABRecordCopyValue(ref, kABPersonPhoneProperty);
CFStringRef firstName, lastName;
firstName = ABRecordCopyValue(ref, kABPersonFirstNameProperty);
lastName = ABRecordCopyValue(ref, kABPersonLastNameProperty);
[dOfPerson setObject:[NSString stringWithFormat:@"%@ %@", firstName, lastName] forKey:@"name"];
//For Email ids
ABMutableMultiValueRef eMail = ABRecordCopyValue(ref, kABPersonEmailProperty);
if(ABMultiValueGetCount(eMail) > 0) {
[dOfPerson setObject:(NSString *)ABMultiValueCopyValueAtIndex(eMail, 0) forKey:@"email"];
}
//For Phone number
NSString* mobileLabel;
for(CFIndex i = 0; i < ABMultiValueGetCount(phones); i++) {
mobileLabel = (NSString*)ABMultiValueCopyLabelAtIndex(phones, i);
if([mobileLabel isEqualToString:(NSString *)kABPersonPhoneMobileLabel])
{
[dOfPerson setObject:(NSString*)ABMultiValueCopyValueAtIndex(phones, i) forKey:@"Phone"];
}
else if ([mobileLabel isEqualToString:(NSString*)kABPersonPhoneIPhoneLabel])
{
[dOfPerson setObject:(NSString*)ABMultiValueCopyValueAtIndex(phones, i) forKey:@"Phone"];
break ;
}
[contactList addObject:dOfPerson];
CFRelease(ref);
CFRelease(firstName);
CFRelease(lastName);
}
NSLog(@"array is %@",contactList);
}
}
월이 도움이 당신을 위해
CFArrayRef ABAddressBookCopyArrayOfAllPeopleInSource (
ABAddressBookRef addressBook,
ABRecordRef source
);
관련 문제
- 1. 시뮬레이터에서 아이폰의 연락처를 보는 방법
- 2. iPhone 시뮬레이터에서 연락처를 소유자로 설정하는 방법이 있습니까?
- 3. 가져 오는 동안 자신 만의 연락처를 얻는 방법 주소록 Iphone
- 4. iPhone/iPhone 시뮬레이터에서 요청한 URL을 감지하는 방법
- 5. applicationWillResignActive iPhone 시뮬레이터에서 테스트하는 방법
- 6. iPhone 시뮬레이터에서 비디오를 재생하는 방법
- 7. iPhone 시뮬레이터에서 sqlite3 데이터베이스보기
- 8. iPhone 시뮬레이터에서 iOS 앱을여시겠습니까?
- 9. iPhone 시뮬레이터에서 위치 업데이트
- 10. iPhone 시뮬레이터에서 프록시 인증
- 11. 시뮬레이터에서 iPhone 종료
- 12. iphone 시뮬레이터에서 실행 완료되었습니다.
- 13. iphone 시뮬레이터에서 메일 수신
- 14. iPhone 시뮬레이터에서 인터넷 연결 테스트
- 15. iPhone 시뮬레이터에서 수행되는 작업을 자동화하는 방법은 무엇입니까?
- 16. iPad 시뮬레이터에서 iPhone 앱을 실행하는 방법
- 17. iPhone 시뮬레이터에서 위치 탐지를 켜는 방법
- 18. iphone 시뮬레이터에서 주석 추가 테스트 방법
- 19. iPhone 시뮬레이터에서 앞면과 뒷면을 시뮬레이트하는 방법
- 20. 안드로이드에있는 Whatsapp 그룹에서 연락처를 얻는 방법?
- 21. PHP로 사진과 함께 Gmail 연락처를 얻는 방법
- 22. angularjs에서 google plus 연락처를 얻는 방법
- 23. 이미지 연락처를 얻는 가장 좋은 방법
- 24. MonoTouch C#을 사용하여 프로그래밍 방식으로 연락처를 얻는 방법?
- 25. iphone PhoneBook의 모든 연락처를 변수에로드하십시오.
- 26. iphone 주소록 연락처를 가져 오십시오.
- 27. iPhone 시뮬레이터에서 NSUserDefaults가 계속 충돌합니다.
- 28. 이미지가 iPhone 시뮬레이터에서 변경되지 않습니다.
- 29. iPhone 시뮬레이터에서 전화 통화 시뮬레이션
- 30. iPhone 시뮬레이터에서 .app 파일 실행