Xamarin.Plugins
Xamarin.Plugins copied to clipboard
IconTabbedPage IOS crash
I try to use IconTabbedPage on IOS but I have this error:
Could not initialize an instance of the type 'UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil. It is possible to ignore this condition by setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false.
It works great on Android. If I remove the "Icon" property from my childrens pages it works. Any idea?
Had the same, I was missing FormsPlugin.Iconize.iOS.IconControls.Init(); after forms init , make sure you have that and have added the font in info.plist
I have the same problem here. I have done all configurations @chrisfoulds any suggestion to do more?
No, I just added the bit I was missing as mentioned above.
@chrisfoulds but, you just did do what you said and the problem was solved?
Yes, that is why I posted what I did, I added the missing init and made sure the font was in the plist
It's funny. I'm using tabbed page, and when I use static xaml markup, works very well, but when i use c# code to create the tabs the problem raised. It no make sense, by the simple fact that i use c# and create on the fly controls the plugin doesn't work.
Hi @chrisfoulds, I've discovered what was happening(after a lot of head bang). The problem is related with another plugin that I use on my application: FreshMVVM There are two issues with the working together with this two plugins:
-
IconTabbedPage 1.1)The problem: not render icon The Iconize implmentation of TabbedPage custom render has a logic for register tabbed icons when the control is created but, on my application the tabs are created on runtime, so on the moment of the tabbed page is created by FreshMVVM, the tabs no exist yet, because of this static tabs declaration works. 1.2) The solution: for you use dynamic tabs with FreshMVVM and Iconize, you MUST create the children tabs BEFORE instance the IconTabbedControl, and create an overload constructor of IconTabbedControlPage to receive the children and set them on this moment.
-
IconToolbarItem 2.1) The problem: not render the icon The FreshMVVM plugin has your own NavigationContainer as well the Iconize require yours to works the IconToolbarItem, as is described on README. 2.2) Basically what you need is create an custom navigation container that put together this containers, for this create a new class that inherits from IconNavigationPage and implements the interface IFreshNavigationService and finally as described by @chrisfoulds above do not forget to Initialize the plugin on both platforms that you are using the Iconize: iOS->AppDelegate->FinishedLaunching: FormsPlugin.Iconize.iOS.IconControls.Init(); Android->MainActivity->OnCreate: FormsPlugin.Iconize.Droid.IconControls.Init(Resource.Id.toolbar, Resource.Id.tabMode); both before Forms.Init(this, bundle);
I hope that this tips be useful for someone!