It is inconvenient to use the official AddressBook framework to access the Address book only in C, which describes the method of integrating third-party framework Rhaddressbook, which can access and manipulate contacts through OC.
The framework is a static library, and the integration is more complex.
First download the framework: Rhaddressbook, here are some introduction to integration, the following simple introduction to the integration process.
① first drag the static library project directly into its own project:
② Choose in their own project , the project configuration select Build phases, follow the import two files, click on the left side of the plus sign to add.
③ Select the build Settings, search for the header searching path (note not paths), add a path include, pay attention to the right to select recursion.
④ searches other linker flags, adding-OBJC and-all_load compilation tags.
-OBJC tells the linker to load the defined OC class and classification, and if there are classes and classifications in the static library, the flag must be added.
-all_load is used to handle bugs in the-OBJC, and if the class library has only categories with no classes, the classification is not loaded by default, and this will force the classification to load.
⑤ Import the master header file #import <rhaddressbook/addressbook.h> Note that missing this step will cause an error in the project.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
(101) Integrated static library Rhaddressbook realize OC Access Address Book