xamarin-macios icon indicating copy to clipboard operation
xamarin-macios copied to clipboard

[xcode12] App Clip

Open chamons opened this issue 5 years ago • 12 comments

This is a feature released in Xcode 12.

For now, this is what is known: https://developer.apple.com/app-clips/

chamons avatar Jun 22 '20 19:06 chamons

Is there any news weather or not App Clips will be supported by Xamarin? The use Case that makes much sense is: Develop an App clip natively with xcode/swift -> merge it into the xamarin ipa using msbuild/vs

Due to the size restrictions it would be nearly impossible to devlop an app clip beyond hello world in xamarin. But it would be great if an existing Xamarin app could be extended with an native app clip.

AiTlbx avatar Aug 13 '20 02:08 AiTlbx

Same here, very interested to know. Have few great ideas for app clips for our apps.

sichy avatar Aug 24 '20 21:08 sichy

We found a workaround:

Prerequisit -> you have a working Xamarin iOS App and you want to add a native appclip written in swift (for size)

Recipe:

  1. Create dummy xcode swift ios app (using certificates and appid of your existing xamarin app)
  2. unpack the ipa of your dummy+appclip app
  3. unpack the ipa of your xamarin ios app
  4. add appclip folder to the unpacked xamarin ios app
  5. repack + sign with your certificates upload to testflight using the lates xcode beta application loader

AiTlbx avatar Sep 11 '20 19:09 AiTlbx

Just an update on this - While some investigations did occur this summer we did not ship support for this in our initial Xcode 12 support release.

It's on our backlog for future possible features now.

chamons avatar Sep 16 '20 17:09 chamons

Forgive me for my noobness, but would it not be nice to create the app clips using Xamarin.iOS as well? Is the library size a showstopper? It'd be great if something could be done about it

amirvenus avatar Sep 21 '20 05:09 amirvenus

Yes, size is the issue, appclip bundle cannot be larger than 10MB. Impossible with Xamarin linked libs.

On 21 Sep 2020, at 07:45, amirvenus [email protected] wrote:

Forgive me for my noobness, but would it not be nice to create the app clips using Xamarin.iOS as well? Is the library size a showstopper? It'd be great if something could be done about it

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/xamarin/xamarin-macios/issues/8932#issuecomment-695911860, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACTPHDDIW2G6J34ZVCJS73SG3SATANCNFSM4OE7I2OQ.

sichy avatar Sep 21 '20 08:09 sichy

@sichy what is the smallest xamarin.ios ipa size?

juepiezhongren avatar Oct 12 '20 09:10 juepiezhongren

We found a workaround:

Prerequisit -> you have a working Xamarin iOS App and you want to add a native appclip written in swift (for size)

Recipe:

  1. Create dummy xcode swift ios app (using certificates and appid of your existing xamarin app)
  2. unpack the ipa of your dummy+appclip app
  3. unpack the ipa of your xamarin ios app
  4. add appclip folder to the unpacked xamarin ios app
  5. repack + sign with your certificates upload to testflight using the lates xcode beta application loader

Will this work for Watch apps as well?

dhindrik avatar Nov 06 '20 11:11 dhindrik

@dhindrik I suspect it does, but since we did'nt add a watch part to our apps I can't tell for sure. But AppClip part still works great (2 month later)

AiTlbx avatar Nov 06 '20 12:11 AiTlbx

still no "solution" for this topic? We would really need a better support for AppClips, even if we need to develop the AppClip itself in swift, but a more robust solution than manually copy the folder together!?

de-preut avatar Jun 29 '21 11:06 de-preut

I'm interested in this. Would there be something we can use similar to the current Xamarin infrastructure for Widgets?

mnxamdev avatar Apr 26 '22 18:04 mnxamdev

We found a workaround:

Prerequisit -> you have a working Xamarin iOS App and you want to add a native appclip written in swift (for size)

Recipe:

  1. Create dummy xcode swift ios app (using certificates and appid of your existing xamarin app)
  2. unpack the ipa of your dummy+appclip app
  3. unpack the ipa of your xamarin ios app
  4. add appclip folder to the unpacked xamarin ios app
  5. repack + sign with your certificates upload to testflight using the lates xcode beta application loader

@dhindrik @jges42 did you have to archive the dummy+appclip app before doing this or just build? Also, do you have scripts to share?

mnxamdev avatar Jun 21 '22 17:06 mnxamdev

still no "solution" for this topic?

MohamadAminSoltani avatar Aug 24 '22 22:08 MohamadAminSoltani

@MohamadAminSoltani Here's my solution:

  1. Create dummy xcode swift iOS app (using certificates and appid of your existing xamarin app)
  2. Add an AppClip to the dummy app per Apple's documentation.
  3. Create and download the AppClip provisioning profiles per Apple's documentation.
  4. Add the following to your Xamarin iOS project .csproj file:
    <Folder Include="Resources\AppClips\**" />  
    <Content Include="Resources\AppClips\**" />
  1. Create an ExportOptions.plist per Apple's documentation. I can't recall how I did this but I may have archived a release or ad-hoc build to get it.
  2. Build your Xamarin.iOS app
  3. Archive your Xamarin.iOS app and upload to TestFlight as usual.

I do this all in CI so that process handles 7 above. Below are part of the commands I use in a build script when building in CI but you can use on your local workstation as part of the Xamarin project build commands. You can infer below where you need to adjust (project name etc.)

xcodebuild archive -scheme MyiOSProjectScheme -sdk iphoneos -allowProvisioningUpdates -archivePath ./My.archive

xcodebuild -exportArchive -archivePath My.archive.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath My.ipa

mv ./My.ipa/My.ipa ./My.ipa/My.ipa.zip
    
cd ./My.ipa
    
unzip -q ./My.ipa.zip
    
cd ..
    
ditto ./My.ipa/Payload/My.app/AppClips/ ../My.Xamarin.App.iOS/Resources/AppClips

This gives you all you need without needing to repack and sign. Once you export/archive from your Xamarin.iOS app you're ready to upload.

mnxamdev avatar Aug 25 '22 15:08 mnxamdev

@MohamadAminSoltani Here's my solution:

  1. Create dummy xcode swift iOS app (using certificates and appid of your existing xamarin app)
  2. Add an AppClip to the dummy app per Apple's documentation.
  3. Create and download the AppClip provisioning profiles per Apple's documentation.
  4. Add the following to your Xamarin iOS project .csproj file:
    <Folder Include="Resources\AppClips\**" />  
    <Content Include="Resources\AppClips\**" />
  1. Create an ExportOptions.plist per Apple's documentation. I can't recall how I did this but I may have archived a release or ad-hoc build to get it.
  2. Build your Xamarin.iOS app
  3. Archive your Xamarin.iOS app and upload to TestFlight as usual.

I do this all in CI so that process handles 7 above. Below are part of the commands I use in a build script when building in CI but you can use on your local workstation as part of the Xamarin project build commands. You can infer below where you need to adjust (project name etc.)

xcodebuild archive -scheme MyiOSProjectScheme -sdk iphoneos -allowProvisioningUpdates -archivePath ./My.archive

xcodebuild -exportArchive -archivePath My.archive.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath My.ipa

mv ./My.ipa/My.ipa ./My.ipa/My.ipa.zip
    
cd ./My.ipa
    
unzip -q ./My.ipa.zip
    
cd ..
    
ditto ./My.ipa/Payload/My.app/AppClips/ ../My.Xamarin.App.iOS/Resources/AppClips

This gives you all you need without needing to repack and sign. Once you export/archive from your Xamarin.iOS app you're ready to upload.

Hi - sorry to revive an inactive thread, but i would like to hear some more about this @mnxamdev

narciszait avatar Dec 14 '22 13:12 narciszait