-
Notifications
You must be signed in to change notification settings - Fork 119
Open
Description
Hello,
I'm using SlideOverKit for my Xamarin App and it's working well until I encountered a problem on iOS devices.
I got a PageImpInterfaceRendereriOS.cs like this one :
using System;
using Xamarin.Forms;
//using SlideOverKit.MoreSample;
//using SlideOverKit.MoreSample.iOS;
using Xamarin.Forms.Platform.iOS;
using SlideOverKit.iOS;
using UIKit;
using CoreGraphics;
using Livli;
using Livli.iOS.Renderers;
[assembly: ExportRenderer(typeof(TimelinePage), typeof(PageImpInterfaceRendereiOS))]
namespace Livli.iOS.Renderers
{
// As your page cannot inherit from MenuContainerPage,
// You must create a renderer page, copy these codes and rename.
public class PageImpInterfaceRendereiOS : PageRenderer, ISlideOverKitPageRendereriOS
{
public Action<bool> ViewDidAppearEvent { get; set; }
public Action<VisualElementChangedEventArgs> OnElementChangedEvent { get; set; }
public Action ViewDidLayoutSubviewsEvent { get; set; }
public Action<bool> ViewDidDisappearEvent { get; set; }
public Action<CGSize, IUIViewControllerTransitionCoordinator> ViewWillTransitionToSizeEvent { get; set; }
public PageImpInterfaceRendereiOS()
{
new SlideOverKitiOSHandler().Init(this);
}
protected override void OnElementChanged(VisualElementChangedEventArgs e)
{
Console.WriteLine("SLIDEOVERKIT OnElementChanged");
Console.WriteLine("NewElement.WidthRequest:" + e.NewElement.WidthRequest);
if (e.NewElement.WidthRequest < 0) return;
base.OnElementChanged(e);
if (OnElementChangedEvent != null)
OnElementChangedEvent(e);
}
public override void ViewDidLayoutSubviews()
{
base.ViewDidLayoutSubviews();
if (ViewDidLayoutSubviewsEvent != null)
ViewDidLayoutSubviewsEvent();
}
public override void ViewDidAppear(bool animated)
{
Console.WriteLine("SLIDEOVERKIT ViewDidAppear");
base.ViewDidAppear(animated);
if (ViewDidAppearEvent != null)
ViewDidAppearEvent(animated);
}
public override void ViewDidDisappear(bool animated)
{
base.ViewDidDisappear(animated);
if (ViewDidDisappearEvent != null)
ViewDidDisappearEvent(animated);
}
public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
{
Console.WriteLine("SLIDEOVERKIT ViewWillTransitionToSize");
base.ViewWillTransitionToSize(toSize, coordinator);
if (ViewWillTransitionToSizeEvent != null)
ViewWillTransitionToSizeEvent(toSize, coordinator);
}
}
}
It's working well if the user start the App himself. But I got push notifications on my App and when the App is killed and the user tap on the notification message to open it, the App is crashing. So in my device logs I have :
[AppCenterCrashes] ERROR: +[MSWrapperLogger MSWrapperLog:tag:level:]/10 Unhandled Exception:
System.Exception: Please set SildeMenuView WidthRequest
at SlideOverKit.HorizontalGestures.CheckViewBound (SlideOverKit.SlideMenuView view) [0x0003c] in C:\Users\Jesse\Documents\Visual Studio 2017\Projects\SlideOverKit\SlideOverKit\Gestures\HorizontalGestures.cs:22
at SlideOverKit.HorizontalGestures..ctor (SlideOverKit.SlideMenuView view, System.Double density) [0x0000f] in C:\Users\Jesse\Documents\Visual Studio 2017\Projects\SlideOverKit\SlideOverKit\Gestures\HorizontalGestures.cs:12
at SlideOverKit.DragGestureFactory.GetGestureByView (SlideOverKit.SlideMenuView view, System.Double density) [0x00037] in C:\Users\Jesse\Documents\Visual Studio 2017\Projects\SlideOverKit\SlideOverKit\Gestures\DragGestureFactory.cs:17
at SlideOverKit.iOS.SlideOverKitiOSHandler.LayoutMenu () [0x00030] in <67cebbfd044c477f80909f816f090e8c>:0
at SlideOverKit.iOS.SlideOverKitiOSHandler.OnElementChange<…>
That's why I wrote the following line :
if (e.NewElement.WidthRequest < 0) return;
So the App doesn't crash anymore but the SlideMenu still broke.
Metadata
Metadata
Assignees
Labels
No labels