iphone - 检查当前 viewController 类是否为 IOS 7 中的 Person ViewController 时出现问题

标签 iphone ios ipad ios7 abpersonviewcontroller

我正在加载 ABPeoplePickerNavigationController。单击人员选择器中的联系人时,我正在检查条件

if([navigationController isKindOfClass:[ABPeoplePickerNavigationController class]]
   && [viewController isKindOfClass:[ABPersonViewController class]]){

  //Statements

}

但在 IOS 7 中我注意到,第二个条件,即

[viewController isKindOfClass:[ABPersonViewController class]

始终返回NO。我知道加载的 View Controller 是 ABPersonViewController。 在 IOS 6 之前,这已经/正在正常工作。可能是什么问题?无论如何我可以解决这个问题吗?

编辑:

UINavigationController Delegate 中检查条件

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated

并且 viewController 类在登录时显示为 ABContactViewController

最佳答案

当检查你的类时,你会发现 iOS7 返回了不同的类型。

检查您需要检查的逻辑。您不必通过内省(introspection)来对人员选择器操作做出适当的 react 。只需实现 ABPeoplePickerNavigationControllerDelegate 中的标准委托(delegate)方法即可。特别是,您必须实现:

- (BOOL)peoplePickerNavigationController:
    (ABPeoplePickerNavigationController *)peoplePicker 
     shouldContinueAfterSelectingPerson:(ABRecordRef)person;

关于iphone - 检查当前 viewController 类是否为 IOS 7 中的 Person ViewController 时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19181482/

相关文章:

iphone - 对齐 UILabel 以 UIView 为中心

iphone - RestKit集成问题 "No Such File Or directory"

iphone - 如何让 iPhone 振动任意时间?

iphone - 在服务器和 iOS 应用程序之间同步文件目录

ios - Xcode安装prev Swift版本

objective-c - iOS Core Data 如何使用谓词正确比较字符串文本?

oop - 在面向对象的设置中使用OpenGL绘图操作?

css - iphone 邮件无法加载谷歌字体 Oswald

iphone - 如何使用 UIImagepickercontroller 自定义相机屏幕

ios - 如何在单元格类中获取 indexPath?