Latest 1.0.0
Homepage https://github.com/ZHIOSLIB/ZHContactsManager
License MIT
Platforms ios 8.0, requires ARC
Frameworks Contacts, ContactsUI, AddressBook, AddressBookUI, MessageUI
Authors

ZHContactManager

通讯录操作:选择联系人、添加新联系人、添加到已有联系人;打电话、发短信

选择联系人

[[ZHAuthorizationManager defaultManager] requestAuthorization:AuthorizationTypeContacts authorizedResult:^(BOOL granted) {
    if (granted) {
        ZHContactManager *manager = [ZHContactManager defaultManager];
        [manager selectContactWithCompletionHandler:^(ZHContact *contact) {
            if (contact) {
                self.photo.image = contact.image;
                NSMutableString *info = contact.name.mutableCopy;
                [info appendFormat:@"n生日:%ld-%ld", contact.birthday.month,contact.birthday.day];
                [info appendFormat:@"n农历生日:%ld-%ld", contact.nonGregorianBirthday.month,contact.nonGregorianBirthday.day];
                [contact.phoneInfo enumerateObjectsUsingBlock:^(ZHEvent<NSString *> * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
                    [info appendFormat:@"n%@电话:%@", obj.label,obj.value];
                }];
                [contact.emailInfo enumerateObjectsUsingBlock:^(ZHEvent<NSString *> * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
                    [info appendFormat:@"n%@邮箱:%@", obj.label,obj.value];
                }];
                [contact.addressInfo enumerateObjectsUsingBlock:^(ZHEvent<ZHAddress *> * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
                    [info appendFormat:@"n%@地址:%@%@%@%@", obj.label,obj.value.country,obj.value.state,obj.value.city,obj.value.street];
                }];
                self.info.text = info.copy;
            }
        }];
    }
}];

获取通讯录所有联系人

- (NSMutableArray<ZHContact *> *)getAllContacts;

添加新联系人-系统UI

- (void)addNewContactWithPhoneNumber:(NSString *)phoneNumber;

添加到现有的联系人-系统UI

- (void)addToExistingContactWithPhoneNumber:(NSString *)phoneNumber;

打电话

- (void)callPhone:(NSString *)phone;

发送短信

/**
 @param message 内容文本
 @param subject 标题
 @param attachments 附件(图片,可以传入图片名称<本地、网络>)
 @param recipients 接收人(手机号,传入多个手机号就是群发)
 @param result 发送结果
 */
- (void)sendMessage:(NSString *)message subject:(NSString *)subject attachments:(NSArray<NSString *> *)attachments recipients:(NSArray<NSString *> *)recipients result:(void (^)(BOOL sent, BOOL cancelled))result;

Latest podspec

{
    "name": "ZHContactsManager",
    "version": "1.0.0",
    "summary": "u901au8bafu5f55u64cdu4f5c",
    "description": "u901au8bafu5f55u9009u62e9u3001u6dfbu52a0u3001u66f4u65b0u8054u7cfbu4ebauff1bu6253u7535u8bddu3001u53d1u77edu4fe1",
    "homepage": "https://github.com/ZHIOSLIB/ZHContactsManager",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "leezhihua": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/ZHIOSLIB/ZHContactsManager.git",
        "tag": "1.0.0"
    },
    "source_files": "ZHContactsManager/Classes/*.{h,m}",
    "frameworks": [
        "Contacts",
        "ContactsUI",
        "AddressBook",
        "AddressBookUI",
        "MessageUI"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This