We get .vcf
from Document directory path but can't import to the device using .vcf
file URL like
'"Nik1 .vcf": file:///Users/jksol-niketan/Library/Developer/CoreSimulator/Devices/18ADE140-22E4-4BEA-8C25-886AEE96C2CC/data/Containers/Data/Application/BC6A91A7-2920-4D5D-9787-F6D0E0DAB200/Documents/restore/Nik1%20.vcf'
How can solution for this file path URL to import iPhone device using swift/objective c I tired of this issue, help with this query solution.
for r in restore{
var data: Data = Data()
do{
let url = URL(fileURLWithPath: r.value.path)
try data = NSData(contentsOf: url) as Data
var usersContact = [CNContact]()
do {
try usersContact = CNContactVCardSerialization.contacts(with: data)
} catch {
print("error")
}
let contact = usersContact[0]
print(contact)
}catch{
print("error")
}
}
Ex. restore = ["Nik1 .vcf": file:///Users/jksol-niketan/Library/Developer/CoreSimulator/Devices/18ADE140-22E4-4BEA-8C25-886AEE96C2CC/data/Containers/Data/Application/BC6A91A7-2920-4D5D-9787-F6D0E0DAB200/Documents/restore/Nik1%20.vcf]