我正在开发一个Xamarin表单项目。问题出在我的Xamarin表单ios项目中,当我将部署目标设置为6时,所有图像在模拟器上运行时都可见,但是当我将部署目标更改为9.0时,没有任何图像可见。我不知道如何解决这个问题。 部署目标9.0我得到以下异常。
无法初始化“UIKit.UIImage”类型的实例:本机“initWithContentsOfFile:”方法返回nil。有可能的 通过设置忽略这个条件 MonoTouch.ObjCRuntime.Class.ThrowOnInitFailure为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