Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ABMultiValueRef phones = ABRecordCopyValue(contactPerson, kABPersonPhoneProperty);
- for (NSUInteger j = 0; j < ABMultiValueGetCount(phones); j++) {
- NSMutableString *phone = [CFBridgingRelease(ABMultiValueCopyValueAtIndex(phones, j)) mutableCopy];
- [phone replaceOccurrencesOfString:@" " withString:@"" options:0 range:NSMakeRange(0, phone.length)];
- [phone replaceOccurrencesOfString:@"(" withString:@"" options:0 range:NSMakeRange(0, phone.length)];
- [phone replaceOccurrencesOfString:@")" withString:@"" options:0 range:NSMakeRange(0, phone.length)];
- [phone replaceOccurrencesOfString:@"-" withString:@"" options:0 range:NSMakeRange(0, phone.length)];
- [phone replaceOccurrencesOfString:@"+33" withString:@"0" options:0 range:NSMakeRange(0, phone.length)];
- [phone stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
- if (((j == 0) && [phone hasPrefix:@"06"]) || ((j == 0) && [phone hasPrefix:@"07"])) person.mainNumber = phone;
- else if ((j==1) && [phone hasPrefix:@"06"]) person.mainNumber = phone;
- else if ((j==2) && [phone hasPrefix:@"06"]) person.mainNumber = phone;
- else if ((j==3) && [phone hasPrefix:@"06"]) person.mainNumber = phone;
- }
- CFRelease(phones);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement