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({
image:f,
width:24,
height:24,
top:100
});
win.add(imageView);
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..
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.
-
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');