Could not initialize an instance of the type 'UIKit.UIImage'
Opened this issue · 1 comments
jbarreira commented
I'm trying to add TEditor to my Xamarin application (not using Xamarin.Forms) and when calling the
await CrossTEditor.Current.ShowTEditor it's giving me this error:
System.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 (IntPtr handle, System.String initSelector) [0x00094] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/Foundation/NSObject2.cs:453
at UIKit.UIImage..ctor (System.String filename) [0x0002e] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/build/ios/native/UIKit/UIImage.g.cs:94
at PopColorPicker.iOS.PopColorPickerViewController.SetViewControllers () [0x00000] in C:\Users\Michael\Documents\TEditor\PopColorPicker.iOS.Shared\PopColorPickerViewController.cs:112
at PopColorPicker.iOS.PopColorPickerViewController.ViewDidLoad () [0x0007d] in C:\Users\Michael\Documents\TEditor\PopColorPicker.iOS.Shared\PopColorPickerViewController.cs:80
at (wrapper managed-to-native) ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
at UIKit.UITabBarController..ctor () [0x0003b] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/build/ios/native/UIKit/UITabBarController.g.cs:53
at PopColorPicker.iOS.PopColorPickerViewController..ctor () [0x00000] in C:\Users\Michael\Documents\TEditor\PopColorPicker.iOS.Shared\PopColorPickerViewController.cs:19
at TEditor.TEditorViewController.AddColorPickerControl () [0x00000] in C:\Users\Michael\Documents\TEditor\iOS\Controls\TEditorViewController.cs:111
at TEditor.TEditorViewController.ViewDidLoad () [0x00018] in C:\Users\Michael\Documents\TEditor\iOS\Controls\TEditorViewController.cs:245
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/UIKit/UIApplication.cs:77
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/UIKit/UIApplication.cs:61
at TiendaNubeIOS.Application.Main (System.String[] args) [0x00008] in /Users/juane/mobile-apps/TIendaNubeIOS/Main.cs:13
2017-05-31 17:57:22.024 TiendaNubeIOS[31327:4189271] Unhandled managed 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. (System.Exception)
at Foundation.NSObject.InitializeHandle (IntPtr handle, System.String initSelector) [0x00094] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/Foundation/NSObject2.cs:453
at UIKit.UIImage..ctor (System.String filename) [0x0002e] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/build/ios/native/UIKit/UIImage.g.cs:94
at PopColorPicker.iOS.PopColorPickerViewController.SetViewControllers () [0x00000] in C:\Users\Michael\Documents\TEditor\PopColorPicker.iOS.Shared\PopColorPickerViewController.cs:112
at PopColorPicker.iOS.PopColorPickerViewController.ViewDidLoad () [0x0007d] in C:\Users\Michael\Documents\TEditor\PopColorPicker.iOS.Shared\PopColorPickerViewController.cs:80
at (wrapper managed-to-native) ObjCRuntime.Messaging:IntPtr_objc_msgSendSuper (intptr,intptr)
at UIKit.UITabBarController..ctor () [0x0003b] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/build/ios/native/UIKit/UITabBarController.g.cs:53
at PopColorPicker.iOS.PopColorPickerViewController..ctor () [0x00000] in C:\Users\Michael\Documents\TEditor\PopColorPicker.iOS.Shared\PopColorPickerViewController.cs:19
at TEditor.TEditorViewController.AddColorPickerControl () [0x00000] in C:\Users\Michael\Documents\TEditor\iOS\Controls\TEditorViewController.cs:111
at TEditor.TEditorViewController.ViewDidLoad () [0x00018] in C:\Users\Michael\Documents\TEditor\iOS\Controls\TEditorViewController.cs:245
at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/UIKit/UIApplication.cs:77
at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3234/d8bedd03/source/maccore/src/UIKit/UIApplication.cs:61
at TiendaNubeIOS.Application.Main (System.String[] args) [0x00008] in /Users/juane/mobile-apps/TIendaNubeIOS/Main.cs:13
It seems that color-picker-favorite@2x.png cannot be found. Do you know any workaround?
Thanks!
jessejiang0214 commented
Can you try to rebuild the project? It's wired, that images also in the source code.