EKEventStore permission prompt - ios

According to the calendar and events programming guide from Apple:
On iOS 6 and later, we must request access to use the user’s Calendar database with the requestAccessToEntityType:completion: method after the event store is initialized.
It is also stated that the user is only prompted the first time the app requests access to an entity type; any subsequent instantiations of EKEventStore uses existing permissions. Your app is not blocked while the user decides to grant or deny permission.
My question here is: is there a way for us to prompt the user again to request access to an entity type?
It seems bad that I have to put a UIAlertView to ask the user to go to Settings and give the proper permissions.

As it is now, you will not be able to prompt the user again, if the user said no the first time. They will need to go to settings to change their choice. So an alert is a way to do it.

Related

ios - Ask for multiple permissions

My application ask for location and notification permissions.
When user launch the app for first time the location request displays and after notification request displays.
Is there any way to request this better? Maybe an a list like in Android or anything better than I have right now?
You should generally only ask for permissions or check for authorisation when it is required by the app, and not when the user launches the app for the first time. For example, notification permissions could be requested at launch, but location permissions should be requested only when the data is required in your app.
As far as I know, there is no Android-like way to request for permissions.
Edit: You may want to check out third party libraries like ISHPermissionKit and JLPermissions, which provide a more unified approach to asking for user permissions, which is what you might be looking for. But ultimately, I still believe that asking for permission only when it is required is still the way to go.
When your app uses push notification, it will be the first to prompt to user for notification access. Notification Access Pop-Up will prompt at the very beginning of App Launch.
You can ask for location access permission on demand using - CLLocationManager requestWhenInUseAuthorization or AlwaysInUseAuthorization.
If you need to access Camera, Photo Library Access just add privacy usage on your info.plist and iOS will ask for permission accordingly on demand.

If an iOS consumer denies permission to 'Use Current Location', is it technically possible to show the permission dialogue again?

My iOS app wants to display the users current location. Nothing special - but to do so, the first time the app is ran (or more to the point, the first time an MKViewMap in the app is displayed, I guess...) .. the user is asked for permission (which is awesome).
eg.
Now, if the user accidentally says DON'T ALLOW or decides to (later on) give permission ... is there technically a way we can reset their previous decision and when the app is restarted, ask them again automatically when the MKViewMap is next rendered again?
The user can enable or disable that option in the setting of the iphone. To do this, user have to select the Privacy option in the Setting Menu, and then select the Location Services option and than search the desired app to whom user want to enable or disable the permission and perform desired function by switching the toggle button on or off.
As it was a Private API provided from Apple the alert cannot be shown up again. Alternatively, we can check manually and show an alert like this.
The following can be read in the Apple docs:
"...it is recommended that you always call the locationServicesEnabled class method of CLLocationManager before attempting to start either the standard or significant-change location services. If it returns NO and you attempt to start location services anyway, the system prompts the user to confirm whether location services should be re-enabled. Given that location services are very likely to be disabled on purpose, the user might not welcome this prompt."
If I understand it right the alert will pop up everytime you try to get the users location, but it's not recommended to do so.
Link to full post:
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/CoreLocation/CoreLocation.html#//apple_ref/doc/uid/TP40009497-CH2-SW1
No you cannot do so. Rather than this, you can just check the latitude and longitude value and show alert to the user that enable the service from settings.

How to rerequest permission once denied by user

Users can post messages on Facebook using my application. iOS presents the users with the permission dialogue the first time they try to post ("foo app would like to post privately on your behalf" - Don't Allow / OK). Now it seems that this decision is a persisting one. Once this dialogue is completed either way, the user will never be asked again.
Now, as this might have happened out of mistake I don't think this is good enough for the user. Is there a way to initiate this permission dialogue from code somehow?
No. You can create your own dialog telling the user that they must go to the Settings app to change the privacy settings.

iOS photo permissions to ask for second time

I am currently using alasset which asks for permission for first time. If want to pop permission second time or every time when user has blocked it, how it is possible.
there is no way to show the permission prompt the second time.
The best way to handle the permission prompt is that you should explain to the user before triggering the permission prompt (read: call method in the AssetsLibrary framework). If the user still click on "Don't Allow", then you should tell the user how can he/she grant the permission via the Settings app as you cannot invoke the prompt for the second time.
That dialog isn't controlled by the app, so no API for that.
You can reset things as a user in the settings app (IIRC) but no programmatic way.
To get the current authorization status:
[ALAssetsLibrary authorizationStatus];
(+ (ALAuthorizationStatus)authorizationStatus)
Also, methods to get assets taking access error blocks, e.g.:
- (void)assetForURL:(NSURL *)assetURL
resultBlock:(ALAssetsLibraryAssetForURLResultBlock)resultBlock
failureBlock:(ALAssetsLibraryAccessFailureBlock)failureBlock

Asking user permission for accessing their location with iOS when mapView does

I've developed an app using a MapView - when the app starts up, it asks the user to allow their location to be accessed/used without any coding from me. Is this sufficient for permission or should I also specifically ask the user and provide a reason for the access? Will Apple reject the app on submission if I don't specifically make the request and allow the MapView to request this on my behalf?
You don't need to ask the user for permission, iOS does it for you automatically.
You should set the purpose string property in the CLLocationManager object so that when the system asks it can also tell the user why you want their location.
locationManager.purpose = #"Location needed to show zombies that are nearby.";
Set this property before calling startUpdatingLocation so that it gets shown to the user in the system alert that asks for permission to use location.
In the delegate you can implement the method locationManager:didChangeAuthorizationStatus: to know whether the user allowed core location or not.
As of iOS 6, the correct place for the "purpose" message is in the Info plist file.
The NSLocationUsageDescription property should be set with the message to display to users
Apple provides good documentation:
https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html
You don't need to tell the user why their location is being accessed especially if the application is based on location and mapping. With that said it is nice to tell the user what exactly you will do with their data before the permission popup comes up so that hopefully more users will accept.

Resources