Skip to content
프로젝트

rsattar/ClusterPrePermissions

GitHub에서 보기

소개

Cluster의 재사용 가능한 사전 권한 요청 유틸리티로, 개발자가 시스템 권한 요청을 보내기 전에 자체 대화상자에서 사용자에게 사진 또는 연락처 접근 권한을 요청할 수 있습니다. iOS 권한을 요청하는 다양한 방법을 설명한 Cluster의 Medium 게시물을 바탕으로 합니다: https://medium.com/p/96fa4eb54f2c

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
-2
in 15 days
-4
in 1 month
-4

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

ClusterPrePermissions

Cluster's reusable pre-permissions utility that lets developers ask the users on their own dialog for photos or contacts access, before making the system-based request. This is based on Cluster's post The Right Way to Ask Users for iOS Permissions.

Supported permissions:
  • Photo Library
  • Camera
  • Microphone
  • Contacts List
  • Events
  • Location

Update

With Apple's new review guidelines, you'll need to include usage descriptions for each of the frameworks that ClusterPrePermissions supports, whether or not you're actually using them. See Issue #34 for more info.

Why use Pre-Permissions?

On iOS, when your code tries to access the Camera Roll or the Address Book, the system automatically shows an alert to the user.

If the user says "Don't Allow" to this alert, you have burned your one-and-only chance to get that access. The user will have to jump through a 5-step process outside of your app to re-enable access, which they will rarely, if ever, do.

Often the user wasn't event expecting the access alert, and by habit will tap "Don't Allow". This is a lose-lose scenario for both you and your user.

At Cluster, we’ve had a lot of success asking for permissions using our own UI before popping the iOS dialogs.

For photos alone, 46% of people who denied access in a pre-permissions dialog ended up granting access when asked at a better time later.

How Pre-Permissions Works

This utility simply wraps your code with a "pre-permission" alert, if needed. When you need to ask for photo access, for example, this utility essentially just asks them twice.

image

Even though it seems annoying to ask twice, at Cluster we almost completely eliminated the possibility of a user tapping “Don’t Allow”, leaving the door open for us to win them back in the future. And for what it’s worth, in live user tests, not a single test subject hesitated (or expressed confusion) when the second dialog appeared.

Adding ClusterPrePermissions to your project

CocoaPods

CocoaPods is the recommended way to add ClusterPrePermissions to your project.

  1. Add a pod entry for ClusterPrePermissions to your Podfile pod 'ClusterPrePermissions', '~> 0.1'
  2. Install the pod(s) by running pod install
  3. Include ClusterPrePermissions wherever you need it with #import <ClusterPrePermissions/ClusterPrePermissions.h>

Source Files

Add ClusterPrePermissions.h and ClusterPrePermissions.m into your project.

  1. Download the latest code, using git clone.
  2. Open your project in Xcode, then drag and drop ClusterPrePermissions.h and ClusterPrePermissions.monto your project (Make sure to select Copy items when asked if you extracted the code archive outside of your project.)
  3. In your classes where you need ClusterPrePermissions, add it with #import "ClusterPrePermissions.h"

Usage

CLPermissions checks the authorization status of photos and contacts, and, given a block callback, will return with the result. If authorization status is "not determined", the utility will show a configurable UIAlertView that asks for "pre-permission" before making the actual system request.

If the authorization status already unchangeable, your block will just be called back. You can check the userDialogResult and systemDialogResult to see what happened. If both are ClusterDialogResultNoActionTaken, then it means the access was already denied or granted by the system.

ClusterPrePermissions *permissions = [ClusterPrePermissions sharedPermissions];
[permissions showPhotoPermissionsWithTitle:@"Access your photos?"
                                   message:@"Your message here"
                           denyButtonTitle:@"Not Now"
                          grantButtonTitle:@"Give Access"
                         completionHandler:^(BOOL hasPermission,
                                             ClusterDialogResult userDialogResult,
                                             ClusterDialogResult systemDialogResult) {
                             if (hasPermission) {
                                 // Continue with your code here
                             } else {
                             	  // Handle access not being available
                             }
                         }];

관련 프로젝트 살펴보기

불러오는 중…