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

时间:2013-09-24 11:37:25

标签: iphone ios objective-c addressbookui

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.

1 个答案:

答案 0 :(得分:0)

我找到了解决方案:请参阅source

有一些已弃用的功能,但我们可以解决它, 通过在“ABContactsHelper”类中替换下面的函数

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

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

ABAddressBookRef addressBook = [ABContactsHelper addressBook];