Reputation: 461
I have a Xamarin.Forms application with an Android and iOS version. The Android version is working fine in both Debug and Release mode.. in fact the Android version is already in the Play Store.
However the iOS version has an odd issue. In debug mode it works perfectly, however in Release mode everywhere I use the Xamarin Toolkit TouchEffect in order to attach a Command to an element, does not fire.
<buttons:BackButton xct:TouchEffect.Command="{Binding BackCommand}" xct:TouchEffect.NativeAnimation="True" />
I looked online and apparently this could be a linker issue since maybe the linker is stripping this code from the final build, however I have it set to "Link Framework SDKs only" which seems to be the recommended setting when publishing your app.
Is there something else I may be missing?
Thanks
Upvotes: 3
Views: 810
Reputation: 36
If anyone is facing this issue on Android platform we can fix it by adding Xamarin.CommunityToolkit;
in "Ignore Assemblies" Entry in "Android Build -> Linker" section.
For some reason when we keep Linker Behaviour as "Don't link" then also not taking these assemblies.
Upvotes: 0
Reputation: 461
So after a lot of research indeed the bug is with the linker, which is stripping some Community Toolkit code from the release build, despite the fact that I am using the toolkit in xaml. One thing to note is that I'm only using the toolkit in Xaml.
By simply creating a class in the iOS project file with the below code, the linker sees that I indeed need this package and doesn't strip it's code.
public class LinkerPleaseInclude
{
public void Include(Xamarin.CommunityToolkit.Effects.TouchEffect arg)
{
var dummyCommand = arg.Command;
var dummyCommandParameter = arg.CommandParameter;
var dummyNativeAnimation = arg.NativeAnimation;
}
}
Edit: this may not be enough to solve the issue. If it still persists, try include ‘--linkskip=Xamarin.CommunityToolkit’ inside Additional mtouch arguments of iOS Build screen. That should do it.
Upvotes: 4