これは SDK のバグになります...したがって、できることは、文字列を分離して新しい ABPerson を作成することだけです - ABPersonCreate() を使用して - 私のコードを見てください。
-(NSMutableDictionary *)getMyVCardObjects:(NSString *)vCardString{
NSString *firstname;
NSString *lastname;
NSString *pos;
NSString *company;
NSString *email;
NSString *www;
NSString *tel;
NSString *twitterUserName;
NSString *facebookUserName;
NSArray *myArr = [vCardString componentsSeparatedByString:@"\n"];
for (int i=0; i<[myArr count]; i++) {
//vorname nachname
if ([[myArr objectAtIndex:i] rangeOfString:@"FN:"].location != NSNotFound) {
NSArray *tempArray = [[myArr objectAtIndex:i] componentsSeparatedByString:@":"];
if ([tempArray count] >= 2) {
firstname = [[[tempArray objectAtIndex:1]componentsSeparatedByString:@" "] objectAtIndex:0];
lastname = [[[tempArray objectAtIndex:1]componentsSeparatedByString:@" "] objectAtIndex:1];
}
}
//company
if ([[myArr objectAtIndex:i] rangeOfString:@"ORG:"].location != NSNotFound) {
NSArray *tempArray = [[myArr objectAtIndex:i] componentsSeparatedByString:@":"];
company = [[[tempArray objectAtIndex:1]componentsSeparatedByString:@";"] objectAtIndex:0];
}
//title = pos
if ([[myArr objectAtIndex:i] rangeOfString:@"TITLE:"].location != NSNotFound) {
NSArray *tempArray = [[myArr objectAtIndex:i] componentsSeparatedByString:@":"];
pos = [tempArray objectAtIndex:1];
}
//email
if ([[myArr objectAtIndex:i] rangeOfString:@"EMAIL;"].location != NSNotFound) {
NSArray *tempArray = [[myArr objectAtIndex:i] componentsSeparatedByString:@";"];
email = [[[tempArray objectAtIndex:2]componentsSeparatedByString:@":"] objectAtIndex:1];
}
//tel
if ([[myArr objectAtIndex:i] rangeOfString:@"VOICE;"].location != NSNotFound) {
NSArray *tempArray = [[myArr objectAtIndex:i] componentsSeparatedByString:@";"];
tel = [[[tempArray objectAtIndex:4]componentsSeparatedByString:@":"] objectAtIndex:1];
}
//www
if ([[myArr objectAtIndex:i] rangeOfString:@"URL;"].location != NSNotFound) {
NSArray *tempArray = [[myArr objectAtIndex:i] componentsSeparatedByString:@";"];
www = [[[tempArray objectAtIndex:1]componentsSeparatedByString:@":"] objectAtIndex:1];
}
//twitter
if ([[myArr objectAtIndex:i] rangeOfString:@"twitter"].location != NSNotFound) {
NSArray *tempArray = [[myArr objectAtIndex:i] componentsSeparatedByString:@";"];
if ([[tempArray objectAtIndex:1] rangeOfString:@"type=twitter"].location != NSNotFound) {
twitterUserName = [[[[[tempArray objectAtIndex:2]componentsSeparatedByString:@"="] objectAtIndex:1] componentsSeparatedByString:@":"] objectAtIndex:0];
}
}
if ([[myArr objectAtIndex:i] rangeOfString:@"facebook"].location != NSNotFound) {
NSArray *tempArray = [[myArr objectAtIndex:i] componentsSeparatedByString:@";"];
if ([[tempArray objectAtIndex:1] rangeOfString:@"type=facebook"].location != NSNotFound) {
facebookUserName = [[[[[tempArray objectAtIndex:2]componentsSeparatedByString:@"="] objectAtIndex:1] componentsSeparatedByString:@":"] objectAtIndex:0];
}
}
}
return [NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:firstname,lastname,pos,company,email,www,tel,twitterUserName,facebookUserName, nil] forKeys:[NSArray arrayWithObjects:@"firstname",@"lastname",@"pos",@"company",@"email",@"www",@"tel",@"twitterUserName",@"facebookUserName", nil]];
}
それを楽しんでください。