Latest 1.0
Homepage https://github.com/Insfgg99x/FGAddressBook
License MIT
Platforms ios 6.0, requires ARC
Frameworks Foundation, UIKit, Contacts
Authors

获取手机通讯录联系人列表(兼容iOS 8以下设备),监听通讯录的变化,获取这些变化。

FGAddressBook

使用

  • 手机通讯录改变(新增、删除)的回调
[FGAddressBook shared].didAddNewItemsHandler = ^(NSArray<FGAddressBookModel *> *items) {
    NSLog(@"新增了这些联系人:n%@",items);
};
[FGAddressBook shared].didDeleteItemsHandler = ^(NSArray<FGAddressBookModel *> *items) {
    NSLog(@"删除了这些联系人:n%@",items);
};
  • 通讯录变化的回调(直接回调最新的通讯录列表)
[FGAddressBook shared].didChangeItemsHandler = ^(NSArray<FGAddressBookModel *> *items) {
    @synchronized(wkself.addressBookArray) {
        [wkself.addressBookArray setArray:items];
    }
    [wkself.table reloadData];
};
  • 获取通讯录联系人列表
[[FGAddressBook shared] authAddressBook:^(BOOL granted) {
    if(!granted) {
        return;
    }
    [[FGAddressBook shared] loadAddressbook:^(NSArray<FGAddressBookModel *> *items) {
        @synchronized(wkself.addressBookArray) {
            [wkself.addressBookArray setArray:items];
        }
        [wkself.table reloadData];
    }];
}];

安装

pod repo update
pod 'FGAddressBook'

👉在info.plist中添加通讯录访问授权说明:

Privacy - Contacts Usage Description : 是否允许访问通讯录?(填写自己产品的访问说明)

👉温馨提示:请在真机上运行此demo

TODO

  • [ ] 直接在SDK里面实现增删改联系人

@end

Latest podspec

{
    "name": "FGAddressBook",
    "version": "1.0",
    "summary": "FGAddressBooku4fbfu6377u7684u624bu673au901au8bafu5f55u8054u7cfbu4ebau5de5u5177uff0cu83b7u53d6u8054u7cfbu4ebau5217u8868uff0cu76d1u542cu5e76u540eu53bbu901au8bafu5f55u7684u53d8u5316",
    "homepage": "https://github.com/Insfgg99x/FGAddressBook",
    "license": "MIT",
    "authors": {
        "CGPointZero": "[email protected]"
    },
    "source": {
        "git": "https://github.com/Insfgg99x/FGAddressBook.git",
        "tag": "1.0"
    },
    "frameworks": [
        "Foundation",
        "UIKit",
        "Contacts"
    ],
    "platforms": {
        "ios": "6.0"
    },
    "source_files": "FGAddressBook/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This