Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/insfgg99x/fgaddressbook
获取手机通讯,监听手机通讯录的改变,并获取这些改变等。
https://github.com/insfgg99x/fgaddressbook
Last synced: about 2 months ago
JSON representation
获取手机通讯,监听手机通讯录的改变,并获取这些改变等。
- Host: GitHub
- URL: https://github.com/insfgg99x/fgaddressbook
- Owner: Insfgg99x
- License: mit
- Created: 2018-09-14T13:14:35.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-17T04:15:21.000Z (over 6 years ago)
- Last Synced: 2024-10-31T16:11:44.671Z (about 2 months ago)
- Language: Objective-C
- Homepage:
- Size: 129 KB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# FGAddressBook
--------------------
获取手机通讯录联系人列表(兼容iOS 8以下设备),监听通讯录的变化,获取这些变化。
![](/src/demo.PNG)
## 使用
- 手机通讯录改变(新增、删除)的回调
```swift
[FGAddressBook shared].didAddNewItemsHandler = ^(NSArray *items) {
NSLog(@"新增了这些联系人:\n%@",items);
};
[FGAddressBook shared].didDeleteItemsHandler = ^(NSArray *items) {
NSLog(@"删除了这些联系人:\n%@",items);
};
```- 通讯录变化的回调(直接回调最新的通讯录列表)
```swift
[FGAddressBook shared].didChangeItemsHandler = ^(NSArray *items) {
@synchronized(wkself.addressBookArray) {
[wkself.addressBookArray setArray:items];
}
[wkself.table reloadData];
};
```- 获取通讯录联系人列表
```swift
[[FGAddressBook shared] authAddressBook:^(BOOL granted) {
if(!granted) {
return;
}
[[FGAddressBook shared] loadAddressbook:^(NSArray *items) {
@synchronized(wkself.addressBookArray) {
[wkself.addressBookArray setArray:items];
}
[wkself.table reloadData];
}];
}];
```
## 安装```swift
pod repo update
pod 'FGAddressBook'
```👉在`info.plist`中添加通讯录访问授权说明:
```swift
Privacy - Contacts Usage Description : 是否允许访问通讯录?(填写自己产品的访问说明)
```
👉温馨提示:请在真机上运行此demo## TODO
- [ ] 直接在SDK里面实现增删改联系人
--------------------------
@end