1

iOS 7 で iPhone の連絡先に誕生日の日付を保存しましたが、コードが iOS 5 で機能しません。他の方法はありますか?

ABAddressBookRef addressBook = ABAddressBookCreate();
ABRecordRef person = ABPersonCreate();

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setLocale:[[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]];
[dateFormat setDateFormat:@"dd MMM yyyy"];
NSDate * birdayDate =[dateFormat dateFromString:contactCardBirthdateLbl.text];

NSArray * nameArray = [contactCardNameLbl.text componentsSeparatedByString:@" "];
ABRecordSetValue(person, kABPersonFirstNameProperty,(__bridge CFTypeRef)([nameArray objectAtIndex:0]) , nil);
ABRecordSetValue(person, kABPersonLastNameProperty,(__bridge CFTypeRef)([nameArray objectAtIndex:1]), nil);
ABRecordSetValue(person, kABPersonJobTitleProperty,(__bridge CFTypeRef) contactCardOccupationLbl.text, nil);
ABRecordSetValue(person, kABPersonBirthdayProperty,(__bridge CFDateRef)birdayDate,nil);
4

1 に答える 1