Bug 43796 - Crash when running AVCam sample on iOS 10
Summary: Crash when running AVCam sample on iOS 10
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Samples ()
Version: XI 9.99 (iOS 10 previews)
Hardware: PC Windows
: Normal normal
Target Milestone: Future Cycle (TBD)
Assignee: Oleg Demchenko
URL:
Depends on:
Blocks:
 
Reported: 2016-08-26 17:11 UTC by Cody Beyer (MSFT)
Modified: 2016-10-24 14:58 UTC (History)
5 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 Cody Beyer (MSFT) 2016-08-26 17:11:17 UTC
# Details

The following sample crashes when ran on iOS 10 using Xamarin.iOS 9.99

The crash occurs at line 102 of CameraViewController.cs which contains:

>var granted = await AVCaptureDevice.RequestAccessForMediaTypeAsync (AVMediaType.Video);

The error is as follows:

>2016-08-26 09:57:29.910 AVCam[378:25066] critical: 	0   AVCam                               0x00000001000e6e74 >mono_handle_native_sigsegv + 260
>2016-08-26 09:57:29.910 AVCam[378:25066] critical: 	1   libsystem_platform.dylib            0x00000001909e3348 _sigtramp + 52
>2016-08-26 09:57:29.911 AVCam[378:25066] critical: 	2   libsystem_kernel.dylib              0x000000019091d480 <redacted> + 100
>2016-08-26 09:57:29.911 AVCam[378:25066] critical: 	3   libsystem_kernel.dylib              0x000000019091d4c8 system_set_sfi_window >+ 0
>2016-08-26 09:57:29.912 AVCam[378:25066] critical: 	4   TCC                                 0x0000000193b58560 <redacted> + 0
>2016-08-26 09:57:29.912 AVCam[378:25066] critical: 	5   TCC                                 0x0000000193b5845c <redacted> + 0
>2016-08-26 09:57:29.912 AVCam[378:25066] critical: 	6   TCC                                 0x0000000193b5b52c <redacted> + 288
>2016-08-26 09:57:29.912 AVCam[378:25066] critical: 	7   libxpc.dylib                        0x0000000190a2801c <redacted> + 80
>2016-08-26 09:57:29.913 AVCam[378:25066] critical: 	8   libxpc.dylib                        0x0000000190a27f8c <redacted> + 40
>2016-08-26 09:57:29.913 AVCam[378:25066] critical: 	9   libdispatch.dylib                   0x00000001907dd1c0 <redacted> + 16
>2016-08-26 09:57:29.914 AVCam[378:25066] critical: 	10  libdispatch.dylib                   0x00000001907ebab4 <redacted> + 732
>2016-08-26 09:57:29.914 AVCam[378:25066] critical: 	11  libdispatch.dylib                   0x00000001907ed38c <redacted> + 572
>2016-08-26 09:57:29.915 AVCam[378:25066] critical: 	12  libdispatch.dylib                   0x00000001907ed0ec <redacted> + 124
>2016-08-26 09:57:29.915 AVCam[378:25066] critical: 	13  libsystem_pthread.dylib             0x00000001909e52c8 _pthread_wqthread + >1288
>2016-08-26 09:57:29.916 AVCam[378:25066] critical: 	14  libsystem_pthread.dylib             0x00000001909e4db4 start_wqthread + 4
>2016-08-26 09:57:29.916 AVCam[378:25066] 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.
>=================================================================

# Sample

https://developer.xamarin.com/samples/monotouch/AVCam/

# Steps to Reproduce

	1. Download sample
	2. Deploy to iOS 10 device

# Expected Results

App should deploy and request camera access

# Actual Results

App crashes after launch

# Versions

=== Xamarin Studio Business ===

Version 6.1 (build 5365)
Installation UUID: 9d0d22a4-94e4-4a24-802e-d794f948732d
Runtime:
	Mono 4.6.0 (mono-4.6.0-branch/23c6a4d) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406000165

=== NuGet ===

Version: 3.4.3.0

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 8.0 (11239.2)
Build 8S201h

=== Xamarin.Mac ===

Version: 2.10.0.68 (Xamarin Business)

=== Xamarin.iOS ===

Version: 9.99.4.23 (Xamarin Business)
Hash: f63ecd7
Branch: cycle8
Build date: 2016-08-23 14:45:42-0400

=== Xamarin.Android ===

Version: 6.2.0.47 (Xamarin Business)
Android SDK: /Users/codybeyer/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		6.0 (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Not Installed

=== Build Information ===

Release ID: 601005365
Git revision: 4fb2e8b3f2042f3be28b370d01f1c8057e993e51
Build date: 2016-08-23 08:54:41-04
Xamarin addins: 60c0f9d8f0eb210499e1f8c6daf4972c10f4663f
Build lane: monodevelop-lion-cycle8

=== Operating System ===

Mac OS X 10.11.6
Darwin clb-mbook.local 15.6.0 Darwin Kernel Version 15.6.0
    Thu Jun 23 18:25:34 PDT 2016
    root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
Comment 1 Cody Beyer (MSFT) 2016-08-26 17:57:16 UTC
>Error (465) / AVCam(TCC): This app has crashed because it attempted to access privacy->sensitive data without a usage description. The app's Info.plist must contain an ?NSCameraUsageDescription key with a string value explaining to the user how the app uses this >data.

adding the following to the info.plist resolved the issue

><key>NSCameraUsageDescription</key>
><string>Pictures</string>
Comment 2 Sebastien Pouliot 2016-08-26 19:39:15 UTC
If our own sample fails then it needs to be fixed.
Comment 3 Oleg Demchenko 2016-08-29 14:31:21 UTC
It seems like photo/camera related APIs used in this sample were deprecated in iOS 10. We'll need to update the sample.
Comment 4 Sebastien Pouliot 2016-08-29 14:36:02 UTC
@Oleg there might be more than one issue - but the basic one was the lack of the new key in Info.plist
Comment 5 Oleg Demchenko 2016-08-29 14:42:44 UTC
Should be fixed in monotouch-samples/master: e7f1532ba0e7aeff609f6db693827510ff2809e1
Comment 7 Radek Voltr 2016-10-19 07:26:20 UTC
https://developer.xamarin.com/samples/monotouch/AVCam/ 

Download on this page gave me source code without Microphone and PhotoLibrary in info.plist and also Browser code link leads to wrong URL (404)

So it can be misleading to fellow developers (just like me :-D )
Comment 8 Oleg Demchenko 2016-10-24 14:58:24 UTC
Thanks for raising up this issue @Radek. The link should be updated now.

Sample was moved to ios10 folder:
https://github.com/xamarin/ios-samples/pull/117