Inder
Inder

Reputation: 29

How can i Open .vcf file in my view controller in objective c

I have .Vcf File(Url) which is coming from web service. and i want to open it in my view controller.

Anyone can help me for this.

Thanks.

Upvotes: 0

Views: 558

Answers (1)

Inder
Inder

Reputation: 29

This is the Solution

NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@",[self.totalData valueForKey:@"file"]]]];
      NSArray *contactList = [NSArray arrayWithArray:[CNContactVCardSerialization contactsWithData:data error:nil]];
      CNContact *contact;
           contact=[contactList objectAtIndex:0];
      NSLog(@"%@",contact.givenName);
      NSLog(@"%@",contact.familyName);

Upvotes: 1

Related Questions