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.

Overview

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

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
                             }
                         }];
Comments
  • Microphone permission not working

    Microphone permission not working

    It appears that the microphone permission is not working. To reproduce this, I simply modified the PermissionsTestViewController.m file and changed the [permissions showPhotoPermissionsWithTitle...] call to [permissions showMicrophonePermissionsWithTitle...]

    No other changes. Now, the UIAlert fires. But no matter which option I select -- 'Not Now' or 'Give Access' -- user action is always denied and system action is always 'no action taken'. And hasPermission is, therefore, always NO.

    Any ideas?

    opened by kwade101 3
  • Addded AV (Camera and Microphone) Permissions check

    Addded AV (Camera and Microphone) Permissions check

    Added the changes that @tromg suggested, modifying them to support both Camera and Microphone. I also added all the method headers to the private interface. There is both a generic showAVPermissionsWithType: method as well as showCameraPermissionsWithTitle: and showMicrophonePermissionsWithTitle: methods.

    opened by dmorrow 3
  • location access still not work?

    location access still not work?

    Hi I have updated ClusterPrePermissions to 0.2 but still got no response while trying to get location access on iOS 8.0.0, it seems that showLocationPermissionsForAuthorizationType does not exist in the cocoapods version. Anyone else getting this problem?

    opened by liweihan 3
  • Added iOS 8 support for location service requests

    Added iOS 8 support for location service requests

    Hi there,

    according to Apples documentation of CLLocationManager (https://developer.apple.com/library/prerelease/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/) it is required to call either requestWhenInUseAuthorization or requestAlwaysAuthorization on a CLLocationManager before you start updating the location under iOS 8. It is also necessary to define - depending on the chosen authorization type - either NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription in the projects Info.plist.

    I have added an enum ClusterLocationAuthorizationType as well as a new method to request the permissions for a specific authorization type. Backwards compatiblity is maintained by letting the former method definition choose ClusterLocationAuthorizationTypeAlways by default.

    Cheers, Tom

    opened by tomknig 3
  • Using UIAlertController if min iOS version >= iOS 8

    Using UIAlertController if min iOS version >= iOS 8

    Now all warnings of using UIAlertView have gone. Added ClusterAlertView that handles using UIAlertView or UIAlertController based on minimum iOS supported.

    opened by hossamghareeb 2
  • kCLAuthorizationStatusAuthorized deprecated in 8.0 SDK

    kCLAuthorizationStatusAuthorized deprecated in 8.0 SDK

    locationAuthorizationStatusPermitsAccess: is referencing a deprecated constant (kCLAuthorizationStatusAuthorized) which causes a compiler warning. Would be nice if this could be fixed (with a check for __IPHONE_8_0 etc.).

    opened by matthewreagan 2
  • Events and Reminders Implementation + Some Utility Methods

    Events and Reminders Implementation + Some Utility Methods

    • Added implementation for events and reminders
    • Added Utility methods to quickly check authorization status of Photos, Contacts, Events and location permissions
    opened by asifmujteba 2
  • Fix broken headings in Markdown files

    Fix broken headings in Markdown files

    GitHub changed the way Markdown headings are parsed, so this change fixes it.

    See bryant1410/readmesfix for more information.

    Tackles bryant1410/readmesfix#1

    opened by bryant1410 1
  • Result block is never called when permission was granted or denied before

    Result block is never called when permission was granted or denied before

    Here is what I did:

    var permissions = ClusterPrePermissions.sharedPermissions()
          permissions.showPhotoPermissionsWithTitle("1Access your photos?", message: "1Your message here", denyButtonTitle: "Not Now", grantButtonTitle: "Give Access") { (hasPermission:Bool, userDialogResult:ClusterDialogResult, systemDialogResult:ClusterDialogResult) -> Void in
    
            println("result block")
    
            if hasPermission {
              println("hasPermission")
              // Continue with your code here
            }
            else {
              // Handle access not being available
              println(" no Permission")
            }
    
          }
    

    The Result block is never called when permission was granted or denied before.

    opened by confile 1
  • Requesting new release

    Requesting new release

    Hi! This is a great project, would you make a new tag and push to cocoapods as a new version? I'm missing the location services permissions from the cocoapods version.

    Thanks!

    opened by adelinofaria 1
  • Correct the spelling of CocoaPods in README

    Correct the spelling of CocoaPods in README

    This pull requests corrects the spelling of CocoaPods 🤓 https://github.com/CocoaPods/shared_resources/tree/master/media

    opened by ReadmeCritic 0
  • Cluster.Co app update

    Cluster.Co app update

    hello, not sure if I'm in the right place but I use Cluster often.... I noticed there's no update and there hasn't been in 2 years. can we please get an update?

    opened by ourcrazylife 0
  • Apple App Store Warning

    Apple App Store Warning

    I received this warning when I recently submitted an app that uses ClusterPrePermissions from the app store:

    This app attempts to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCalendarsUsageDescription key with a string value explaining to the user how the app uses this data.

    I'm not using the Calendar permissions at all, I'm only using microphone permissions.

    bug enhancement 
    opened by tielur 2
  • Deprecation warnings in 9.0?

    Deprecation warnings in 9.0?

    In my project running 9.0, I imported ClusterPrePermissions, but I got dozens of warnings of deprecations (UIAlertView, ALAuthorizationStatus, ALAssetsLibrary, etc.). I'm not sure how open source code is supposed to deal with OS version changes, so what is the best way to deal with this, and does this warrant an issue in the future? Thanks.

    enhancement 
    opened by shanemileham 3
  • showPushNotificationPermissions second time is always False

    showPushNotificationPermissions second time is always False

    I am using showPushNotificationPermissionsWithType method for a pre-validation of the push notifications. The first time the method is executed works fine. But if I request again the permission check then, the result is always false.

    I changed the completionHandler((status == ClusterAuthorizationStatusUnDetermined), to completionHandler((status == ClusterAuthorizationStatusAuthorized),

    and worked for me.

    opened by ivanbatura 1
  • Did you have a plan to support Bluetooth permissions?

    Did you have a plan to support Bluetooth permissions?

    ClusterPrePermissions now supported Photo Library/Camera/Microphone/Contacts List/Events/Location, did you have a plan to support Bluetooth permissions?

    opened by Sean-Wang 1
Owner
Riz
Riz
A unified API to ask for permissions on iOS

Permission exposes a unified API to request permissions on iOS. Usage • Example • Installation • License Usage Permission Permission.swift PermissionS

Damien 2.9k Dec 27, 2022
A unified API to ask for permissions on iOS

PAPermissions PAPermissions is a fully customizable and ready-to-run library to handle permissions through a ViewController Right now it supports out

Pasquale Ambrosini 694 Oct 17, 2022
The application shows all contacts from the iPhone Contact list

Contacts The application shows all contacts from the iPhone Contact list. You can see more details about contact by tapping in contact. Every change i

Karen 0 Nov 24, 2021
A set of SwiftUI dynamic property wrappers that provide a more familiar API for accessing the Contacts framework. (iOS, watchOS, macOS)

Connections Also available as a part of my SwiftUI+ Collection – just add it to Xcode 13+ A set of SwiftUI dynamic property wrappers that provide a mo

SwiftUI+ 9 Oct 7, 2022
AREK is a clean and easy way to request any kind of iOS permission (with some nifty features 🤖)

AREK is a clean and easy to use wrapper over any kind of iOS permission written in Swift. Why AREK could help you building a better app is well descri

Ennio Masi 961 Dec 20, 2022
Make permission request easier.

Proposer Proposer provides a single API to request permission for access Camera, Photos, Microphone, Contacts, Reminders, Calendar, Location or Notifi

null 855 Nov 3, 2022
Request the Location Services via a 3D 360° flyover MKMapView 🗺

STLocationRequest STLocationRequest is a simple and elegant way to request the users location services at the very first time. The STLocationRequestCo

Sven Tiigi 640 Dec 6, 2022
An iOS pre-permissions utility that lets developers ask users on their own dialog for calendar, contacts, location, photos, reminders, twitter, push notifications and more, before making the system-based permission request.

An iOS pre-permissions utility that lets developers ask users on their own dialog for calendar, contacts, location, photos, reminders, twitter, push notifications and more, before making the system-based permission request.

Joe L 420 Dec 22, 2022
Ask permissions on Swift. Available List, Dialog & Native interface. Can check state permission.

SPPermissions About Library for ask permissions. You can check state of permissions, available .authorized, .denied & .notDetermined. Available ready-

Ivan Vorobei 5.1k Dec 30, 2022
PowerUp is an educational choose-your-own-adventure game that utilizes a users uploaded curriculum to empower pre-adolescents to take charge of their reproductive health.

PowerUp is an educational choose-your-own-adventure game that utilizes a users uploaded curriculum to empower pre-adolescents to take charge of their reproductive health. This is the iOS version of the game.

AnitaB.org Open Source 39 Sep 26, 2022
SharedImages Screen grabs Main Features Private & self-owned social media Users store their images in their own cloud storage (Dropbox or Google Drive

SharedImages Screen grabs Main Features Private & self-owned social media Users store their images in their own cloud storage (Dropbox or Google Drive

Christopher Prince 12 Feb 10, 2022
The "Ask Me" is simple iOS application which shows answer on the screen everytime when the user press the ask button

The "Ask Me" is simple iOS application which shows answer on the screen everytime when the user press the ask button. This application is build and design by Chetan Parate using Xcode and Swift.

Chetan Parate 0 Oct 27, 2021
A unified API to ask for permissions on iOS

Permission exposes a unified API to request permissions on iOS. Usage • Example • Installation • License Usage Permission Permission.swift PermissionS

Damien 2.9k Dec 27, 2022
A unified API to ask for permissions on iOS

PAPermissions PAPermissions is a fully customizable and ready-to-run library to handle permissions through a ViewController Right now it supports out

Pasquale Ambrosini 694 Oct 17, 2022
Allows users to pull in new song releases from their favorite artists and provides users with important metrics like their top tracks, top artists, and recently played tracks, queryable by time range.

Spotify Radar Spotify Radar is an iOS application that allows users to pull in new song releases from their favorite artists and provides users with i

Kevin Li 630 Dec 13, 2022
A highly customizable alert dialog controller that mimics Snapchat's alert dialog.

AZDialogViewController A highly customizable alert dialog controller that mimics Snapchat's alert dialog. Screenshots Installation CocoaPods: pod 'AZD

Antonio Zaitoun 771 Dec 11, 2022
CodePathPrework - The pre-work assignment for the CodePath program. Involves making a tip calculator using XCode.

Pre-work - Tip Calculator Tip Calculator is a tip calculator application for iOS. Submitted by: David Zhu Time spent: 3 hours spent in total User Stor

null 0 Jan 3, 2022
Simplifies iOS user permission requests (location, push notifications, camera, contacts, calendar, photos, etc).

ICanHas Swift 4 library that simplifies iOS user permission requests (push notifications, location, camera, photo library, contacts, calendar). Instal

Adolfo Rodriguez 91 Jun 2, 2022
InstagramLogin allows iOS developers to authenticate users by their Instagram accounts.

InstagramLogin handles all the Instagram authentication process by showing a custom UIViewController with the login page and returning an access token that can be used to request data from Instagram.

Ander Goig 67 Aug 20, 2022
Jorge Ovalle 305 Oct 11, 2022