All Projects → jkpang → Ppgetaddressbook

jkpang / Ppgetaddressbook

Licence: mit
一句代码极速获取按A~Z分组精准排序的通讯录联系人 OC版( 已处理姓名所有字符的排序问题 )

Projects that are alternatives of or similar to Ppgetaddressbook

Agrume
🍋 A lemony fresh iOS image viewer written in Swift.
Stars: ✭ 449 (-13.49%)
Mutual labels:  cocoapods
Ttsegmentedcontrol
An elegant, animated and customizable segmented control for iOS created by Tapptitude
Stars: ✭ 471 (-9.25%)
Mutual labels:  cocoapods
Progresskit
Progress Views for Cocoa
Stars: ✭ 510 (-1.73%)
Mutual labels:  cocoapods
Pulltodismiss
You can dismiss modal viewcontroller like Facebook Messenger by pulling scrollview or navigationbar in Swift.
Stars: ✭ 456 (-12.14%)
Mutual labels:  cocoapods
Iblocalizable
Localize your views directly in Interface Builder with IBLocalizable
Stars: ✭ 463 (-10.79%)
Mutual labels:  cocoapods
Googlereporter
Easily integrate with Google Analytics in your iOS app
Stars: ✭ 479 (-7.71%)
Mutual labels:  cocoapods
Objective Leveldb
An Objective-C database library built over Google's LevelDB
Stars: ✭ 446 (-14.07%)
Mutual labels:  cocoapods
Hackers
Hackers is an elegant iOS app for reading Hacker News written in Swift.
Stars: ✭ 513 (-1.16%)
Mutual labels:  cocoapods
Gedatsu
Gedatsu provide readable format about AutoLayout error console log
Stars: ✭ 464 (-10.6%)
Mutual labels:  cocoapods
Keyboardshortcuts
Add user-customizable global keyboard shortcuts to your macOS app in minutes
Stars: ✭ 500 (-3.66%)
Mutual labels:  cocoapods
Xmlcoder
Easy XML parsing using Codable protocols in Swift
Stars: ✭ 460 (-11.37%)
Mutual labels:  cocoapods
Faqview
An easy to use FAQ view for iOS written in Swift
Stars: ✭ 462 (-10.98%)
Mutual labels:  cocoapods
Youtubekit
YoutubeKit is a video player that fully supports Youtube IFrame API and YoutubeDataAPI for easily create a Youtube app
Stars: ✭ 484 (-6.74%)
Mutual labels:  cocoapods
Ppcounter
iOS与macOS中一款优雅的数字/金额增减动效组件
Stars: ✭ 451 (-13.1%)
Mutual labels:  cocoapods
Listplaceholder
ListPlaceholder is a swift library allows you to easily add facebook style animated loading placeholder to your tableviews or collection views.
Stars: ✭ 511 (-1.54%)
Mutual labels:  cocoapods
Swiftyjson
The better way to deal with JSON data in Swift.
Stars: ✭ 21,042 (+3954.34%)
Mutual labels:  cocoapods
Yalfield
Custom Field component with validation for creating easier form-like UI from interface builder.
Stars: ✭ 476 (-8.29%)
Mutual labels:  cocoapods
Openssl
OpenSSL package for SPM, CocoaPod, and Carthage, for iOS and macOS
Stars: ✭ 515 (-0.77%)
Mutual labels:  cocoapods
Podsupdater
A macOS app which helps you manage dependency releases in your Podfile.
Stars: ✭ 513 (-1.16%)
Mutual labels:  cocoapods
Watchdoginspector
Shows your current framerate (fps) in the status bar of your iOS app
Stars: ✭ 497 (-4.24%)
Mutual labels:  cocoapods

image

  • PPGetAddressBook对AddressBook框架(iOS9之前)和Contacts框架(iOS9之后)做了对应的封装处理;

  • 支持一句代码获取按联系人姓名首字拼音A~Z排序(重点:已处理姓名所有字符的排序问题,排序更准确!);

  • 支持一句代码获取原始顺序的联系人,未分组,可自行处理;

  • 已对号码中的"+86","-","()",空号和联系人姓名空白做了处理,不会出现因为数据源NULL导致程序crash的问题;

  • 对姓"长","沈","厦","地","冲"多音字进行优化处理.

新建 PP-iOS学习交流群 : 323408051 有关于PP系列封装的问题和iOS技术可以在此群讨论

简书地址 ; codeData 地址

如果你需要Swift版本,请戳: https://github.com/jkpang/PPGetAddressBookSwift

image

Requirements 要求

  • iOS 7+
  • Xcode 8+

Installation 安装

1.手动安装:

下载DEMO后,将子文件夹PPGetAddressBook拖入到项目中, 导入头文件PPGetAddressBook.h开始使用

2.CocoaPods安装:

first pod 'PPGetAddressBook',:git => 'https://github.com/jkpang/PPGetAddressBook.git'

then pod install或pod install --no-repo-update

如果发现pod search PPGetAddressBook 不是最新版本,在终端执行pod setup命令更新本地spec镜像缓存(时间可能有点长),重新搜索就OK了

Usage 使用方法

*注意, 在iOS 10系统下必须在info.plist文件中配置获取隐私数据权限声明 : 兼容iOS 10:配置获取隐私数据权限声明

一、首先必须要请求用户是否授权APP访问通讯录的权限(建议在APPDeletegate.m中的didFinishLaunchingWithOptions方法中调用)

     //请求用户获取通讯录权限
    [PPGetAddressBook requestAddressBookAuthorization];

二、获取通讯录

1.获取按联系人姓名首字拼音A~Z排序(已处理姓名所有字符的排序问题),一句话搞定!

    //获取按联系人姓名首字拼音A~Z排序(已经对姓名的第二个字做了处理)
    [PPGetAddressBook getOrderAddressBook:^(NSDictionary<NSString *,NSArray *> *addressBookDict, NSArray *nameKeys) {
        //addressBookDict: 装着所有联系人的字典
        //nameKeys: A~Z拼音字母数组;
        //刷新 tableView       
        [self.tableView reloadData];
    } authorizationFailure:^{
        NSLog(@"请在iPhone的“设置-隐私-通讯录”选项中,允许PPAddressBook访问您的通讯录");
    }];

   

2.获取原始顺序的联系人模型,未分组,一句话搞定!

    //获取没有经过排序的联系人模型
    [PPGetAddressBook getOriginalAddressBook:^(NSArray<PPPersonModel *> *addressBookArray) {
       //addressBookArray:原始顺序的联系人模型数组
       
       //刷新 tableView       
        [self.tableView reloadData];
    } authorizationFailure:^{
       NSLog(@"请在iPhone的“设置-隐私-通讯录”选项中,允许PPAddressBook访问您的通讯录");
    }];
    

如果你有更好的实现方法,希望不吝赐教!

你的star是我持续更新的动力!

===

CocoaPods更新日志

  • 2016.12.01(tag:0.2.8)--修复在iOS 9之前系统中编辑联系人不会及时同步的bug
  • 2016.10.30(tag:0.2.7)--1.对姓"长","沈","厦","地","冲"多音字进行优化处理; 2.将'#'key值排列在A~Z的末尾!
  • 2016.10.08(tag:0.2.6)--读取联系人速度再次提升!
  • 2016.09.16(tag:0.2.5)--读取排序通讯录时性能提升3~6倍以及部分代码优化,推荐使用此版本及之后的版本
  • 2016.09.12(tag:0.2.2)--小细节优化
  • 2016.09.01(tag:0.2.1)--修复 当用户没有授权时程序卡死的Bug
  • 2016.08.26(tag:0.2.0)--将联系人排序的耗时操作放在子线程,大大优化程序的载入速度与体验
  • 2016.08.23(tag:0.1.2)--小细节优化
  • 2016.08.21(tag:0.1.1)--Pods初始化

我的App <-> My APP

  • PPHub:一个简洁漂亮的 GitHub iOS客户端 <-> A simple and beautiful GitHub iOS client
    App_Store

联系方式:

PP-iOS学习交流群群二维码

许可证

PPGetAddressBook 使用 MIT 许可证,详情见 LICENSE 文件。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].