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

Could not initialize an instance of the type 'UIKit.UIImage' #7

Open
jbarreira opened this issue May 31, 2017 · 1 comment
Open

Could not initialize an instance of the type 'UIKit.UIImage' #7

jbarreira opened this issue May 31, 2017 · 1 comment

Comments

@jbarreira
Copy link

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 [email protected] cannot be found. Do you know any workaround?
Thanks!

@jessejiang0214
Copy link
Contributor

Can you try to rebuild the project? It's wired, that images also in the source code.

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