GoXuni / Legacy-Xuni-Xamarin.Forms

These samples show how to use all features of Xuni in Xamarin.Forms.
14 stars 12 forks source link

problems on ios #3

Open PlusInf0Iulia opened 8 years ago

PlusInf0Iulia commented 8 years ago

i'm trying to include a calendar in my project in xamarin forms but it doesn't appear on ios even if i create a simple page with the calendar. I must put some configuration in build configuration ios? or what i can do?

KelleyRicker commented 8 years ago

Try adding the following to your appdelegate:

public static Xuni.Forms.Calendar.Platform.iOS.CalendarRenderer calDummy;

and in the FinishedLaunching() method:

Xuni.Forms.Calendar.Platform.iOS.Forms.Init();

Those steps are necessary to initialize the renderer and ensure it's not stripped by Xamarin's linking when running on an iOS device.

PlusInf0Iulia commented 8 years ago

it didn't work on ios 10. but worked on ios 9.3. i changed the build architecture in ARMv7 and now is working.

KelleyRicker commented 8 years ago

I believe adding the calDummy should allow it to run under ARM64 as well. For instance I'm able to use 10.1 and ARMv7 +ARM64 if I add that line. The issue stems from Xamarin's linking for 64 bit apps. It can be too aggressive and strip the renderer (which is why the control doesn't show up), but the static declaration prevents this. The appdelegate should look something like:

   [Register("AppDelegate")]
public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
{

    public static Xuni.Forms.Calendar.Platform.iOS.CalendarRenderer calDummy;
    //
    // This method is invoked when the application has loaded and is ready to run. In this 
    // method you should instantiate the window, load the UI into it and then make the window
    // visible.
    //
    // You have 17 seconds to return from this method, or iOS will terminate your application.
    //
    public override bool FinishedLaunching(UIApplication app, NSDictionary options)
    {
        global::Xamarin.Forms.Forms.Init();
        Xuni.Forms.Calendar.Platform.iOS.Forms.Init();

        LoadApplication(new Calendar101.App());

        return base.FinishedLaunching(app, options);
    }
}