Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: How to get owners email address?

Tags:

ios

iphone

In iOS, how can I read the owners email adresses that are stored in the iPhone? In my app, I'd like to let the user choose which email address he would like to associate with a custom service. On Android, I would let him choose his GMail address, but on iOS, there seems to be no option to get the apple id email, right? So is there any possibility to retrieve all stored email addresses and let the user choose one of them? I really need an email address. A unique id, device id or similar won't work with what I'd like to achieve.

Thanks

like image 772
1FpGLLjZSZMx6k Avatar asked Feb 23 '12 08:02

1FpGLLjZSZMx6k


People also ask

How do I find previous Apple ID owners?

You cannot get it from Apple or anyone here. You would need to get in touch with the previous owner either through the person you purchased the phone from, or you cannot. Privacy issues prohibit Apple or the cellular carrier from releasing any of that information.

How do I add my own email domain to my iPhone?

Add a custom email domain you already own to iCloud MailGo to Settings > [your name] > iCloud > iCloud Mail, then make sure “Use on this iPhone” is turned on. Tap Custom Email Domain. Follow the onscreen instructions, or tap Add a Domain You Own. Follow the onscreen instructions to finish setting up your domain.

How do I use Apple hidden email?

In Mail: (macOS 12.1 or later) Open a new message window. In the From field, click the pop-up menu and choose Hide My Email. In System Preferences: Click Apple ID, click iCloud in the sidebar, then click Options next to Hide My Email. You can see and manage all your unique, random addresses.


2 Answers

Why not present the address book and let the user choose and email address?

Add the AddressBook and AddressBookUI frameworks to your project. Import them in your .h and add the protocol ABPeoplePickerNavigationControllerDelegate.

Then call the adress book:

- (void) chooseContact:(id)sender {
    ABPeoplePickerNavigationController *picker = [[ABPeoplePickerNavigationController alloc] init];
    picker.peoplePickerDelegate = self;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

You implement several required delegate methods to get an email address and dismiss the Address Book:

// call when the user cancel
 - (void) peoplePickerNavigationControllerDidCancel:(ABPeoplePickerNavigationController *)peoplePicker {
    [self dismissModalViewControllerAnimated:YES];
}

Let the user enter in contact details:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person {
    return YES;
}

Then do what you you with the email address selected:

- (BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)peoplePicker shouldContinueAfterSelectingPerson:(ABRecordRef)person property:(ABPropertyID)property identifier:(ABMultiValueIdentifier)identifier {
    if (property == kABPersonEmailProperty) {
         //assumed you have a property email in your class
         self.email = (NSString *)ABRecordCopyValue(person, kABPersonEmailProperty);
         [self dismissModalViewControllerAnimated:YES];
    }
    return NO;
}
like image 61
Franck Avatar answered Oct 06 '22 04:10

Franck


nope you cannot get list of emails, the default mail app which we use to send the emails through our app only let you check if user can send email or not which is its check wether or not atelast one mail account has been configured or not

like image 37
Ankit Sachan Avatar answered Oct 06 '22 05:10

Ankit Sachan