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
Related
I am using this method to ask user for the calendar permission requestAccessToEntityType:EKEntityTypeEvent completion:^(BOOL granted, NSError *error) but what i want is that when user clicks on Button named as GrantPermission, then the permission should be granted without showing the alertView which is of IOS builtin, is there any way to do this?
I want to do this because when user clicks on Dont Allow then i show a alertView which says that user have to manually turn on permission from settings and when user manually turns on this permission then the app crashes.
There is no way to grant permission without displaying the native alert view, as it provides an added level of security (without it developers would just be programatically granting permission to everything).
If you want to mitigate against getting into the situation where the user needs to manually grant permission from the Settings app you could display a "pre-permission" alert where you offer the user some information as to why they might want to allow it, followed by actually asking the system for permission which will in turn display the built in alert.
FWIW This isn't my idea, nor is it that new. This TechCrunch article goes into a lot more detail about the UX of asking for permissions on iOS.
Note that you could still end up in the situation where the user needs to manually grant permission - if they "accept" your alert but deny the actual system alert. In this case you will need to figure out why your app is crashing, maybe post another question regarding that.
When the app is first run it asks for permission to access the photos!
What's the reason for that?
One way is run the code one line by one line or Another way is revert code to previous version.
And find from which version, the app become to ask permission at first launch.
Previously, when we enter select photo screen, we would write code to ask the permission.
I also try to add symbolic breakpoints like:
-[UIAlertView initWithTitle:message:delegate:cancelButtonTitle:otherButtonTitles:]
And even find a class dump UIAlertView header in order to add symbolic breakpoint but not work. Add UIAlertController breakpoint also does not work.
The simulator OS is 8.3. And each time I must reset contents and setting to reproduce the issue.
Any hint or good idea will be appreciated!
Finally, I find out the following code cause the iOS system to pop up the "Allow our App to access their photo gallery" dialog. Thanks for Vijay's answer.
[[PHPhotoLibrary sharedPhotoLibrary] registerChangeObserver:self];
Starting with iOS 6, Apple now requires apps to get explicit user permission before accessing Contacts, Calendars, Reminders, and Photos. From the "Data Privacy" section in Apple's iOS 6 Release Notes:
In addition to location data, the system now asks the user’s permission before allowing third-party apps to access certain user data, including:
Contacts
Calendars
Reminders
Photo Library
For contact, calendar, and reminder data, your app needs to be prepared to be denied access to these items and to adjust its behavior accordingly. If the user has not yet been prompted to allow access, the returned structure is valid but contains no records. If the user has denied access, the app receives a NULL value or no data. If the user grants permission to the app, the system subsequently notifies the app that it needs to reload or revert the data.
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.
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.
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.