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.

Overview

JLPermissions

Version Platform

Requirements

iOS 8.0+

Installation

JLPermissions is available through CocoaPods, to install it simply add any or all of the following lines to your Podfile:

pod "JLPermissions/Calendar"
pod "JLPermissions/Camera"
pod "JLPermissions/Contacts"
pod "JLPermissions/Facebook"
pod "JLPermissions/Health"
pod "JLPermissions/Location"
pod "JLPermissions/Microphone"
pod "JLPermissions/Notification"
pod "JLPermissions/Photos"
pod "JLPermissions/Reminders"
pod "JLPermissions/Twitter" 

Only add the pod for the permissions you plan on using. Apple rejects apps that include Healthkit API's but do not use them.

Usage

To run the example project; clone the repo, and run pod install, then open JLPermissionsExample.xcworkspace.

The method for asking for each type of permission (other than push notifications) is virtually identical. Here is an example of the API:

typedef NS_ENUM(NSInteger, JLAuthorizationStatus) {
  JLPermissionNotDetermined = 0,
  JLPermissionDenied,
  JLPermissionAuthorized
};

typedef void (^AuthorizationHandler)(bool granted, NSError *error);

- (JLAuthorizationStatus)authorizationStatus;
- (void)authorize:(AuthorizationHandler)completion;
- (void)authorizeWithTitle:(NSString *)messageTitle
                   message:(NSString *)message
               cancelTitle:(NSString *)cancelTitle
                grantTitle:(NSString *)grantTitle
                completion:(AuthorizationHandler)completion;
- (void)displayErrorDialog;

License

JLPermissions is available under the MIT license. See the LICENSE file for more info.

Comments
  • App Store rejection - HealthKit

    App Store rejection - HealthKit

    We just got an App Store rejection:

    We found that your app uses public APIs in a manner not prescribed by Apple, which is not in compliance with the iOS Developer Program License Agreement, as required by the App Store Review Guidelines.

    In particular, section 3.3.1 of the iOS Developer Program License Agreement specifies:

    "Applications may only use Documented APIs in the manner prescribed by Apple and must not use or call any private APIs"

    Specifically, we found your app uses a HealthKit API (HKHealthStore) with no HealthKit features or functionality.

    We actually don't use HealthKit - it's not imported as a framework or in our app's 'Capabilities'. The only mention of HealthKit is in JLPermissions. I suspect the problem is similar to this issue from another project: https://github.com/iosphere/ISHPermissionKit/issues/15 - i.e., merely the mention of HealthKit is enough to upset Apple's reviewers.

    For now, I'm going to remove JLPermissions from my Podfile, and use a custom version which does not refer to HealthKit (for safety, I may also remove references to Calendar, Reminders, Microphone, and Locations)

    opened by cannyboy 10
  • UIUserNotificationSettings permissions only

    UIUserNotificationSettings permissions only

    Hey there,

    I'm trying to get this to work with UIUserNotificationSettings permissions only (I don't want/need remote notifications, just local ones). I'm using Swift, this is what I'm doing:

    JLNotificationPermission.sharedInstance().remoteNotificationType = UIRemoteNotificationType.None
    JLNotificationPermission.sharedInstance().userNotificationSettings = UIUserNotificationSettings(forTypes: UIUserNotificationType.Sound | UIUserNotificationType.Alert, categories: nil)
    

    After that I call the authorizeWithTitle() method. If I don't allow the permission, I get the expected behaviour. But as soon as I allow system permissions, I don't get anything printed. When I check for the authorizationStatus(), it is set to JLPermissionDenied.

    Any ideas what possibly needs changing?

    opened by jyounus 7
  • Updated for iOS 8.

    Updated for iOS 8.

    Includes permission checks for Facebook, Microphone Access and Health the same way as all the other checks. Also fixes warnings related to notification and location access.

    opened by sachinkesiraju 7
  • Fixed a bug where permissions were not checked properly for Notifications

    Fixed a bug where permissions were not checked properly for Notifications

    Notifications were not checked against the system API. Instead, they were only being checked against what the library stored in NSUserDefaults, rendering the result unreliable most of the time.

    This commit fixes that issue.

    opened by rahuljiresal 5
  • Make authorization fail if location services is disabled.

    Make authorization fail if location services is disabled.

    Steps to reproduce:

    1. Enable location services, ask user for location permission, and gained.
    2. Disable location services, restart app, ask user for location permission, still gained, but failed to get the location data.

    Should we do this? I don't know if we can conflate the location services enabled and authorized state .

    opened by VincentSit 4
  • Adding override for custom settings

    Adding override for custom settings

    We have interactive notifications in our app and need to supply custom settings to register for notifications. I preserved old functionality, and added an overload. Want to take a look and merge?

    Thanks! Justin

    opened by jfyles 4
  • JLNotificationPermission -- needs to call [[UIApplication sharedApplication] registerForRemoteNotifications]?

    JLNotificationPermission -- needs to call [[UIApplication sharedApplication] registerForRemoteNotifications]?

    I was having issues grabbing the device's push token from - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(nonnull NSData *)deviceToken and I found out that it only worked after calling [[UIApplication sharedApplication] registerForRemoteNotifications].

    Doesn't JLNotificationPermission need to call [[UIApplication sharedApplication] registerForRemoteNotifications] in order to retrieve the device's push token for remote notifications? Let me know if I'm doing this wrong. Thanks for the great work @jlaws!

    opened by kevinnguy 3
  • Ensure UIAlertView show on main thread.

    Ensure UIAlertView show on main thread.

    Recently I found a problem, if I check user permissions in the background thread, UIAlertView will not be displayed.

    Although this is common sense, I think the library should do some appropriate precautions to prevent such problems(rather than let users to do this).

    opened by VincentSit 3
  • Push Notifications

    Push Notifications

    I'm trying to get my head around the push notification part of JLPermissions.

    From what I can see [[JLPermissions sharedInstance] notificationsAuthorized] will return NO if my app has notifications enabled in a previous version, which didn't use JLPermissions.

    MyApp 1.1 (NO JLPermissions)
    (user agrees to permissions)
    MyApp 1.2 (WITH JLPermissions)
    (JLPermissions assumes user has not agreed)
    

    Should I also check the systems's push notification status ( using this answer on stack overflow http://stackoverflow.com/a/9898632/121646 ) before attempting with either of the authorizeNotifications methods?

    opened by cannyboy 3
  • `completionHandler` gets called twice.

    `completionHandler` gets called twice.

    @jlaws apparently this piece of code

    [library enumerateGroupsWithTypes:ALAssetsGroupAll
              usingBlock:^(ALAssetsGroup *assetGroup, BOOL *stop) {
                  *stop = YES;
                  self.photosCompletionHandler(true, nil);
              }
    

    Gets called more than once; apparently the *stop = YES; is not working as expected (I'm assuming).

    But on my tests I'm showing the custom UIAlertView; after tapping "allow" I'm getting the system's dialog (so far so good); upon allowing again the photosCompletionHandler gets called twice. (at least).

    opened by esttorhe 3
  • Fixed iOS 7 microphone permission

    Fixed iOS 7 microphone permission

    The microphone permission would always return not determined when calling authorizationStatus. Fixed a few other things such as the labels in the example and the missing auto layout for the last three permissions.

    opened by pmairoldi 2
Owner
Joe L
Joe L
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable

Q: How will my calendar dateCells look with this library? A: However you want them to look. More Images Features Range selection - select dates in a r

PatchTheCode 7.3k Jan 2, 2023
Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events

Malendar is a personal calendar app that connects to your default calendar and lets you add/delete events. It will gather events from your default iOS calendar.

Chase 194 Jan 4, 2023
RCalendarPicker A date picker control, Calendar calendar control, select control, calendar, date selection, the clock selection control.

RCalendarPicker RCalendarPicker Calendar calendar control, select control, calendar, date selection, the clock selection control. 日历控件 ,日历选择控件,日历,日期选择

杜耀辉 131 Jul 18, 2022
A declarative, performant, iOS calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-featured calendar apps.

HorizonCalendar A declarative, performant, calendar UI component that supports use cases ranging from simple date pickers all the way up to fully-feat

Airbnb 2.2k Jan 4, 2023
Simple customizable calendar component in Swift :calendar:

Koyomi Koyomi is a simple calendar view framework for iOS, written in Swift ?? Content Features Demo App Usage introduction : Change displayed month,

Shohei Yokoyama 741 Dec 24, 2022
An open source calendar framework for iOS, with support for customization, IBDesignable, Autolayout, and more.

About MBCalendarKit is a calendar control written in Objective-C with modern best practices and Swift interoperability in mind. It offers a flexible c

Moshe 563 Oct 27, 2022
A calendar based heatmap which presenting a time series of data points in colors.

Calendar Heatmap Introduction CalendarHeatmap is a calendar based heatmap which presenting a time series of data points in colors, inspired by Github

null 159 Dec 21, 2022
Google Photos "takeout" doesn't retain created/modified dates of media.

GoogleTakeoutMediaDateCorrector Google Photos "takeout" doesn't retain created/modified dates of media. At least they do export this in a separate jso

Joshua Liebowitz 0 Dec 27, 2021
Calendar View - It's lightweight and simple control with supporting Locale and CalendarIdentifier.

iOS Calendar It's lightweight and simple control with supporting Locale and CalendarIdentifier. There're samples for iPhone and iPad, and also with us

Maksym Bilan 159 Dec 22, 2022
📅 Calendar for iOS, iPadOS and macOS in Swift

CalendarKit CalendarKit is a Swift calendar UI library for iOS, iPadOS and Mac Catalyst. It looks similar to the Apple Calendar app out-of-the-box, wh

Richard Topchii 2.2k Jan 5, 2023
A fully customizable iOS calendar library, compatible with Objective-C and Swift

Table of contents Screenshots Installation Pre-knowledge Support Contact Screenshots iPhone iPad Safe Orientation Today Extension iOS8/9 iOS10 Interac

Wenchao Ding 10.2k Jan 2, 2023
A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.

A library that expresses a github contribution calendar through an array of dates. Supports iOS and macOS.

jasu 45 Dec 20, 2022
CalendarApp Swift - Made a calendar app in swift, completely from scratch using UIStackView and UICollectionView

CalendarApp_Swift Made a calendar app in swift, completely from scratch using UI

Arnav Chhokra 1 Feb 4, 2022
A SwiftUI calendar view that allows month switching and date picking.

Selectable Calendar View A SwiftUI calendar view that allows month switching and date picking. Usage You can simply add this repository to your projec

シュンジョーァ 10 Jul 21, 2022
An Easy to Use Calendar for iOS (Swift 5.0)

This is an easy to use, "just drag and drop it in your code" type of calendar for iOS. It supports both vertical and horizontal scrolling, as well as

Michael Michailidis 525 Dec 23, 2022
SwiftUI Simple Calendar / Date Picker for iOS

RKCalendar RKCalendar is a SwiftUI Calendar / Date Picker for iOS. Features include: minimum and maximum calendar dates selectable, single date select

null 453 Dec 28, 2022
A custom visual calendar for iOS 8+ written in Swift (>= 4.0).

Overview Screenshots GIF Demo Installation Usage Architecture Version matrix Advanced API For contributors Screenshots GIF Demo Installation CocoaPods

null 3.5k Dec 24, 2022
iOS 7+ Calendar (Date Picker) with Infinite Scrolling.

RSDayFlow iOS 7 Calendar with Infinite Scrolling. Only need 4 lines of code to set up. RSDayFlow is a slim fork of DayFlow with updates and extensions

Ruslan Skorb 844 Sep 14, 2022
An availability calendar implementation for iOS

NWCalendarView NWCalendar View is an iOS control that displays a calendar. It is perfect for appointment or availibilty selection. It allows for selec

Nicholas Wargnier 60 May 27, 2021