How to save a contact to iOS address book with an image?

How can I use the contacts plugin to save a contact that contains an image on iOS? It doesn’t seem like there’s any documentation on this. I know that contact images are retrieved through the temporary storage on the device, but I don’t know how to export those images or how to save normal images to that format.

You should combine two ngCordova plugins.

The first one is image picker: which you can use to select an image (just limit it to one selection).

When you find a URI just use it in a ngCordova contacts plugin. Here’s a tutorial on how to do that, it also includes a working example with an image.

Awesome, thanks. Followup question: for the life of me I cannot figure out how to export a retrieved contact image (see this post). How can I do this on iOS and Android?

Look at my other article:

You’ll find an example how to convert an image to BASE64 encoding using this Cordova plugin:

Thanks, but that article is about accessing the stored images on your phone. I’m talking about accessing the image of an imported contact. I tried this:

window.plugins.Base64.encodeFile([0].value, function(base64){
    console.log('file base64 encoding: ' + base64);

Prepending file:/// to[0].value didn’t work either. On iOS, an example of a returned image URL is:


Okay, I found the issue. The simulator was restricting access to file URLs. The plugin works perfectly on iOS devices.