Is it possible to add CardDav account programmatically as it can be done by manually using Mail,Contacts,Calendras -> Add Account option in Settings app.
In general is it possible to add in code any other type of acccount?
For instance exchange account. I read that somewhere on forum that it isn't.
According with ABSource
it seems that it is not possible to add account from the code. There are just functions for reading and copying values from appropriate source record
Yes, you can create a "configuration profile": a plist in which you can specify the CardDav account profile. You can find info about the format on the Apple Documentation under Card Dav payload.
Here is an example:
Remember to save the file with ".mobileconfig". extension.
Then if you are interested on how you can open a configuration profile programmatically, you can look at this question https://stackoverflow.com/questions/2338035/installin g-a-configuration-profile-on-iphone-programmatically