Latest 2.3.2
License MIT
Platforms ios 9.0, requires ARC
Frameworks UIKit, Foundation


A short code can achieve a variety of commonly used functions, according to the data processing, file management, multimedia management, rights management, information system, Appstore, encryption and decryption, quick macro definition type package several different Category.

一、导入项目 Import project


The HDCommonTools can be imported with cocoapods or by downloading source files.

通过cocoapods导入 Importing through cocoapods

pod 'HDCommonTools'

通过文件导入 Importing through files


Download the project, import the contents of the HDCommonTools folder into the project.

二、函数使用 Function use


All function functions can be called in the two

1. 头文件导入


v1.x版本 – v1.x vsersion

导入头文件 Import header file

#import "HDCommonHeader.h"

v2.x版本 – v2.x vsersion

导入头文件 Import header file

#import "HDCommonTools.h"

2、通过单例调用即可 Can be called by a single case

[[HDCommonTools sharedHDCommonTools] getIOSLanguageStr];
[[HDCommonTools sharedHDCommonTools] getGPSLibraryWithType:kHDGPSPermissionWhenInUse];

3、权限通知说明 Permission notice


In the process of applying for permissions, a notification is triggered when the result is returned.


To obtain the change status notification authority is special, because the relevant interface monitoring notification change is added in the iOS10.0, so in previous versions of iOS10.0 there is no notice when the notification authority change, The solution is to check if the authority is granted after the application is applied.

//System authority authorization change notification
FOUNDATION_EXPORT NSString * const HDPermissionStatusDidChangeNotification;

//The key of the userinfo in the system change notification, marked name
FOUNDATION_EXPORT NSString * const HDPermissionNameItem;

//The key of userinfo in the system change notification, marked state
FOUNDATION_EXPORT NSString * const HDPermissionStatusItem;


Take the application of GPS authority as an example

- (void)viewDidLoad {
    [super viewDidLoad];
    ///注册权限回调通知 egistration authority callback notice
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(permissionNotifacation:) name:HDPermissionStatusDidChangeNotification object:nil];
    ///申请gps权限 access to GPS
    [[HDCommonTools sharedHDCommonTools] requestGPSLibraryPermissionWithType:kHDGPSPermissionWhenInUse];

    NSDictionary * userInfo = [notification userInfo];
    if ([[userInfo objectForKey:HDPermissionNameItem] integerValue] == kHDPermissionNameGPS) {
       if ([[userInfo objectForKey:HDPermissionStatusItem] integerValue] == kHDAuthorized) {
            NSLog(@"用户允许访问gps Users are allowed access to GPS");
        }else if ([[userInfo objectForKey:HDPermissionStatusItem] integerValue] == kHDAuthorRestricted){
            NSLog(@"用户被限制访问gps Users are restricted to access to GPS");
        }else if ([[userInfo objectForKey:HDPermissionStatusItem] integerValue] == kHDNotDetermined){
            NSLog(@"用户尚未选择是否允许访问gps User has not chosen to allow access to the GPS");
            NSLog(@"用户不允许访问gps Users do not allow access to GPS");


For clearer use, demo is perfected, and every usage in demo is used.

三、文件结构 file structure

文件名 file name 文件作用 Document function
HDCommonHeader.h 包含所有头文件 Contain all the header files
HDCommonDefine.h 快捷处理的宏定义 Macro definition of shortcut processing
HDCommonToolsConfig 项目定义的枚举类型 Enumerated type of project definition
HDCommonTools 数据处理函数 Data processing function
HDCommonTools+FileHandle 文件处理函数 File processing function
HDCommonTools+Multimedia 多媒体文件处理函数 Multimedia file processing function
HDCommonTools+Permission 权限管理和申请函数 Authority management and application function
HDCommonTools+SystemInfo 手机系统信息及项目信息函数 system information and project information function
HDCommonTools+Appstore appstore相关操作函数 Appstore related operating function
HDCommonTools+Encrypt 加密解密相关操作函数 Encryption and decryption related operating function
HDCommonTools+Date 时间相关操作函数 date related operating function

四、功能概述 An overview of the function

已实现功能可以查看wiki中的功能介绍 :wiki – 功能简介 Function summary

The functionality that has been implemented can look at the functional introduction in Wiki:wiki – 功能简介 Function summary

五、其他 Other


Welcome to exchange and learn from each other


gitHub Url:


My Blog:

六、鸣谢 express gratitude


The project uses many other excellent projects, especially thanks to the following open source projects.

  1. SimulateIDFA
  2. Lunar-Solar-Calendar-Converter

七、重要修改记录 Important revision record


  1. 修改头文件引入模式 Modify header import mode


  1. 调整优化代码 Optimization code
  2. 增加农历公历转换 Increase the transformation of the lunar calendar
  3. 完善日期操作 Perfect date operation


  1. 修改日期比较功能,增加是否比较时间的选项。Modify the date comparison function,Increase the option that whether to ignore the time


  1. 增加时间比较功能 Add the time comparison function
  2. 增加通知权限的状态获取和申请 Add the status and application of notification permissions


  1. 增加aes256加密解密模块 Add aes256 encryption and decryption module
  2. 整理MD5加密解密功能 Sorting the encryption and decryption functions of MD5
  3. 完善demo示例和说明 Perfect the demo examples and instructions


  1. 增加常用宏定义 Adding commonly used macro definitions
  2. 完善demo示例 Perfect the demo examples


  1. 增加了appstore的预览页面和评分 Add the preview page and score of Appstore

Latest podspec

    "name": "HDCommonTools",
    "version": "2.3.2",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "summary": "HDCommonTools,u4e00u53e5u4ee3u7801u5373u53efu5b9eu73b0u591au79cdu5e38u7528u529fu80fd.A short code can achieve a variety of commonly used functions.",
    "homepage": "",
    "authors": {
        "DamonHu": "[email protected]"
    "source": {
        "git": "",
        "tag": "2.3.2"
    "requires_arc": true,
    "platforms": {
        "ios": "9.0"
    "source_files": [
    "frameworks": [

Pin It on Pinterest

Share This