wilsonvargas / ButtonCirclePlugin

Circle Buttons with icon for your Xamarin.Forms Applications
MIT License
96 stars 18 forks source link

Value cannot be null - Parameter name: value - iOS #46

Closed matteopiccioni closed 5 years ago

matteopiccioni commented 6 years ago

Hello, this error happen only in iOS, as I add CircleButton xamarin form: 3.2.0.839982 Plugin versione: 2.0.3

In my iOS project I call in FinishedLaunching method: ButtonCircleRenderer.Init();

And I add this key in my Info.plist:

<key>UIAppFonts</key>
    <array>
      <string>materialicons.ttf</string>
      <string>fontawesome.ttf</string>
    </array>

In my xaml page I add a simple CircleButton into a grid:

...
             xmlns:local="clr-namespace:ButtonCircle.FormsPlugin.Abstractions;assembly=ButtonCircle.FormsPlugin.Abstractions"
...

<local:CircleButton 
        FontIcon="Material" Grid.Row="2"
        Icon="md-directions-bike" 
        FontSize="30" TextColor="Red" 
        HeightRequest="70" WidthRequest="70" 
        BorderThickness="5" BorderColor="Black" 
        BackgroundColor="#DCDCDC">
</local:CircleButton>

The exception I have: at UIKit.UIButton.set_Font (UIKit.UIFont value) [0x00058] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIButton.g.cs:765 at ButtonCircle.FormsPlugin.iOS.ButtonCircleRenderer.OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs1[TElement] e) [0x00089] in <fbde11586d42451093d079a04c1c7b72>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x0012a] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].SetElement (TElement element) [0x000de] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnChildAdded (Xamarin.Forms.VisualElement view) [0x0003d] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.VisualElementPackager.Load () [0x0001e] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.PageRenderer.ViewDidLoad () [0x00086] in <66855f87e3b64ff38a3e1034f86d8129>:0 at (wrapper managed-to-native) ObjCRuntime.Messaging.IntPtr_objc_msgSendSuper(intptr,intptr) at UIKit.UIViewController.get_View () [0x0002a] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIViewController.g.cs:2983 at Xamarin.Forms.Platform.iOS.PageRenderer.get_NativeView () [0x00008] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.PageRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x0004f] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.Platform.CreateRenderer (Xamarin.Forms.VisualElement element) [0x00014] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage (Xamarin.Forms.Page page) [0x00008] in <66855f87e3b64ff38a3e1034f86d8129>:0 at Xamarin.Forms.Platform.iOS.NavigationRenderer+<OnPushAsync>d__51.MoveNext () [0x0001d] in <66855f87e3b64ff38a3e1034f86d8129>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00037] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 at Xamarin.Forms.Platform.iOS.NavigationRenderer+<b__46_0>d.MoveNext () [0x00069] in <66855f87e3b64ff38a3e1034f86d8129>:0 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.b__6_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018 at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/Foundation/NSAction.cs:178 at (wrapper managed-to-native) UIKit.UIApplication.UIApplicationMain(int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0002c] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.0.0.15/src/Xamarin.iOS/UIKit/UIApplication.cs:63 at Score.iOS.Application.Main (System.String[] args) [0x00001] in /Progetti/vari/Score/Score/Score.iOS/Main.cs:17

josephkandi commented 6 years ago

The error seems to be happening because it cant find the font. Did you add the two fonts mentioned in the documentation to the Resources folder? You need to download https://raw.githubusercontent.com/wilsonvargas/ButtonCirclePlugin/master/src/ButtonCircle/ButtonCircle.FormsPlugin.UWP/Assets/Fonts/fontawesome.ttf and this, https://raw.githubusercontent.com/wilsonvargas/ButtonCirclePlugin/master/src/ButtonCircle/ButtonCircle.FormsPlugin.UWP/Assets/Fonts/materialicons.ttf and put them in the Resources folder in your iOS project

wilsonvargas commented 5 years ago

Thanks for help! @josephkandi