2014-02-07 3 views
0

iPad의 사용자 연락처에서 홈페이지/웹 사이트에 액세스하려고합니다. Adobe Air 용 기본 확장 프로그램으로 사용되는 기존 스크립트를 수정하려고합니다. - https://github.com/memeller/ContactEditor/blob/master/ContactEditorXCode/ContactEditor.m연락처에서 kABPersonHomePageLabel 읽기

저는 Objective-C/xCode에 새로운 기능을 제공하므로이 여분의 필드가 반환되는 데 어려움을 겪고 있습니다. 너 좀 도와 줄 수있어?

FREObject homepagesArray = NULL; 
FRENewObject((const uint8_t*)"Array", 0, NULL, &homepagesArray, nil); 
ABMultiValueRef homepages = ABRecordCopyValue(person, kABPersonHomePageLabel); 
if(homepages) 
{ 
    for (CFIndex k=0; k < ABMultiValueGetCount(homepages); k++) { 
     NSString* homepage = (__bridge NSString*)ABMultiValueCopyValueAtIndex(homepages, k); 
     DLog(@"Adding homepage: %@",homepage); 
     FRENewObjectFromUTF8(strlen([homepage UTF8String])+1, (const uint8_t*)[homepage UTF8String], &retStr); 
     FRESetArrayElementAt(homepagesArray, k, retStr); 
     //[email release]; 
    } 
    CFRelease(homepages); 
    FRESetObjectProperty(contact, (const uint8_t*)"homepages", homepagesArray, NULL); 
} 
else 
    FRESetObjectProperty(contact, (const uint8_t*)"homepages", NULL, NULL); 
retStr=NULL; 

답변

0

ABMultiValueRef homepages을 추출 할 때 잘못된 식별자를 사용하고 있습니다. kABPersonHomePageLabel 대신 kABPersonURLProperty 식별자를 사용하십시오.

ABMultiValueRef webpages = ABRecordCopyValue(person, kABPersonURLProperty); 

// Then iterate thru webpages to get the homepage 
for (CFIndex k=0; k < ABMultiValueGetCount(webpages); k++) 
{ 
    // Your code here 
} 
+0

완벽한 감사! – colouredFunk