Bug 50417 - App crashes when try use MPMediaQuery
Summary: App crashes when try use MPMediaQuery
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: Debugger ()
Version: XI 10.3 (iOS 10.2)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-12-20 08:31 UTC by Vladimir
Modified: 2016-12-20 21:06 UTC (History)
2 users (show)

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


Attachments
Test project which creashes (11.32 KB, application/zip)
2016-12-20 20:37 UTC, Vladimir
Details


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 ANSWERED

Description Vladimir 2016-12-20 08:31:22 UTC
Steps :
1)Create Xamarin.iOS single view app(target -10.2)
2)Add "Media Library – NSAppleMusicUsageDescription" permission to info.plist
3) add "using MediaPlayer;"to viewcontroller
3)In ViewDidLoad add  and the code like 
var songs = MPMediaQuery.SongsQuery.Items;

4) App crashes with non-informative log:

Resolved pending breakpoint at 'ViewController.cs:17,1' to void TestiOs.ViewController.ViewDidLoad () [0x00001].
2016-12-20 10:23:52.966 TestiOs[486:164806] critical: 
Native stacktrace:

2016-12-20 10:23:52.967 TestiOs[486:164806] critical: 	0   libmonosgen-2.0.dylib               0x00000001001f4018 mono_handle_native_sigsegv + 260
2016-12-20 10:23:52.967 TestiOs[486:164806] critical: 	1   libsystem_platform.dylib            0x0000000184a81348 _sigtramp + 52
2016-12-20 10:23:52.968 TestiOs[486:164806] critical: 	2   libsystem_kernel.dylib              0x00000001849ba49c <redacted> + 100
2016-12-20 10:23:52.968 TestiOs[486:164806] critical: 	3   libsystem_kernel.dylib              0x00000001849ba4c8 system_set_sfi_window + 0
2016-12-20 10:23:52.968 TestiOs[486:164806] critical: 	4   TCC                                 0x0000000187c2e328 <redacted> + 0
2016-12-20 10:23:52.969 TestiOs[486:164806] critical: 	5   TCC                                 0x0000000187c2e224 <redacted> + 0
2016-12-20 10:23:52.969 TestiOs[486:164806] critical: 	6   TCC                                 0x0000000187c31330 <redacted> + 348
2016-12-20 10:23:52.970 TestiOs[486:164806] critical: 	7   libxpc.dylib                        0x0000000184ac2fcc <redacted> + 80
2016-12-20 10:23:52.970 TestiOs[486:164806] critical: 	8   libxpc.dylib                        0x0000000184ac2f3c <redacted> + 40
2016-12-20 10:23:52.970 TestiOs[486:164806] critical: 	9   libdispatch.dylib                   0x000000018487a1bc <redacted> + 16
2016-12-20 10:23:52.971 TestiOs[486:164806] critical: 	10  libdispatch.dylib                   0x0000000184888a4c <redacted> + 732
2016-12-20 10:23:52.971 TestiOs[486:164806] critical: 	11  libdispatch.dylib                   0x000000018488a34c <redacted> + 572
2016-12-20 10:23:52.972 TestiOs[486:164806] critical: 	12  libdispatch.dylib                   0x000000018488a0ac <redacted> + 124
2016-12-20 10:23:52.972 TestiOs[486:164806] critical: 	13  libsystem_pthread.dylib             0x0000000184a832a0 _pthread_wqthread + 1288
2016-12-20 10:23:52.972 TestiOs[486:164806] critical: 	14  libsystem_pthread.dylib             0x0000000184a82d8c start_wqthread + 4
2016-12-20 10:23:52.972 TestiOs[486:164806] 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.
Comment 1 Timothy Risi 2016-12-20 18:32:01 UTC
Hi Vladimir,

It looks like the info.plist key should actually be: "Privacy - Apple Music Usage Description" (or you can just use "NSAppleMusicUsageDescription").  Using that key in the plist and following the steps you provided it ran successfully for me without crashing.  Can you try that and see if it works? If it still crashes for you, can you provide full environment info for your machine?

The easiest way to get exact version information is to use the 
"Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" 
button and copy/paste the version informations (you can use the 
"Copy Information" button).
Comment 2 Vladimir 2016-12-20 20:35:49 UTC
Hi Timothy

Thanks for you answer.
I've already added this permission as you describe. I am attaching my test project which includes it and which crashes.

Here is my version information:

=== Xamarin Studio Community ===

Version 6.1.2 (build 44)
Installation UUID: 994af729-ed11-4410-a4be-7858792f0cb6
Runtime:
	Mono 4.6.2 (mono-4.6.0-branch/08fd525) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 406020007

=== NuGet ===

Version: 3.4.3.0

=== Xamarin.Profiler ===

Not Installed

=== Apple Developer Tools ===

Xcode 8.2 (11766)
Build 8C38

=== Xamarin.Mac ===

Version: 2.10.0.113 (Xamarin Studio Community)

=== Xamarin.Android ===

Version: 7.0.2.37 (Xamarin Studio Community)
Android SDK: /Users/vladimirpanchenko/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
		6.0   (API level 23)

SDK Tools Version: 25.2.2
SDK Platform Tools Version: 24.0.3
SDK Build Tools Version: 23.0.1

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 ===

Version: 0.3.7
Location: /Applications/Xamarin Android Player.app

=== Xamarin.iOS ===

Version: 10.3.0.0 (Xamarin Studio Community)
Hash: e02d272
Branch: xcode8.2
Build date: 2016-12-12 23:00:41-0500

=== Build Information ===

Release ID: 601020044
Git revision: 0ccfcd52b95305ebd5b7eca0d88c1017035910ae
Build date: 2016-10-28 15:12:43-04
Xamarin addins: a39a869d8a78d87bdc6775f696c13a4cc9024501
Build lane: monodevelop-lion-cycle8

=== Operating System ===

Mac OS X 10.11.6
Darwin sympathy.wane.volia.net 15.6.0 Darwin Kernel Version 15.6.0
    Wed Nov  2 20:30:56 PDT 2016
    root:xnu-3248.60.11.1.2~2/RELEASE_X86_64 x86_64
Comment 3 Vladimir 2016-12-20 20:37:38 UTC
Created attachment 18947 [details]
Test project which creashes
Comment 4 Timothy Risi 2016-12-20 20:46:30 UTC
It looks like you're using the "Privacy - Media Library Usage Description" key.  The one you need is "Privacy - Apple Music Usage Description".  I replaced the key in your sample project with the different one and it runs without crashing.

Can you try with the different key and see if it works for you?
Comment 5 Vladimir 2016-12-20 21:05:54 UTC
Different key worked for me perfectly.
Thanks a lot !
Comment 6 Timothy Risi 2016-12-20 21:06:39 UTC
Glad I could help!