Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS application broken #2

Open
polotto opened this issue Mar 26, 2021 · 1 comment
Open

iOS application broken #2

polotto opened this issue Mar 26, 2021 · 1 comment

Comments

@polotto
Copy link

polotto commented Mar 26, 2021

Hello,
I'm trying use the library I'm getting a system exception on iOS:

System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'PrimaryToolbarItem'.
  at Foundation.NSObject.get_SuperHandle () [0x00012] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSObject2.cs:394 
  at UIKit.UIBarButtonItem.set_Image (UIKit.UIImage value) [0x0002b] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/build/ios/native/UIKit/UIBarButtonItem.g.cs:827 
  at Xamarin.Forms.Platform.iOS.ToolbarItemExtensions+PrimaryToolbarItem.UpdateIconAndStyle () [0x00031] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Extensions\ToolbarItemExtensions.cs:84 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_0 (System.Object state) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1021 
  at Foundation.NSAsyncSynchronizationContextDispatcher.Apply () [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/Foundation/NSAction.cs:178 
--- End of stack trace from previous location where exception was thrown ---

  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 /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:86 
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0000e] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/UIKit/UIApplication.cs:65 

This is my XMAL toolbar code:

<ContentPage.ToolbarItems>
        <ToolbarItem
            IconImageSource="{extensions:ImageResource App.Common.Styles.Images.refresh.png}"
            Order="Primary"
            Priority="0"
            Command="{Binding RefreshItemsCommand}" />
        <ToolbarItem
            IconImageSource="{extensions:ImageResource App.Common.Styles.Images.upload.png}"
            Order="Primary"
            Priority="0"
            Command="{Binding PendingReadingCommand}" />
        <ToolbarItem Text="{x:Static locale:Resources.Home_Settings}"
                     Order="Secondary"
                     Priority="1"
                     Command="{Binding ShowSettingsCommand}" />
        <ToolbarItem Text="{x:Static locale:Resources.Home_Logout}"
                     Order="Secondary"
                     Priority="0"
                     Command="{Binding LogoutCommand}" />
        <ToolbarItem Text="{x:Static locale:Resources.Home_Information}"
                     Order="Secondary"
                     Priority="1"
                     Command="{Binding ShowInformationCommand}" />
    </ContentPage.ToolbarItems>

Can you help me?

Thanks in advance.

@Tommigun1980
Copy link
Owner

Hi.

Unfortunately you are running into this Xamarin.Forms issue: xamarin/Xamarin.Forms#6387
A workaround until they fix it is to not use a url-based image source in your toolbar icons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants