¿Cómo get la URL de la image de contacto de los contactos?

Necesito get la URL de la image para cada contacto desde AddressBook. Puedo get la image ahora, pero lo que pasa es que necesito get la URL del activo de la image para la persona en particular. Actualmente estoy obteniendo la image de contacto por

[UIImage imageWithData:(__bridge NSData *)ABPersonCopyImageData(person)] 

Por favor, ayúdame a get la URL del activo para esa image en particular. Gracias

Creo que necesita hacer una copy local de los datos y luego save una reference a esa copy local en su database:

 //create a fileName perhaps based on the contact name or a GUID NSError *err; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);//find the cache dir. You might want to consider using the doc dir instead NSString * path = [paths objectAtIndex:0]; path = [path stringByAppendingPathComponent:fileName]; [imgData writeToFile:path options:NSDataWritingAtomic error:&err]; if(!err) { ///save path to the DB } 

Una solución simple para SWIFT 3 y superior.

 var users = [User]() func getContact(){ if #available(iOS 9.0, *) { let contactStore = CNContactStore() _ = [ CNContactFormatter.descriptorForRequinetworkingKeys(for: .fullName), CNContactEmailAddressesKey] // Get all the containers var allContainers: [CNContainer] = [] do { allContainers = try contactStore.containers(matching: nil) } catch { print("Error fetching containers") } do { try contactStore.enumerateContacts(with: CNContactFetchRequest(keysToFetch: [CNContactGivenNameKey as CNKeyDescriptor, CNContactFamilyNameKey as CNKeyDescriptor, CNContactEmailAddressesKey as CNKeyDescriptor, CNContactImageDataKey as CNKeyDescriptor])) { (contact, cursor) -> Void in if (!contact.emailAddresses.isEmpty){ //self.email.append(String(contact.emailAddresses)) for emailAdd:CNLabeledValue in contact.emailAddresses { let a = emailAdd.value if a as String != ""{ for (index, data) in self.users.enumerated(){ if a as? String == data.email{ print("Emial found in Contact",index,a as String) if contact.isKeyAvailable(CNContactImageDataKey) { if let img = contact.imageData{ self.users[index] = User( id: self.users[index].id, firstName: self.users[index].firstName, lastName: self.users[index].lastName, email: self.users[index].email, user_type: self.users[index].user_type,user_image: UIImage(data: img)) print("imag",img) } } } } self.email.append(a as String) } } } } } catch{ print("Handle the error please") } }else{ // Fallback } filtenetworkingData = email dropDown.dataSource = filtenetworkingData }