Reputation: 791
I want to add an email account from code in the list of accounts to use it later in my app (like iCloud or Gmail accounts). It is possible???
Thank you for advance.
EDIT:
I found the ACAccount
class, with this class I will do that??
EDIT 2:
Now, I'm saving the user and password in the keychain. This is a good alternative or no?
Upvotes: 1
Views: 121
Reputation: 4660
It is not possible on a non jailbreaked iOS device. This has to be done by the user manually.
Edit: If you have gained user and password from the user (legs way) storing it in the keychain is the optimal procedure.
Upvotes: 3
Reputation: 46
As Volker stated, you can't do it on a non jailbroken device.
The ACAccount
class that you refer to is mostly used to get/store credential from a previously configured Facebook, Twitter, Sina Weibo, Trecent Weibo account in your iPhone, which is not the case.
Apple can't grant access to Mail account both read/write. You can only send an email within your code, by using the Message UI framework. A valid example on how to use it can be found here.
Hope this helps.
Upvotes: 2