BundleResource Imagefiles not accessible after installing with the Installer Package

HelgeKeckHelgeKeck DEMember ✭✭

Hi,

I created a MAC APP and it works very well if I start it directly form Visual Studio (Debug and Release). The APP shows an Image with:

LoginImage.Image = NSImage.ImageNamed(@logo);

After creating an Installer Package and installing the APP, i can run it, everything works, but the image is not displayed. The file exists inside the Content/Resources folder but I can't open it, I have no rights to do it. After changing the rights with the Finder, everything works as expected, the APP displays the image.

What do I miss? How can I solve this?

Thanks

Helge

Best Answer

  • HelgeKeckHelgeKeck DE ✭✭
    Accepted Answer

    I got it, it turns out that copying files from a windows PC over a network caused this problem. just had to change the file permissions before bundling the package.

    thanks

Answers

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Whenever you run into trouble with a Cocoa API, the best place is to look at the Apple documentation.

    https://developer.apple.com/reference/appkit/nsimage/1520015-imagenamed?language=objc

    However in your case, it appears to be a permission error. I would use ls -la on the file in question in bin/Release, then again after installation to try to track down where the permission issue is coming from.

  • HelgeKeckHelgeKeck DEMember ✭✭
    Accepted Answer

    I got it, it turns out that copying files from a windows PC over a network caused this problem. just had to change the file permissions before bundling the package.

    thanks

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai

    Yes, Windows files systems do not preserve macOS permissions perfectly.

    Packing up files via tar / gz or the like can be useful, but I'm glad you were able to sort the problem out.

Sign In or Register to comment.