Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Created attachment 693 [details]
Open attached project. Open Screens/iPhone/Method3SwapViews/LandscapeView_iPhone.xib or PortraitView_iPhone.xib in xcode by double clicking.
notice that image is set.
those views are loaded in loadview depending on orientation:
public override void LoadView ()
// if we're switchign to landscape
NSBundle.MainBundle.LoadNib ("LandscapeView_iPhone", this, null);
// we're switch back to portrait
NSBundle.MainBundle.LoadNib ("PortraitView_iPhone", this, null);
however, when you run the app, the images won't load:
2011-10-13 18:15:13.615 HandlingRotation[2493:1907] Could not load the "XamSquare.png" image referenced from a nib in the bundle with identifier "com.yourcompany.handlingrotation"
2011-10-13 18:15:15.465 HandlingRotation[2493:1907] Could not load the "XamSmallSquare.png" image referenced from a nib in the bundle with identifier "com.yourcompany.handlingrotation"
You're loading the image as "XamSquare.png", but if you look at the Content file in the project, its bundle resource ID is actually "Images/XamSquare.png".
I suppose this is an issue with the way we export resources to Xcode. If it's not possible to export resources with the full ID, we shouldn't export them, to avoid confusion. Eventually the situation will be improved when I have time to implement the "bundle resource folder" idea I discussed some time back.
hm. sounds like we should get on the bundle resource bit. this is kind of a biggie, since it looks right in xcode, but no one is going to have any idea why it's not working.
Looks like the same bug as bug #1860
*** Bug 1860 has been marked as a duplicate of this bug. ***
mhutch, What needs to be done to fix this properly?
The best solution would be to figure out a way to make Xcode us the correct ID. If that 's not possible, we shouldn't export images from subdirectories to Xcode.
The bundle resources is a longer term solution. The basic idea is that resources would be in a "Resources" subdirectory. This would be similar to what we do for Android, and would make it possible to add resources to the root of the bundle without polluting the root of the project - which is what people with "Images" directories are trying to do.
I tried making our generated project.pbxproj file refer to the resource name as "Image/image.png" (e.g. the relative path from the project root) and Xcode still decided to refer to it as "image.png" in the xib.
So then I tested creating a new project in Xcode, dragging & dropping a folder named "Images" with an image.png file under it into my Xcode project. Xcode referred to this as "image.png" in the .xib as well.
I could find no way of referring to an image resource as anything other than the base name of the filename.
So I guess the only way to fix this is to not support syncing "Content" files from a non-root directory out to Xcode, which is what I've just now committed.
*** Bug 3131 has been marked as a duplicate of this bug. ***
It seems the resolution to this problem is to not support syncing content files which isn't a great solution, I wonder how we can resolve this in a better way.
It's not "not support syncing content files", it's "not support syncing 'Content' files from a non-root directory". Since Xcode doesn't appear to support the latter at all, it's simply not possible for us to sync them and have them work correctly.
There's a separate issue for support for structuring project files in "resource directories" in the MD project, yet having them copy to the bundle root. Obviously those *could* be synced to Xcode, once we support them.