Bug 43897 - Crash when requesting access to calendar
Summary: Crash when requesting access to calendar
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Samples ()
Version: XI 9.99 (iOS 10 previews)
Hardware: PC Mac OS
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: German
URL:
Depends on: 42792
Blocks:
  Show dependency tree
 
Reported: 2016-08-31 12:44 UTC by Christer Nordvik
Modified: 2016-10-06 15:46 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Christer Nordvik 2016-08-31 12:44:51 UTC
We have code that has worked for years but now crashes on iOS 10. I made a sample app that requests access to the calendar on iOS 10 with latest alpha and it crashes with the sample code from here: 

https://developer.xamarin.com/guides/ios/platform_features/introduction_to_event_kit/ 

I couldn't find anything regarding iOS 10 changes to EventKit and authorization or did I miss something? 

App.Current.EventStore.RequestAccess(EKEntityType.Event,
	(bool granted, NSError err) =>
	{
		if (granted)
		{
			InvokeOnMainThread(() =>
			{

			});
		}
		else
		{
			InvokeOnMainThread(() =>
			{

				return;
			});
		}

	});


2016-08-31 14:40:08.880 TestAddCal[62476:11821482] critical: 
Native stacktrace:

2016-08-31 14:40:08.887 TestAddCal[62476:11821482] critical: 	0   TestAddCal                          0x001ae56d mono_handle_native_sigsegv + 317
2016-08-31 14:40:08.887 TestAddCal[62476:11821482] critical: 	1   TestAddCal                          0x001b8371 sigabrt_signal_handler + 161
2016-08-31 14:40:08.887 TestAddCal[62476:11821482] critical: 	2   libsystem_platform.dylib            0x0b25879b _sigtramp + 43
2016-08-31 14:40:08.888 TestAddCal[62476:11821482] critical: 	3   ???                                 0xffffffff 0x0 + 4294967295
2016-08-31 14:40:08.888 TestAddCal[62476:11821482] critical: 	4   libsystem_c.dylib                   0x0aef8137 abort + 141
2016-08-31 14:40:08.888 TestAddCal[62476:11821482] critical: 	5   libsystem_sim_kernel.dylib          0x0afb9fd7 __interposition_sim_fallback_abort_with_payload + 0
2016-08-31 14:40:08.888 TestAddCal[62476:11821482] critical: 	6   libsystem_sim_kernel.dylib          0x0afb9ff7 __interposition_sim_fallback_abort_with_payload + 32
2016-08-31 14:40:08.889 TestAddCal[62476:11821482] critical: 	7   TCC                                 0x0c8c2621 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 236
2016-08-31 14:40:08.890 TestAddCal[62476:11821482] critical: 	8   TCC                                 0x0c8c2535 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 0
2016-08-31 14:40:08.890 TestAddCal[62476:11821482] critical: 	9   TCC                                 0x0c8c56b9 __tccd_send_block_invoke + 292
2016-08-31 14:40:08.890 TestAddCal[62476:11821482] critical: 	10  libxpc.dylib                        0x0b10a79c _xpc_connection_reply_callout + 45
2016-08-31 14:40:08.890 TestAddCal[62476:11821482] critical: 	11  libxpc.dylib                        0x0b101a97 _xpc_connection_call_reply + 32
2016-08-31 14:40:08.890 TestAddCal[62476:11821482] critical: 	12  libdispatch.dylib                   0x0ae196ef _dispatch_client_callout + 14
2016-08-31 14:40:08.890 TestAddCal[62476:11821482] critical: 	13  libdispatch.dylib                   0x0adfec60 _dispatch_queue_override_invoke + 777
2016-08-31 14:40:08.891 TestAddCal[62476:11821482] critical: 	14  libdispatch.dylib                   0x0ae004bc _dispatch_root_queue_drain + 384
2016-08-31 14:40:08.891 TestAddCal[62476:11821482] critical: 	15  libdispatch.dylib                   0x0ae002d4 _dispatch_worker_thread3 + 134
2016-08-31 14:40:08.891 TestAddCal[62476:11821482] critical: 	16  libsystem_pthread.dylib             0x0b26825c _pthread_wqthread + 1050
2016-08-31 14:40:08.891 TestAddCal[62476:11821482] critical: 	17  libsystem_pthread.dylib             0x0b265f56 start_wqthread + 34
2016-08-31 14:40:08.891 TestAddCal[62476:11821482] critical:
Comment 1 Sebastien Pouliot 2016-08-31 14:00:02 UTC
> __CRASHING_DUE_TO_PRIVACY_VIOLATION__

^ that's in the stack trace.

Check your device logs, you should see the Info.plist key that iOS 10 expect to be set in order to allow your app (when build against the iOS 10 SDK) to access restricted resources.

Add the key mentioned in your Info.plist (with a description of why you request access) and it should execute fine.
Comment 2 Sebastien Pouliot 2016-08-31 14:01:29 UTC
UI for those key will be available in a later build of XS
https://bugzilla.xamarin.com/show_bug.cgi?id=42792
Comment 3 Sebastien Pouliot 2016-08-31 19:22:08 UTC
<Error>: This app has crashed because it attempted to access privacy-sensitive data without a usage description.  The app's Info.plist must contain an NSCalendarsUsageDescription key with a string value explaining to the user how the app uses this data.

^ ran the sample and it confirmed what I thought. Add the key above and it will be fine (and show an alert, that include your comment, for the user to authorize access).

c.c. Oleg to update the sample
Comment 4 Sebastien Pouliot 2016-09-19 17:34:38 UTC
sample issue, fix does not have to be in sync with any cycle, updating milestone
Comment 5 German 2016-10-04 21:22:04 UTC
Fixed, waiting for merge: https://github.com/xamarin/ios-samples/pull/122
Comment 6 Oleg Demchenko 2016-10-06 15:46:01 UTC
Merged, thanks German!