xamarin / xamarin-macios

.NET for iOS, Mac Catalyst, macOS, and tvOS provide open-source bindings of the Apple SDKs for use with .NET managed languages such as C#
Other
2.47k stars 512 forks source link

Unable to set Asset Pack Manifest URL Prefix for Xamarin.iOS builds #7624

Open mbecker73 opened 4 years ago

mbecker73 commented 4 years ago

Steps to Reproduce

  1. Create a Xamarin.iOS application that uses On-Demand Resource asset packs
  2. Unable to set remote server URL location for asset packs because build setting does not exist.

Expected Behavior

I am trying to use Apple On-Demand Resources in a Xamarin app but are running into some issues. According to Apple's documentation, ODR asset packs can either be stored locally or on a remote server of your choosing when testing your app. In production, any files set up for ODR requests are stored on Apple's own servers. But for testing, we would like our assets stored remotely and pulled down by the app instead of being stored locally.

I have ODR set up correctly for accessing asset packs when stored locally. But when it comes to linking up our own remote server, I have yet to find anything that works for Xamarin.iOS and Visual Studio for Mac. If this was native iOS, in XCode, you can set the Asset Pack Manifest URL Prefix build setting for a target to specify the location of where the asset packs are stored.

However, there doesn't seem to be an easily accessible, equivalent build setting for Xamarin.iOS in VS. The closest we have found is on line 2162 of Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets, found here. This line references a property 'OnDemandResourcesUrl', but it is unclear how to set this during the build process.

Actual Behavior

I would expect there to be a configurable setting somewhere in VS for Mac that lets you set this Asset Pack Manifest URL or something equivalent. That way you can specify remote location of where your asset packs are stored for testing.

I was recommended to post a feature request for this here after posting on the Xamarin forums: https://forums.xamarin.com/discussion/175480/how-do-you-set-on-demand-resources-url-for-xamarin-ios-builds/p1?new=1

Environment

=== Visual Studio Community 2019 for Mac ===

Version 8.3.9 (build 2)
Installation UUID: 2ca6970f-21d0-4ee3-8f54-68aa81c525ab
    GTK+ 2.24.23 (Raleigh theme)
    Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

    Package version: 604000208

=== Mono Framework MDK ===

Runtime:
    Mono 6.4.0.208 (2019-06/07c23f2ca43) (64-bit)
    Package version: 604000208

=== NuGet ===

Version: 5.3.0.6192

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks
SDK Version: 3.0.100
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
    3.0.0
    2.1.13

=== Xamarin.Profiler ===

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

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 10.0.6.2 (Visual Studio Community)
Commit: xamarin-android/d16-3/c407838
Android SDK: /Users/mbecker/Library/Developer/Xamarin/android-sdk-macosx
    Supported Android versions:
        7.0 (API level 24)
        7.1 (API level 25)
        8.0 (API level 26)
        8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.2
SDK Build Tools Version: 28.0.3

Build Information: 
Mono: mono/mono/2019-06@476d72b9e32
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3fd
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/mbecker/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 1.4.0.65
Hash: c33b107
Branch: remotes/origin/d16-3
Build date: 2019-11-13 23:01:40 UTC

=== Android Device Manager ===

Version: 1.2.0.116
Hash: d2b2af0
Branch: remotes/origin/d16-3
Build date: 2019-11-13 23:02:02 UTC

=== Xamarin Designer ===

Version: 16.3.0.256
Hash: 8a223bfd7
Branch: remotes/origin/d16-3
Build date: 2019-11-01 21:02:02 UTC

=== Apple Developer Tools ===

Xcode 11.2.1 (15526.1)
Build 11B500

=== Xamarin.Mac ===

Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

=== Xamarin.iOS ===

Version: 13.6.0.12 (Visual Studio Community)
Hash: e3c2b406d
Branch: xcode11.2
Build date: 2019-11-01 00:12:08-0400

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 803090002
Git revision: 83e2adea93475846201094761baae3414da20b4e
Build date: 2019-11-14 15:17:12+00
Build branch: release-8.3
Xamarin extensions: afdf0ec08b7568ecf06a54a846185b5bd6f4eb25

=== Operating System ===

Mac OS X 10.14.5
Darwin 18.6.0 Darwin Kernel Version 18.6.0
    Thu Apr 25 23:16:27 PDT 2019
    root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64

Build Logs

No related build logs

Example Project (If Possible)

Can use this as an example project: https://github.com/xamarin/ios-samples/tree/master/ios9/iTravel

VS bug #1042779, VS bug #1057459

whitneyschmidt commented 4 years ago

@mbecker73 Thank you for surfacing this issue! The team that owns this area has been notified of the feature request.

dankraus commented 4 years ago

Is there a variable that could be set in a project file perhaps to support this if it's not surfaced directly in the IDE itself?

tfang7 commented 4 years ago

@whitneyschmidt I am struggling with this issue as well. We are currently using Xamarin and need to migrate our hosted assets over to Apple ODR. I need to be able to configure the Asset Pack Manifest URL in order to do this.

Is there any time estimate as to when Visual Studio will support configuring this URL? Our team cannot continue development of our app in Xamarin if we cannot use Apple ODR. Additionally, if this won't be supported for a while, are there any workarounds that can be used to configure this?

For instance (as OP pointed out) I see that there is a variable in this file called OnDemandResourcesUrl in the msbuild repository: https://github.com/xamarin/xamarin-macios/blob/master/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.targets

If I edit this file directly will I be able to set the Asset Pack Manifest URL? I am afraid to edit it as the comment at the top clearly states that it is a bad idea unless you are knowledgeable about msbuild...

Thank you in advance for any and all help!

MikeWentino commented 4 years ago

I am also encountering this issue, there has go to be a way to configure this? I don't understand how ODR can work if you can't set the Asset Pack manifest URL. I might be missing something though?

With the new apple HTML5 app policy, (https://developer.apple.com/news/?id=09062019b) ODR is necessary to keep our WebView based app alive. I hope Xamarin will support this feature soon, or at least provide a viable work around.

VincentDondain commented 4 years ago

Hi everyone,

First let me try to restate what I believe @mbecker73 (but also others who commented) is/are running into.

I believe you are all trying to do this -> "Hosting On-Demand Resources". Which is hosting a generated asset pack on a compliant custom web server instead of using Apple's hosting.

If I understand correctly this is specifically allowed by Apple for development and testing but not when publishing your app in the App Store.

If that is indeed what you are all trying to do, unfortunately Xamarin at this time does not support that, therefore I'll make this issue an enhancement for the team to implement this at a later time.


Now to clarify some of the comments, the "Asset Pack manifest URL" that Xcode provides in the build settings of a target is not the same as our MSBuild OnDemandResourcesUrl. That MSBuild property isn't surfaced in the IDE and it's actually incomplete as of now.

@MikeWentino ODRs should currently work, even without the "Asset Pack manifest URL", because the resources should automatically be hosted by Apple's servers. If that's not the case then it's an other problem and please feel free to open a new issue on https://github.com/xamarin/xamarin-macios/issues/new

@tfang7 trying to understand exactly what's hurting your progress using Xamarin here as ODRs should work using Apple's servers when your App is published, you just cannot use custom servers for development / testing, is that what you're referring to?


Hopefully that brings clarity to the issue but I'd be happy to provide more help if I understand your various contexts better 😊