ABPersonViewController 在 iOS 7.0 及更高版本中不支持子类化



is there any best way to listout Property of Contact in detail? like it is working in IOS 6.1 and earlier Version.


//
//  ABPersonViewController.h
//  AddressBookUI
//
//  Copyright (c) 2010 Apple Inc. All rights reserved.
//
#import <UIKit/UIViewController.h>
#import <AddressBook/AddressBook.h>
@interface ABPersonViewController : UIViewController <UIViewControllerRestoration>
// ABPersonViewController does not support subclassing in iOS 7.0 and later. A nil instance will be returned.

我找到了一个解决方案 :p租赁 见源代码

有一些不推荐使用的函数,但我们可以解决它,通过替换"ABContactsHelper"类中的"以下函数"

+ (ABAddressBookRef) addressBook
{
#ifdef __IPHONE_6_0
    return ABAddressBookCreateWithOptions(NULL, NULL);
#else
    return ABAddressBookCreate();
#endif
}

在调用"ABAddressBookCreate()"的地方使用它。喜欢

ABAddressBookRef addressBook = [ABContactsHelper addressBook];

最新更新