CCImage::initWithImageFile throws bad access

Hello i have the following line of code:

CCImage * sol;
sol->initWithImageFile(“filanme.png”);

it throws memory bad access as the you can see in the image.


Screen Shot 2012-08-20 at 14.19.04.png (36.5 KB)

that means that the file you are trying to request does not exist. If you are enabling retina, in order to work you need the following files in your folder:

filename.png
filename-hd.png
filename-ipad.png
filename-ipadhd.png

good luck

JB

I dont think thats the problem, when I watch the info… it has all the image information, including height and width…
But ill try clean the solution once again and see if everything gets sent to device.
Post here the results

well, when you try to load an asset, and are enabling retina, it, internally, looks for those other files, and if they are not there then you have problems… if that’s not your problem I hope somebody else can help you. Please share the results :slight_smile:

Maybe you donnot load the resources to your Xcode project.check the Resource folder if it contains the picture you use.

I see your points guys

but i confirmed the picture is there,
i cleaned out the solution,

here is a picture showing the metada information for the picture, its there…

try this:
CCImage* sol= new CCImage;
sol->initWithImageFile(“filanme.png”);

But your code will not cause the problem in my project.

Right;

The bad access was exactly that…
a shame i got used Cocos2d-x allocating everything for me…

in that case i own those object created with new, is that right? i must dispose of them in the destructor…

thanks guys