CPContact 0.1.2

CPContact 0.1.2

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Oct 2016

Maintained by Chengfei Xiao.



CPContact 0.1.2

  • By
  • xiaochengfei

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

iOS8+

Installation

CPContact is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "CPContact"

Guide

CFXABContactModel *model = [[CFXABContactModel alloc]init];
model.basicModel = [[CFXABBasicInfoModel alloc]init];
model.basicModel.firstName = @"xiao";
model.basicModel.lastName = @"crespo";
model.basicModel.title = @"ceo";
CFXABPhoneModel *phone = [[CFXABPhoneModel alloc]init];
phone.number = @"1111";
phone.type = @"office";
model.phoneArray = @[phone];
[CFXContact addReocrdWithModel:model success:^(BOOL success) {
    NSLog(@"test1: %d",success);

    [CFXContact addPhoneNumber:@"2222" toExistFullName:@"xiao crespo" success:^(BOOL success) {
        NSLog(@"test2: %d",success);

        [CFXContact loadContacts:^(NSArray *array) {
            NSLog(@"test3: %lu",(unsigned long)[array count]);

            [CFXContact removedRecordWithFullName:@"xiao crespo" success:^(BOOL success) {
                NSLog(@"test4: %d",success);

                [CFXContact loadContacts:^(NSArray *array) {
                    NSLog(@"test5: %lu",(unsigned long)[array count]);

                    [CFXContact delAllRecord:^(BOOL success) {
                        NSLog(@"test6: %d",success);

                        [CFXContact loadContacts:^(NSArray *array) {
                            NSLog(@"test7: %lu",(unsigned long)[array count]);
                        }];
                    }];
                }];
            }];
        }];
    }];
}];

TODO

ABAddressBook is deprecated on iOS9, so i will use CNContact instead.

Author

CrespoXiao http://weibo.com/crespoxiao

License

CPCache is available under the MIT license. See the LICENSE file for more info.