diff --git a/src/avfoundation.cs b/src/avfoundation.cs index 780632ec1b..5351406b12 100644 --- a/src/avfoundation.cs +++ b/src/avfoundation.cs @@ -10453,6 +10453,7 @@ namespace XamCore.AVFoundation { [BaseType (typeof (NSUrlSession), Name = "AVAssetDownloadURLSession")] interface AVAssetDownloadUrlSession { [Static] + [ForcedType] [Export ("sessionWithConfiguration:assetDownloadDelegate:delegateQueue:")] AVAssetDownloadUrlSession CreateSession (NSUrlSessionConfiguration configuration, [NullAllowed] IAVAssetDownloadDelegate @delegate, [NullAllowed] NSOperationQueue delegateQueue); diff --git a/tests/monotouch-test/AVFoundation/AVAssetDownloadUrlSessionTests.cs b/tests/monotouch-test/AVFoundation/AVAssetDownloadUrlSessionTests.cs index 21ea0de680..ca9aa4c6a8 100644 --- a/tests/monotouch-test/AVFoundation/AVAssetDownloadUrlSessionTests.cs +++ b/tests/monotouch-test/AVFoundation/AVAssetDownloadUrlSessionTests.cs @@ -11,6 +11,7 @@ #if !__WATCHOS__ && !__TVOS__ using System; +using ObjCRuntime; #if XAMCORE_2_0 using Foundation; @@ -38,6 +39,20 @@ namespace monotouchtest { Assert.Throws (() => AVAssetDownloadUrlSession.FromWeakConfiguration (NSUrlSessionConfiguration.DefaultSessionConfiguration, new NSObject (), null), "FromWeakConfiguration should throw NotSupportedException"); } + [Test] + public void CreateSessionTest () + { + if (!TestRuntime.CheckXcodeVersion (7, 0)) + Assert.Ignore ("Ignoring AVAssetDownloadUrlSession tests: Requires iOS9+"); + + if (Runtime.Arch == Arch.DEVICE) + Assert.Ignore ("Ignoring CreateSessionTest tests: Requires com.apple.developer.media-asset-download entitlement"); + + using (var backgroundConfiguration = NSUrlSessionConfiguration.CreateBackgroundSessionConfiguration ("HLS-Identifier")) { + Assert.DoesNotThrow (() => AVAssetDownloadUrlSession.CreateSession (backgroundConfiguration, null, NSOperationQueue.MainQueue), "Should not throw InvalidCastException"); + } + } + // FIXME: Disabling this test from now, will reenable once apple releases docs on what is ecpected to have this entitlement key // Reason: Creating an AVAssetDownloadURLSession requires the com.apple.developer.media-asset-download entitlement // [Test]