问题
I've built a xamarin.ios app. The app has been working absolutely fine. There have been no code changes and out of the blue, the app now crashes when accessing the camera. I have no idea why this is happening, could anyone shed some light on this problem? I've google around this error and tried various things, including removing various packages. I recently updated to ios 10 but the app was still working fine after the update. The error is below:
2016-10-10 21:44:28.925 Coacher[307:24128] critical: Native stacktrace:
2016-10-10 21:44:28.934 Coacher[307:24128] critical: 0
libmonosgen-2.0.dylib 0x00363d33 mono_handle_native_sigsegv + 242 2016-10-10 21:44:28.934 Coacher[307:24128] critical: 1 libsystem_platform.dylib
0x1db5326d _sigtramp + 24 2016-10-10 21:44:28.935 Coacher[307:24128] critical: 2 libsystem_kernel.dylib 0x1da9fd8f + 64 2016-10-10 21:44:28.935 Coacher[307:24128] critical: 3 libsystem_kernel.dylib 0x1da9fdd9 system_set_sfi_window + 0 2016-10-10 21:44:28.935 Coacher[307:24128] critical: 4 TCC 0x201a8e85 + 228 2016-10-10 21:44:28.936 Coacher[307:24128] critical: 5 TCC 0x201a8da1 + 0 2016-10-10 21:44:28.936 Coacher[307:24128] critical: 6 TCC
0x201ab57b + 276 2016-10-10 21:44:28.936 Coacher[307:24128] critical: 7 libxpc.dylib 0x1db8915f + 46 2016-10-10 21:44:28.937 Coacher[307:24128] critical: 8 libxpc.dylib 0x1db89101 + 26 2016-10-10 21:44:28.937 Coacher[307:24128] critical: 9
libdispatch.dylib 0x1d9ae49b + 604 2016-10-10 21:44:28.937 Coacher[307:24128] critical: 10 libdispatch.dylib 0x1d9afa91 + 378 2016-10-10 21:44:28.938 Coacher[307:24128] critical: 11 libdispatch.dylib 0x1d9af8b7 + 106 2016-10-10 21:44:28.938 Coacher[307:24128] critical: 12 libsystem_pthread.dylib 0x1db55947 _pthread_wqthread + 1168 2016-10-10 21:44:28.938 Coacher[307:24128] critical: 13 libsystem_pthread.dylib 0x1db5549c start_wqthread + 8 2016-10-10 21:44:28.939 Coacher[307:24128] 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 yourapplication.
回答1:
This is because of your iOS 10 update. You need to request the permission for the camera now. The following blog post explains how to set up these permissions, now.
https://devblogs.microsoft.com/xamarin/new-ios-10-privacy-permission-settings/
Starting in iOS 10, nearly all APIs that require requesting authorization and other APIs, such as opening the camera or photo gallery, require a new key value pair to describe their usage in the Info.plist. This is very similar to the requirement for NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription to be put into the Info.plit when using Geolocation and iBeacon APIs. The difference now is that the application will crash when the app attempts authorization without these keys set.
来源:https://stackoverflow.com/questions/39966787/got-a-sigabrt-while-executing-native-code-xamarin-ios