Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Possible bug on imageView

Hello everyone, I'm experiencing a big problem with imageView.
I'm compiling my app whit sdk 1.4.3 (downloaded from continuous builds), I have just built the last kitchensink and the imageView works as well in all examples.
I have past the same code of 'image_view_file.js' in my app, and I have created the directory image with the image apple_logo.jpg copied from kitchensink directory.

var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'images/apple_logo.jpg');

var imageView = Titanium.UI.createImageView({


After a lot of various test, I receive the same error

[ERROR] invalid image type. expected either TiBlob or TiFile, was: TiFilesystemFileProxy in -[TiUIImageView setImage_:] (TiUIImageView.m:671)

Now, why in kitchensink the same code is compiled and work perfectly, and not in my app?
both apps are built whit the same sdk.
This is not normal..

— asked November 15th 2010 by Stefano Di Luca
  • image
  • imageview
  • imageviews
  • kitchensink

2 Answers

  • Accepted Answer

    Does the file /path/to/project/Resources/images/apple_logo.jpg definitely exist, and are you certain that you are not receiving an error about the file not being found? Can you open it on your local machine without issue? if yes then, and this is admittedly a guess, try:

    touch /path/to/project/tiapp.xml

    to ensure that the project is rebuilt and assets are copied over.

    — answered November 15th 2010 by Paul Dowsett
  • Thank you for your answer, I have solved changing the relative path

    var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'images/apple_logo.jpg');

    with the absolute path

    var f = Ti.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory,'/images/apple_logo.jpg');
    — answered November 16th 2010 by Stefano Di Luca
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.