In laravel i use chillerlan/php-qrcode to create a QR VCard. When android scan the qr all field is populated while in ios.iphone the firstname is empty and the lastname contain all the value.
Reference for chillerlan document https://github.com/chillerlan/php-qrcode/blob/a301af5b7faa7fcd690b29f38b283616a7d93b89/docs/Appendix/URI-Content.md#L195
Working fine
Android
First name: ValueFirstname
Middle name: ValueMiddlename
Last name: ValueLastname
First name is empty and Last name contain all the value
Iphone/IOS
First name:
Last name: ValueFirstname ValueMiddlename ValueLastname
Code
firstname = $vcard_request->input('firstname');
$middlename = $vcard_request->input('middlename');
$lastname = $vcard_request->input('lastname');
$vcard = "BEGIN:VCARD\r\n";
if (!empty($middlename) && strtolower($middlename) !== 'n/a') {
$formattedName = "$firstname $middlename $lastname";
$vcard .= "N:$formattedName\r\n";
} else {
$formattedName = "$firstname $lastname";
$vcard .= "N:$formattedName\r\n";
}
$vcard .= "VERSION:4.0\r\n";
$vcard .= "END:VCARD";
composer.json
"chillerlan/php-qrcode": "^4.3",
For Android it may work well but for iOS it expects these names to be in their specific positions according to the VCard
specification.Try this >>
$firstname = $vcard_request->input('firstname'); $middlename = $vcard_request->input('middlename'); $lastname = $vcard_request->input('lastname');
$vcard = "BEGIN:VCARD\r\n";
$formattedName = $lastname . ';' . $firstname . ';' . $middlename . ';;';
$vcard .= "N:" . $formattedName . "\r\n";
$vcard .= "VERSION:4.0\r\n";
$vcard .= "END:VCARD";