My pdf viewer has stopped working

nnovalbos
371
Reputation points
Hello, I have a custom render to view pdf's on iOS:
[assembly: ExportRenderer(typeof(PdfView), typeof(PdfViewRenderer))]
namespace DocPath.Mobile.PdfViewer.Platforms.iOS.CustomRenders
{
[Xamarin.Forms.Internals.Preserve(AllMembers = true)]
public class PdfViewRenderer : ViewRenderer<PdfView, WKWebView>
{
protected override void OnElementChanged(ElementChangedEventArgs<PdfView> e)
{
base.OnElementChanged(e);
if (Control == null)
{
SetNativeControl(new WKWebView(Frame, new WKWebViewConfiguration()));
}
if (e.OldElement != null)
{
// Cleanup
}
if (e.NewElement != null && !string.IsNullOrEmpty(Element.PdfFilePath))
{
Control.LoadRequest(new NSUrlRequest(new NSUrl(Element.PdfFilePath, false)));
}
}
protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
{
base.OnElementPropertyChanged(sender, e);
if (e.PropertyName == nameof(PdfView.PdfFilePath) && !string.IsNullOrEmpty(customWebView.PdfFilePath))
{
((IElementController)Element).SetValueFromRenderer(PdfView.PdfFilePathProperty, customWebView.PdfFilePath);
Control.LoadRequest(new NSUrlRequest(new NSUrl(customWebView.PdfFilePath, false)));
}
}
}
}
This worked perfectly until a few days ago, without knowing why it does not load the document and does not show me any error message.
The route to use was from cache, but I have also tried others when it stopped displaying ... but nothing.
Any ideas? Do you know if something has changed in xamarin.ios?
Thanks
Developer technologies | .NET | Xamarin
5,381 questions
Sign in to answer