2016-11-18 40 views
0

我有.Vcf文件(Url)這是來自web服務。我想在我的視圖控制器中打開它。我如何打開.vcf文件在我的視圖控制器中的目標c

任何人都可以幫助我。

謝謝。

+0

您可以使用https://github.com/heardrwt/RHAddressBook閱讀VCF檔案 –

+0

你可以用'CNContactVCardSerialization'和它的類方法'+ ontactsWithData:錯誤:' – Larme

+0

謝謝@Larme其woring – Inder

回答

1

這是解決

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); 
相關問題