Xamarin forms ios images not visible when deployment target is changed.

DharumaRajDharumaRaj USMember ✭✭
edited June 2017 in Xamarin.Forms

Hello, I'm working on a Xamarin forms project. The problem is in my Xamarin forms ios project when I set my deployment target as 6 all the images are visible when run on simulator, but when I change my deployment target to 9.0, none of the images are visible. I don't know how to resolve this issue.
with deployment target 9.0 i'm getting the below exception.

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. at Foundation.NSObject.InitializeHandle (System.IntPtr handle, System.String initSelector) [0x00094] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/Foundation/NSObject2.cs:465 at UIKit.UIImage..ctor (System.String filename) [0x0002e] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/build/ios/native/UIKit/UIImage.g.cs:95 at Xamarin.Forms.Platform.iOS.ToolbarItemExtensions+SecondaryToolbarItem.UpdateIcon () [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Extensions\ToolbarItemExtensions.cs:142 at Xamarin.Forms.Platform.iOS.ToolbarItemExtensions+SecondaryToolbarItem..ctor (Xamarin.Forms.ToolbarItem item) [0x00018] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Extensions\ToolbarItemExtensions.cs:113 at Xamarin.Forms.Platform.iOS.ToolbarItemExtensions.ToUIBarButtonItem (Xamarin.Forms.ToolbarItem item, System.Boolean forceName) [0x00000] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Extensions\ToolbarItemExtensions.cs:28 at Xamarin.Forms.Platform.iOS.NavigationRenderer+ParentingViewController.UpdateToolbarItems () [0x0008f] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:935 at Xamarin.Forms.Platform.iOS.NavigationRenderer+ParentingViewController.ViewDidLoad () [0x00044] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:847 at (wrapper managed-to-native) ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr) at UIKit.UIViewController.get_View () [0x00030] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/src/build/ios/native/UIKit/UIViewController.g.cs:2716 at Xamarin.Forms.Platform.iOS.NavigationRenderer.CreateViewControllerForPage (Xamarin.Forms.Page page) [0x000ee] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:401 at Xamarin.Forms.Platform.iOS.NavigationRenderer+<OnPushAsync>d__44.MoveNext () [0x0000a] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\NavigationRenderer.cs:354 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128 at System.Runtime.CompilerServices.TaskAwaiter 1[TResult].GetResult () [0x00000] in /Users/builder/data/lanes/3969/44931ae8/source/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357 at Xamarin.Forms.NavigationPage+<PushAsyncInner>d__90.MoveNext () [0x0009a] in C:\BuildAgent2\work\aad494dc9bc9783\Xamarin.Forms.Core\NavigationPage.cs:358
@BytesGuy

Answers

  • prashantvcprashantvc USXamarin Team Xamurai

    What method are you using to initialise an Image? Where are you using them?
    Did you try set MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure to false in the iOS project?

  • DharumaRajDharumaRaj USMember ✭✭

    "What method are you using to initialise an Image?" I just call the image name with extension. I did not try setting MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure bcoz I don't know how to do it in Xamarin studio. @prashantvc I'm quite new to xamarin.

  • DharumaRajDharumaRaj USMember ✭✭

    Any solution for this @prashantvc . I'm not able to find any solution for this. It would be a great help for me.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @DHarumaRaj,

    It looks like the issue is coming from Xamarin.Forms.Platform.iOS.ToolbarItemExtensions+SecondaryToolbarItem.UpdateIcon (). Which version of Xamarin.Forms are you using? It's possible that you are using a newer version where support for iOS 6 has been dropped.

    You can check the version via NuGet package manager.

  • DharumaRajDharumaRaj USMember ✭✭

    @JohnMiller My Xamarin.Forms version is 2.3.2.127, and my projects deployment target is 9.0, Previously it was 6.0 and I changed it to 9.0. I'm using Assets.xcassets for images. Is there any workaround for this problem.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @DharumaRaj,

    Hm, I think that version is before the deprecation I mentioned. Can you zip up a sample project that I could use to reproduce that error?

  • DharumaRajDharumaRaj USMember ✭✭

    @JohnMiller will the issue be resolved if I update my Xamarin.forms package? I'll send my project tomorrow.

  • DharumaRajDharumaRaj USMember ✭✭

    @jhonmiller The all the images are visible if I change my deployment target is set to 6.0, but when I change it to 9.0 none of my images are visible, I think its not this Xamarin.Forms.Platform.iOS.ToolbarItemExtensions+SecondaryToolbarItem.UpdateIcon () bcoz none of my app images are visible .

Sign In or Register to comment.