EKEventStore 访问请求在 iOS 10 崩溃
EKEventStore access request crashes on iOS 10
所以,我正在为移动设备开发一个 Xamarin 项目,我正在使用 EKEventStore API 创建事件,它在 iOS 8 和 9 上运行良好。
但是在 iOS 10.
请求 EKEVentStore 访问时出了点问题
下面的代码在 iOS 8 和 9 上工作正常,但在 iOS 10 上它崩溃并且没有针对此错误给出具体消息。
Apple 似乎在 iOS 10.
中更改了有关收集此权限的内容
有人遇到过同样的问题或知道这有助于解决问题吗?
谢谢!
EKEntityType type = EKEntityType.Event;
Store = new EKEventStore();
EKAuthorizationStatus status = EKEventStore.GetAuthorizationStatus(type);
if (status != EKAuthorizationStatus.Authorized)
{
if (status == EKAuthorizationStatus.NotDetermined)
{
Store.RequestAccess(type, (bool granted, NSError error) =>
{
//Crashes before entering here
});
return;
}
else
{
//Denied
return;
}
}
输出:
2016-09-30 17:16:25.739 MyApp[3156:115989] critical: Native stacktrace:
2016-09-30 17:16:25.740 MyApp[3156:115989] critical: 0 libmonosgen-2.0.dylib 0x0524e64d mono_handle_native_sigsegv + 317
2016-09-30 17:16:25.741 MyApp[3156:115989] critical: 1 libmonosgen-2.0.dylib 0x052a6321 sigabrt_signal_handler + 161
2016-09-30 17:16:25.741 MyApp[3156:115989] critical: 2 libsystem_platform.dylib 0x07205ebb _sigtramp + 43
2016-09-30 17:16:25.742 MyApp[3156:115989] critical: 3 ??? 0xffffffff 0x0 + 4294967295
2016-09-30 17:16:25.742 MyApp[3156:115989] critical: 4 libsystem_kernel.dylib 0x071e28bc abort_with_payload + 38
2016-09-30 17:16:25.743 MyApp[3156:115989] critical: 5 TCC 0x003ab621 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 236
2016-09-30 17:16:25.743 MyApp[3156:115989] critical: 6 TCC 0x003ab535 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 0
2016-09-30 17:16:25.743 MyApp[3156:115989] critical: 7 TCC 0x003ae6b9 __tccd_send_block_invoke + 292
2016-09-30 17:16:25.744 MyApp[3156:115989] critical: 8 libxpc.dylib 0x0718c79c _xpc_connection_reply_callout + 45
2016-09-30 17:16:25.745 MyApp[3156:115989] critical: 9 libxpc.dylib 0x07183a97 _xpc_connection_call_reply + 32
2016-09-30 17:16:25.746 MyApp[3156:115989] critical: 10 libdispatch.dylib 0x06ea36ef _dispatch_client_callout + 14
2016-09-30 17:16:25.746 MyApp[3156:115989] critical: 11 libdispatch.dylib 0x06e88c60 _dispatch_queue_override_invoke + 777
2016-09-30 17:16:25.747 MyApp[3156:115989] critical: 12 libdispatch.dylib 0x06e8a4bc _dispatch_root_queue_drain + 384
2016-09-30 17:16:25.748 MyApp[3156:115989] critical: 13 libdispatch.dylib 0x06e8a2d4 _dispatch_worker_thread3 + 134
2016-09-30 17:16:25.748 MyApp[3156:115989] critical: 14 libsystem_pthread.dylib 0x07215d6e _pthread_wqthread + 1070
2016-09-30 17:16:25.749 MyApp[3156:115989] critical: 15 libsystem_pthread.dylib 0x0721591a start_wqthread + 34
2016-09-30 17:16:25.750 MyApp[3156:115989] critical:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
对于活动,您需要在 info.plist 中添加正确的密钥,在本例中为 NSCalendarsUsageDescription
,其中的值是对您请求此类权限的原因的简短描述。
希望这能解决你的问题,我遇到了完全相同的问题(也是 Xamarin),这解决了它。
所以,我正在为移动设备开发一个 Xamarin 项目,我正在使用 EKEventStore API 创建事件,它在 iOS 8 和 9 上运行良好。 但是在 iOS 10.
请求 EKEVentStore 访问时出了点问题下面的代码在 iOS 8 和 9 上工作正常,但在 iOS 10 上它崩溃并且没有针对此错误给出具体消息。
Apple 似乎在 iOS 10.
中更改了有关收集此权限的内容有人遇到过同样的问题或知道这有助于解决问题吗?
谢谢!
EKEntityType type = EKEntityType.Event;
Store = new EKEventStore();
EKAuthorizationStatus status = EKEventStore.GetAuthorizationStatus(type);
if (status != EKAuthorizationStatus.Authorized)
{
if (status == EKAuthorizationStatus.NotDetermined)
{
Store.RequestAccess(type, (bool granted, NSError error) =>
{
//Crashes before entering here
});
return;
}
else
{
//Denied
return;
}
}
输出:
2016-09-30 17:16:25.739 MyApp[3156:115989] critical: Native stacktrace:
2016-09-30 17:16:25.740 MyApp[3156:115989] critical: 0 libmonosgen-2.0.dylib 0x0524e64d mono_handle_native_sigsegv + 317
2016-09-30 17:16:25.741 MyApp[3156:115989] critical: 1 libmonosgen-2.0.dylib 0x052a6321 sigabrt_signal_handler + 161
2016-09-30 17:16:25.741 MyApp[3156:115989] critical: 2 libsystem_platform.dylib 0x07205ebb _sigtramp + 43
2016-09-30 17:16:25.742 MyApp[3156:115989] critical: 3 ??? 0xffffffff 0x0 + 4294967295
2016-09-30 17:16:25.742 MyApp[3156:115989] critical: 4 libsystem_kernel.dylib 0x071e28bc abort_with_payload + 38
2016-09-30 17:16:25.743 MyApp[3156:115989] critical: 5 TCC 0x003ab621 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 236
2016-09-30 17:16:25.743 MyApp[3156:115989] critical: 6 TCC 0x003ab535 __CRASHING_DUE_TO_PRIVACY_VIOLATION__ + 0
2016-09-30 17:16:25.743 MyApp[3156:115989] critical: 7 TCC 0x003ae6b9 __tccd_send_block_invoke + 292
2016-09-30 17:16:25.744 MyApp[3156:115989] critical: 8 libxpc.dylib 0x0718c79c _xpc_connection_reply_callout + 45
2016-09-30 17:16:25.745 MyApp[3156:115989] critical: 9 libxpc.dylib 0x07183a97 _xpc_connection_call_reply + 32
2016-09-30 17:16:25.746 MyApp[3156:115989] critical: 10 libdispatch.dylib 0x06ea36ef _dispatch_client_callout + 14
2016-09-30 17:16:25.746 MyApp[3156:115989] critical: 11 libdispatch.dylib 0x06e88c60 _dispatch_queue_override_invoke + 777
2016-09-30 17:16:25.747 MyApp[3156:115989] critical: 12 libdispatch.dylib 0x06e8a4bc _dispatch_root_queue_drain + 384
2016-09-30 17:16:25.748 MyApp[3156:115989] critical: 13 libdispatch.dylib 0x06e8a2d4 _dispatch_worker_thread3 + 134
2016-09-30 17:16:25.748 MyApp[3156:115989] critical: 14 libsystem_pthread.dylib 0x07215d6e _pthread_wqthread + 1070
2016-09-30 17:16:25.749 MyApp[3156:115989] critical: 15 libsystem_pthread.dylib 0x0721591a start_wqthread + 34
2016-09-30 17:16:25.750 MyApp[3156:115989] critical:
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
对于活动,您需要在 info.plist 中添加正确的密钥,在本例中为 NSCalendarsUsageDescription
,其中的值是对您请求此类权限的原因的简短描述。
希望这能解决你的问题,我遇到了完全相同的问题(也是 Xamarin),这解决了它。