Search code examples
iosswiftqr-codeaddressbook

Is it possible to add the contact to the users address book by scaning QR Code?


My app can generate QRCode. I want to share it with another person. Is it possible to generate QRCode with some user information? And when somebody scan it then it will save in user address book.


Solution

  • There's something called vCard format and I think that this could help you.

    Here's a small example:

    name = 'Carlos Sainz'
    phone = 'xxxxxxxxx'
    string_for_qr = f"BEGIN:VCARD\nVERSION:2.1\nFN:{name}\nTEL;CELL:{phone}\nEND:VCARD" 
    

    If you create a QR code with the string "string_for_qr" then when you scan the QR code your phone will display the information with the option of save. Sorry for my poor english.