Home > DeveloperSection > Forums > Why is my iPhone app crashing?
Jennifer Morgan
Jennifer Morgan

Total Post:13

Posted on    September-09-2015 11:29 PM

 iPhone iPhone  Ios  Objective C 

 1 Reply(s)
 691  View(s)
Rate this:

When I try to allocate a Texture2D the app just crashes. I've stepped through the code where the crash occurs... all I can tell is "EXC BAD ACCESS". Here is the line in the app delegate that makes it crash:

_textures[myTex] = [[Texture2D alloc] initWithImage:
                     [UIImage imageNamed:@"myColor.png"]];

myColor.png has been added to the resources folder via "add existing files". I was able to load this png just fine in some sample code... but now when I'm trying to duplicate the functionality of the sample code it just crashes. Any ideas?
Also I can do the following just fine:

_textField = [[UITextField alloc] initWithFrame:
               CGRectMake(50, 224, 210, 40)];

Tarun Kumar

Total Post:214

Posted on    September-10-2015 2:03 AM

Looks like the program can't find "myColor.png".
When I replace "myColor.png" with the entire path"users/ blah blah /myColor.png" the crash doesn't happen.

Modified On Sep-11-2015 12:53:44 AM

Don't want to miss updates? Please click the below button!

Follow MindStick