My react-native app needs to create a calendar event, it doesn't need to view, edit or delete event. I tried to use few react-native libraries which handle calendar but I needed to grant permissions for a calendar in each of them.
I have no knowledge of Objective C or Swift, but I would like to know if it is even possible in either native or react-native way.
Every advice is very appreciated. Thanks!
Short answer is no.
You do need to be granted permission to create a calendar event.
The Human Interface Guidelines section about requesting permissions
Users must grant permission for an app to access personal information, including the current location, calendar, contact information, reminders, and photos. Although people appreciate the convenience of using an app that has access to this information, they also expect to have control over their private data. For example, people like being able to automatically tag photos with their physical location or find nearby friends, but they also want the option to disable such features.
In the apple docs it specifies that you need to add an entry to the info.plist. This text is used when the permission is requested.
Important: If your iOS app links on or after iOS 10.0 and you need to access Calendar data, be sure to include the NSCalendarsUsageDescription key in your Info.plist file.
Your app will crash without this key added to the info.plist.
This is the case for native apps, so the same will apply for react-native.
Related
For example, the VLC app was able to somehow get my username (or device name?) without me ever giving it this info. Here is a screenshot that shows the VLC app greeting me by name in the app switcher. How is this possible if I never gave the app this information? Which API could it be using to obtain this info?
This is possible due to UIDevice class. It doesn't require permissions in order to get some basic system information, after all it's just your name (if you were to ask for location/health data/contacts/etc that would be something else and thus user permission is mandatory).
For more information refer to official documentation here https://developer.apple.com/documentation/uikit/uidevice
That's not VLC but rather iOS.
iOS suggests apps based on time and location of your device. The name is taken from your iCloud Account. VLC is not aware of that banner.
I'm having troubles in order to let my NativeScript app read contacts on iOS. I'm using the library nativescript-contacts in order to read all the entries of the address book and the one called nativescript-permission in order to ask the user the permission to read contacts.
Unfortunately, the latter seems to work only in Android, where everything works fine: a pop-up appears asking the user to allow the reading of contacts and, if the permission is granted, the contacts are displayed in a list.
In iOS instead, I'm not able to ask for contact permission: no dialog box pops out and when I try to use a function of nativescript-contacts (e.g. getAllContacts()), the app freezes.
I've tried searching, but the only thing I can do seems to use some native code in order to get these permissions... but I have no idea how.
May you help me with this?
Thanks!
There are two things you might need:
1st, did you add in the Info.plist file a message for the key Privacy: Contacts usage description ? This will display the message you set to the user when prompted the permission alert.
2nd. You can ask for the permission by calling requestAccess(for:completionHandler:). Check this
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.
I'm trying out this code: http://github.com/akpw/AssetLibraryPhotosViewer to access photos on my iPhone.
However when I run the application, I get an alert that says the application is trying to access my photos - and then I can allow this or decline.
Can I disable this when using the AssetLibrary, or does this message always appear?
If I can't turn this off, and I press "Don't Allow", can I still make the app access my photos?
Following on from answer above. This will appear once. If you allow access then it will not show again and you will have access to the photo's. If you disallow it then you will not be allowed to access this and the alert dialog will not appear again.
This permission can be changed at any time by the user in the settings app (Under Location and Privacy, or a variation of that.) This has been around since iOS 6 I believe.
You are never able to programtically state that access has been granted, the system handles the permissions which are shown to the user.
This is a security feature of the OS that cannot be disabled. If a user does not give your app permission to access the photo library your app will not be able to access any photos. Given this ability your app should be able to handle the situation gracefully from a UI/UX perspective.
For more information take a look at this guide from Apple about iOS security guidelines (page 47 takes about accessing personal data) iOS Security
Is there a standard UIView/controller/dialog provided in iOS SDK for informing the user the app does not have access to X resource and this can be fixed from iOS privacy settings.
I have noticed a consistent view seen in many apps (snapshot below is taken from Viber). I could not find any API that would give me this dialog. I suppose I can just create one but still wanted to double check?
For the particular case I have I want to alert the user if app does not have access to user calendar/ reminders.
(I have a BOOL result in my code that tells me access granted true/false -I have to next alert the user with appropriate UI.)
The public API's UIImagePickerController displays that view if the app doesn't have access to the user's photo library. It's a _UIAccessDeniedView, which is a private class.
As far as I know, the public API doesn't provide an event picker controller, so there's no way to make the system display a similar “standard” view for calendars/reminders in your app.
If you want to set up a similar view yourself, you can extract the lock image using the iOS Artwork Extractor; it's named “UIAccessDeniedViewLock.png”. Warning: copyright infringement. Will Apple care? I have no idea.
This interface can appear for the calendar if you use EKEventEditViewController.