Bug 56862 - [Apple Watch][release mode] Unable to play audio file using AVFoundation in apple watch.
Summary: [Apple Watch][release mode] Unable to play audio file using AVFoundation in a...
Status: CLOSED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.WatchOS.dll ()
Version: XI 10.2 (iOS 10.1)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 15.3
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-05-26 05:10 UTC by Rajesh Sahu
Modified: 2017-05-31 19:13 UTC (History)
3 users (show)

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


Attachments
Sample App which is using AVFoundation for apple Watch. (106.30 KB, application/zip)
2017-05-26 05:10 UTC, Rajesh Sahu
Details
AVFoundation showing in Xamarin.WatchOS reference assembly. (339.85 KB, image/png)
2017-05-26 07:14 UTC, Rajesh Sahu
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:
CLOSED FIXED

Description Rajesh Sahu 2017-05-26 05:10:35 UTC
Created attachment 22479 [details]
Sample App which is using AVFoundation for apple Watch.

I'm trying play audio in Apple Watch using AVFoundation framework as it is available for apple watch OS 3.0 and later.

Everything works perfect in debug mode but having exception while trying to play in release mode. Most the time unable to find the root cause but in one of the machine I had below exception:

 "*** Terminating app due to uncaught exception 'System.Exception', reason: 'Could not create an native instance of the type 'AVFoundation.AVAudioPlayerNode': the native class hasn't been loaded.
It is possible to ignore this condition by setting ObjCRuntime.Class.ThrowOnInitFailure to false.'"

I tried with Native iOS+Apple Watch and thing works perfectly.

Attaching the sample application.


I tried with following versions:

1.
=== Xamarin Studio Community ===
Version 6.2 (build 1821)
Installation UUID: db8798b5-a2b0-4951-8cec-33392554de9b
Runtime:
	Mono 4.8.0 (mono-4.8.0-branch/e4a3cf3) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 408000495

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

Version: 1.4.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.1 (11544)
Build 8B62

=== Xamarin.Mac ===

Not Installed

=== Xamarin.Android ===

Not Installed

=== Xamarin Android Player ===

Not Installed

=== Xamarin.iOS ===

Version: 10.2.0.4 (Xamarin Studio Community)
Hash: b638977
Branch: xcode8.1
Build date: 2016-10-25 14:38:48-0400

=== Xamarin Inspector ===

Not Installed

=== Build Information ===

Release ID: 602001821
Git revision: d41b6e51f3fa46a1943f2e31a778d28a7c73d069
Build date: 2017-02-17 15:18:19-05
Xamarin addins: 1363a8d943bab7700c93a97474060b6734aa7f94
Build lane: monodevelop-lion-cycle9

=== Operating System ===

Mac OS X 10.12.4
Darwin RajeshSahu.local 16.5.0 Darwin Kernel Version 16.5.0
    Fri Mar  3 16:52:33 PST 2017
    root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64


2.
=== Xamarin Studio Community ===

Version 6.3 (build 864)
Installation UUID: b22261cb-6242-4bf6-ba48-b5969b393d7f
Runtime:
	Mono 5.0.1.1 (2017-02/5077205) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 500010001

=== NuGet ===

Version: 3.5.0.0

=== Xamarin.Profiler ===

Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 8.3.2 (12175)
Build 8E2002

=== Xamarin.iOS ===

Version: 10.10.0.36 (Xamarin Studio Community)
Hash: d2270eec
Branch: d15-2
Build date: 2017-05-22 16:30:53-0400

=== Xamarin.Android ===

Version: 7.3.1.1 (Xamarin Studio Community)
Android SDK: /Users/test/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		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: 24.4.1
SDK Platform Tools Version: 23.0.1
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.Mac ===

Version: 3.4.0.36 (Xamarin Studio Community)

=== Xamarin Inspector ===

Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

=== Build Information ===

Release ID: 603000864
Git revision: 6c2f6737278ccc3e81e12276d49c0d92f975f189
Build date: 2017-04-24 11:26:01-04
Xamarin addins: d8d46e577d8507c35260ce9d73df3c33415bb214
Build lane: monodevelop-lion-d15-1

=== Operating System ===

Mac OS X 10.12.5
Darwin PoonamB.local 16.6.0 Darwin Kernel Version 16.6.0
    Fri Apr 14 16:21:16 PDT 2017
    root:xnu-3789.60.24~6/RELEASE_X86_64 x86_64



Please let me know what is going wrong.

Thanks.
Comment 2 Rajesh Sahu 2017-05-26 07:14:12 UTC
Created attachment 22482 [details]
AVFoundation showing in Xamarin.WatchOS reference assembly.

Thanks for the information but I am able to see AVFoundation in my Xamarin.WatchOS reference.

Attaching the screenshot for the same.

Thanks
Comment 3 Rolf Bjarne Kvinge [MSFT] 2017-05-26 12:02:00 UTC
@Rajesh, that code means that we won't link with the native AVFoundation framework when needed (which would cause the runtime error you're seeing), it doesn't mean AVFoundation isn't available in Xamarin.WatchOS.dll

As a workaround for this bug, try adding the following to the additional mtouch arguments in the project's WatchOS Build options:

    -gcc_flags "-framework AVFoundation"
Comment 4 Rolf Bjarne Kvinge [MSFT] 2017-05-30 13:04:36 UTC
master: https://github.com/xamarin/xamarin-macios/pull/2143
Comment 6 Rajesh Sahu 2017-05-31 19:13:01 UTC
Thanks Rolf, that work around too resolved my problem.