1

In VS 2013, Xamarin Forms.

Our Android & IOS app has a static class:

public static class CacheKeys
{
    public static string RememberMeEmail = "RememberMeEmail";
    public static string RememberMeSwitch = "RememberMeSwitch";
}

This class is stripped by the linker in the iOS device debug build, but not in the simulator or Android.

See attached screenshot.

I have set the Debug Linker for iPhone to Do Not Link, yet this static class is removed.

??????

enter image description here

Federico Navarrete
  • 3,069
  • 5
  • 41
  • 76
Ian Vink
  • 66,960
  • 104
  • 341
  • 555

2 Answers2

1

You can set a preserve attribute to your class: http://developer.xamarin.com/guides/ios/advanced_topics/linker/ See the section: Preserving Code

Example:

[Preserve]
    public static class LinkerPreserve
    {
        static LinkerPreserve()
        {
            throw new Exception(typeof(SQLitePersistentBlobCache).FullName);
        }
    }

    public class PreserveAttribute : Attribute
    {
    }
Martijn00
  • 3,569
  • 3
  • 22
  • 39
1

I also found that I had to check the "Enable generic value type sharing" in the Advanced tab of "iOS Build"

Ian Vink
  • 66,960
  • 104
  • 341
  • 555