2011-07-29 5 views

答えて

0

あなたがプログラムで連絡先にアクセスし、ABAddressBook.frameworkを使用して編集することができます。

http://developer.apple.com/library/mac/#documentation/userexperience/Reference/AddressBook/Classes/ABAddressBook_Class/Reference/Reference.html

を、ここでプログラミングガイドは::

あなたはここにドキュメントを見つけることができます

http://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Introduction.html

+0

はい、これは可能ですが、シナリオがあるというとき、APPにおけるユーザーのタオスの接触それは彼が英国に属しているかどうかを彼に尋ねるでしょう。彼ははいを選択します。既存の連絡先の前に+49を付けるべきですが、 bネイティブのcontact.theコンタクトリストは同じでなければなりません。しかし、APP内でのみ、+49を追加する必要があります。 – user857280

+0

あなたは完全にリンクを勉強すれば、コンタクトにアクセスして番号を追加する方法を見つけるでしょうそれはあなたのアプリの中だけにユーザーに表示される前に。しかし、連絡先を表示するための独自のビューが必要になります。人ピッカーを使用することはできません。または、あなたのアプリでアドレス帳をコピーし、希望の接頭辞を追加することができます。 –

+0

私はアプリ内の連絡先を維持していません。私はネイティブのcontact.iにアクセスしています。APPを呼び出すときに+49を追加したいのですが、番号を変更しないでください... – user857280

1
-(void)showPersonViewController:(NSString *)nameInContact 
{ 
    // Fetch the address book 
    ABAddressBookRef addressBook = ABAddressBookCreate(); 
    // Search for the person in the address book 
    NSArray *people = (NSArray *)ABAddressBookCopyPeopleWithName(addressBook, CFSTR(nameInContact)); 
    // Display the information if found in the address book 
    if ((people != nil) && [people count]) 
    { 
     ABRecordRef person = (ABRecordRef)[people objectAtIndex:0]; 
     ABPersonViewController *picker = [[[ABPersonViewController alloc] init] autorelease]; 
     picker.personViewDelegate = self; 
     picker.displayedPerson = person; 
     // Allow users to edit the person’s information 
     picker.allowsEditing = YES; 
     [self.navigationController pushViewController:picker animated:YES]; 
    } 
    else 
    { 
     // Show an alert if the person is not in Contacts 
     UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" 
                 message:[NSString stringWithFormat:@"Could not find %@ in the Contacts application", nameInContact] 
                 delegate:nil 
               cancelButtonTitle:@"Cancel" 
               otherButtonTitles:nil]; 
     [alert show]; 
     [alert release]; 
    } 

    [people release]; 
    CFRelease(addressBook); 
} 
関連する問題