I have a little problem when I try to split delimited string into an Array. Basically, I want to pass result from MECARD QRCode and add new entry to addressBook.
Here is my code (for "FirstName" field only) : :
NSLog(@"found CB");
NSLog(@"_code.text = %@", code.content);
ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef person = ABPersonCreate();
NSString *_n = [NSString stringWithFormat:@"_code.text = %@", code.content];
NSArray *n = [_n componentsSeparatedByString:@";"];
NSLog(@"_code.text = %@",n);
ABRecordSetValue(person, kABPersonFirstNameProperty, _name, nil);
ABAddressBookAddRecord(addressBook, person, nil);
CFRelease(addressBook);
ABNewPersonViewController *c = [[ABNewPersonViewController alloc] init];
[c setNewPersonViewDelegate:self];
[c setDisplayedPerson:person];
CFRelease(person);
[self.navigationController pushViewController:c animated:YES];
[c release];
MECARD QRCode is well decoded & viewController appears... But all the URL (as : "MECARD:N:name;ORG:company;TEL:89878978; ...Etc.) goes in first field (FistName field)...
What am missing to separate my MECARD URL & send right data in right field?
Hope it helps
NSArray *chunks = [string componentsSeparatedByString: @";"];