{"id":18302869,"url":"https://github.com/danielhusx/dhauthorizationmanager","last_synced_at":"2025-04-09T10:13:24.102Z","repository":{"id":56907398,"uuid":"196791548","full_name":"DanielHusx/DHAuthorizationManager","owner":"DanielHusx","description":"集合iOS权限请求，可多个权限同时请求","archived":false,"fork":false,"pushed_at":"2019-10-04T08:15:44.000Z","size":139,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2024-03-14T20:51:53.266Z","etag":null,"topics":["authorization","camera","healthshare","ios-authorization","micripohone","siri","usernotification"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanielHusx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-14T04:00:03.000Z","updated_at":"2023-12-15T11:51:38.000Z","dependencies_parsed_at":"2022-08-20T19:50:21.551Z","dependency_job_id":null,"html_url":"https://github.com/DanielHusx/DHAuthorizationManager","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FDHAuthorizationManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FDHAuthorizationManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FDHAuthorizationManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanielHusx%2FDHAuthorizationManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanielHusx","download_url":"https://codeload.github.com/DanielHusx/DHAuthorizationManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248018068,"owners_count":21034048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["authorization","camera","healthshare","ios-authorization","micripohone","siri","usernotification"],"created_at":"2024-11-05T15:23:00.800Z","updated_at":"2025-04-09T10:13:24.081Z","avatar_url":"https://github.com/DanielHusx.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [DHAuthorizationManager](https://github.com/DanielHusx/DHAuthorizationManager)\n\niOS授权集合，可同时请求多授权\n\n\n\n## 支持授权\n\n- [x] Camera: 相机\n- [x] Microphone: 麦克风\n- [x] PhoneLibrary: 相册\n- [x] Contact: 通讯录\n- [x] Calendar: 日历\n- [x] Reminder: 提醒\n- [x] LocationWhenInUse: 试用期间的定位\n- [x] LocationAlways: 始终使用的定位\n- [x] AppleMusic: 媒体库\n- [x] SpeechRecognition: 语音识别\n- [x] Siri\n- [x] Motion: 运动\n- [x] HealthUpdate: 健康更新\n- [x] HealthShare: 健康分享\n- [x] UserNotification: 本地推送\n- [x] BluetoothPeripheral: 蓝牙\n- [x] Cellular: 蜂窝数据\n\n\n\n## 你需要知道的！\n\n### 注意\n\n- **AppleMusic**: 必须用真机测试，不然方法无响应，可能引起内存泄漏\n- **HealthUpdate/HealthShare**: 必须提供`NSSet\u003cHKOjbectType/HKSampleType*\u003e`*参数\n- **UserNotification**: 必须提供`@(UNAuthorizationOptions)`参数\n- **Siri**: 必需打开`项目-\u003eTARGET-\u003eCapabilities-\u003eSiri`，不然点击必崩\n\n\n\n## 安装\n\n```objective-c\npod 'DHAuthorizationManager'\n```\n\n- 当前版本：1.0.1\n\n\n\n## 使用方法\n\n\u003e 注意：必须将DHAuthorizationManager设置为强引用成员属性，授权弹框才能正常显示\n\n### 方法一：使用Block\n\n```objective-c\n#import \"DHAuthorizationManager.h\"\n// 强引用\n@property (nonatomic, strong) DHAuthorizationManager *authorizationManager;\n// 初始化\nself.authorizationManager = [[DHAuthorizationManager alloc] init];\n// 请求权限校验\nDHAuthorizationKey key = DHAuthorizationKeyCamera|DHAuthorizationKeyMicrophone;\n[self.authorizationManager checkAuthorizationForKey:key withParameters:nil completion:^(NSDictionary \u003cNSNumber *, NSNumber *\u003e *_Nonnull result) {\n  // 授权结果result \u003c@(DHAuthorizationKey), @(DHAuthorizationStatus)\u003e\n  // do something...\n}];\n```\n\n### 方法二：使用代理\n\n```objective-c\n#import \"DHAuthorizationManager.h\"\n// 强引用\n@property (nonatomic, strong) DHAuthorizationManager *authorizationManager;\n// 初始化\nself.authorizationManager = [[DHAuthorizationManager alloc] init];\nself.authorizationManager.delegate = self;\n\n// 请求权限校验\nDHAuthorizationKey key = DHAuthorizationKeyCamera|DHAuthorizationKeyMicrophone;\n[self.authorizationManager checkAuthorizationForKey:key withParameters:nil];\n\n/** 代理反馈授权结果result \u003c@(DHAuthorizationKey), @(DHAuthorizationStatus)\u003e */\n- (void)authorizationResult:(NSDictionary \u003cNSNumber *, NSNumber *\u003e *)result {\n  // do something...\n}\n\n```\n\n### \n\n## DHAuthorizationStatus说明\n\n- `DHAuthorizationStatusDefault`: 默认\n- `DHAuthorizationStatusNotDetermined`: 未决定。未曾请求过授权，此时会尝试请求授权\n- `DHAuthorizationStatusAuthorized`: 已授权\n- `DHAuthorizationStatusNotConfigured`: 未配置。info.plist文件未设置相应的键值，用于编码时测试\n- `DHAuthorizationStatusDenied`: 已拒绝。用户已拒绝授权\n- `DHAuthorizationStatusRestricted`: 受限制\n- `DHAuthorizationStatusNotSupported`: 系统版本或硬件不支持\n- `DHAuthorizationStatusSystemSetting`: 未提供授权方法，建议跳转至系统进行设置","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhusx%2Fdhauthorizationmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielhusx%2Fdhauthorizationmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhusx%2Fdhauthorizationmanager/lists"}