2009-11-17 94 views
3

我正在開發一個應用程序,我必須將自定義聯繫人添加到iPhone聯繫人列表。如何將自定義字段添加到iphone聯繫人列表中的聯繫人信息

詳細說明iPhone中的每個聯繫人都有一組明確的字段,我們可以用它來保存聯繫信息。

我想知道,如果我們能

從iPhone是ofexisting選項添加自定義字段分開。

如果可能的話,請告訴我如何做到這一點,使用Google搜索,但沒有發現任何意義。

在此先感謝。

+0

下面給出的所有解決方案都是jst,用於將詳細信息添加到聯繫人列表。 我想要添加custon字段的幫助 – 2009-11-17 11:05:13

回答

3

this

ABRecordRef aRecord = ABPersonCreate(); 
    CFErrorRef anError = NULL; 
    ABRecordSetValue(aRecord, kABPersonFirstNameProperty, 
        CFSTR("Jijo"), &anError); 
    ABRecordSetValue(aRecord, kABPersonLastNameProperty, 
        CFSTR("Pulikkottil"), &anError); 
    if (anError != NULL) { 

     NSLog(@"error while creating.."); 
    } 
    CFStringRef firstName, lastName; 
    firstName = ABRecordCopyValue(aRecord, kABPersonFirstNameProperty); 
    lastName = ABRecordCopyValue(aRecord, kABPersonLastNameProperty); 




    ABAddressBookRef addressBook; 
    CFErrorRef error = NULL; 
    addressBook = ABAddressBookCreate(); 

    BOOL isAdded = ABAddressBookAddRecord (
          addressBook, 
          aRecord, 
          &error 
    ); 

    if(isAdded){ 

     NSLog(@"added.."); 
    } 
    if (error != NULL) { 
     NSLog(@"ABAddressBookAddRecord %@", error); 
    } 
    error = NULL; 

    BOOL isSaved = ABAddressBookSave (
         addressBook, 
         &error 
    ); 

    if(isSaved){ 

     NSLog(@"saved.."); 
    } 

    if (error != NULL) { 
     NSLog(@"ABAddressBookSave %@", error); 
    } 

    CFRelease(aRecord); 
    CFRelease(firstName); 
    CFRelease(lastName); 
    CFRelease(addressBook); 

如果您需要將數據存儲在那裏,我認爲你唯一的選擇是kABPersonNoteProperty,但我沒有這方面的專家。

編輯:link

答案:不!

編輯:您還可以提示用戶添加地址簿條目完成here

2

這是不可能以編程方式添加自定義字段到iPhone地址簿,甚至在IOS 5

相關問題