Skip to content

Commit

Permalink
A fix for iOS 10 permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyVerbruggen committed Jun 27, 2016
1 parent 9d96bfd commit 8ab6378
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ From the command prompt go to your app's root folder and execute:
tns plugin add nativescript-calendar
```

## iOS runtime permission reason
You probably have seen a permission popup like this before (this plugin will trigger one as well, automatically):

<img src="ios_permission_custom_reason.png" width="316px" height="180px"/>

iOS 10+ requires not only this popup, but also a _reason_. In this case it's "Custom message from App_Resources".

You can provide your own reason for accessing the calendar by adding something like this to `app/App_Resources/ios/Info.plist`:

```xml
<key>NSCalendarsUsageDescription</key>
<string>My reason justifying fooling around with your calendar</string>
```

_To not crash your app in case you forgot to provide the reason this plugin adds an empty reason to the `.plist` during build. This value gets overridden by anything you specified yourself. You're welcome._


## Usage

If you want a quickstart, [clone our demo app](https://github.com/EddyVerbruggen/nativescript-calendar-demo).
Expand Down
Binary file added ios_permission_custom_reason.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-calendar",
"version": "1.0.5",
"version": "1.0.6",
"description": "Interact with the native calendar. Add, Update, Read, you name it.",
"main": "calendar.js",
"nativescript": {
Expand Down
8 changes: 8 additions & 0 deletions platforms/ios/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSCalendarsUsageDescription</key>
<string/>
</dict>
</plist>

0 comments on commit 8ab6378

Please sign in to comment.