使用以下方法,我立即在iOS 5上获得正确的顺序,但在设置中切换后,在重新启动应用程序后(关闭设置后),iOS 6和7上的顺序没有变化.
BOOL firstNameFirst = NO;
if (IOS_VERSION>=7) {
firstNameFirst = (ABPersonGetCompositeNameFormatForRecord(NULL)==kABPersonCompositeNameFormatFirstNameFirst);
}else{
firstNameFirst = (ABPersonGetCompositeNameFormat() == kABPersonCompositeNameFormatFirstNameFirst);
}
Run Code Online (Sandbox Code Playgroud)
我错过了什么?
编辑:这个bool应该存储用户默认顺序,所以我可以订购名字和姓氏字符串,并按照他在iPhone设置中设置的方式向用户显示.
EDIT2:在IOS_VERSION宏观作品完美,我检查了他们使用断点,但无论设置/邮件,通讯录,日历/通讯录/显示顺序的设置是,我总是YES对firstNameFirst的价值
我希望对你有所帮助.
ABAddressBookRef addressBook = ABAddressBookCreateWithOptions(NULL, NULL);
BOOL firstNameFirst = NO;
if (IOS_VERSION>=7) {
firstNameFirst = (ABPersonGetCompositeNameFormatForRecord(NULL)==kABPersonCompositeNameFormatFirstNameFirst);
}else{
firstNameFirst = (ABPersonGetCompositeNameFormat() == kABPersonCompositeNameFormatFirstNameFirst);
}
if(addressBook != NULL) {
CFRelease(addressBook);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
977 次 |
| 最近记录: |