I can send a location by embedding the person\'s location in a VCF through an email by including it as an attachment. I do not know how to do the same through SMS. Is it s
Use Below code to send vCard as an attachment in a message
if([MFMessageComposeViewController canSendText])
{
MFMessageComposeViewController *msgController = [[MFMessageComposeViewController alloc] init] ;
msgController.body = bodyString;
if (phoneNumberArray != nil) {
msgController.recipients = phoneNumberArray;
}
msgController.messageComposeDelegate = self;
if([MFMessageComposeViewController canSendAttachments] && [MFMessageComposeViewController isSupportedAttachmentUTI:(NSString *)kUTTypeVCard]) {
NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString * contactCardPath = [documentsDirectory stringByAppendingFormat:@"/%@",KVCardFileName]; //Path of vCard saved in your document directory
if([[NSFileManager defaultManager]fileExistsAtPath:contactCardPath]) {
NSData *vCardContact = [[NSFileManager defaultManager] contentsAtPath:contactCardPath];
[msgController addAttachmentData:vCardContact typeIdentifier:(NSString *)kUTTypeVCard filename:KVCardFileName];
}
}
[self presentViewController:msgController animated:YES completion:^{
[SVProgressHUD dismiss];
}];
}