Forum Xamarin.Forms


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Icon property causes iOS System Exception native 'initWithContentsOfFile:' method returned nil.

RussellFustinoRussellFustino USUniversity ✭✭

When I set the Icon property to a tab menu page, I get the following System Exception when running the iOS Xamarin Forms app:

System.Exception: Could not initialize an instance of the type 'MonoTouch.UIKit.UIImage': the native 'initWithContentsOfFile:' method returned nil.

Here is the code in app.cs in the Xamarin Fomrs PCL.

        var tabbedMenuPage = new TabbedPage();

        tabbedMenuPage.Children.Add(new NavigationPage(new OfficialVideosPage())
            Title = "Official Videos",
            Icon = "TullLogo50x50.png"

OfficalVideosPage is a XAML page.

This icon image is in the PCL project root with the property Build Action = Content. Size of image is 50x50 and type is .png.

If I remove the icon property, it runs fine. Do I need to make this a device specific setting in the PCL?

Is this a bug? I get the same results for stable Xamarin build,
as well as these Beta releases :

Xamarin (d6a2cae)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (49a04b966feb40dfdba49d57ba16249b66d606a6)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.Forms Intellisense 1.0
Provides intellisense for Xamarin.Forms in the XML editor.

Xamarin.iOS (eb24bdcf5cba2c12b673a07e0a8cce368b9563b3)
Visual Studio extension to enable development for Xamarin.iOS.

Xamarin.iOS Unified Migration 1.0
Automated migration for Xamarin iOS Classic projects to Unified


  • RussellFustinoRussellFustino USUniversity ✭✭

    This is no longer happening, not sure why. Perhaps a fix have been issued in one of the xf updates.

Sign In or Register to comment.