---
title: "Why is my iPhone app crashing?"  
description: "Why is my iPhone app crashing?"  
author: "Anonymous User"  
published: 2015-09-09  
updated: 2015-09-10  
canonical: https://www.mindstick.com/forum/33453/why-is-my-iphone-app-crashing  
category: "iphone"  
tags: ["iphone", "ios", "objective c"]  
reading_time: 1 minute  

---

# Why is my iPhone app crashing?

When I try to allocate a Texture2D the app just crashes. I've stepped through the [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) where the crash occurs... all I can tell is "EXC BAD [ACCESS](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china)". Here is the line in the app [delegate](https://www.mindstick.com/articles/777/delegate-and-event-in-c-sharp) that makes it crash:

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

myColor.png has been added to the [resources](https://yourviews.mindstick.com/view/293/renovation-causes-wastage-of-resources) folder via "add existing [files](https://www.mindstick.com/articles/23302/the-importance-and-advantage-of-keeping-your-important-files-on-the-cloud)". I was able to [load](https://answers.mindstick.com/qa/33737/what-is-meant-by-average-load-time) this png just fine in some sample code... but now when I'm [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to [duplicate](https://www.mindstick.com/forum/160911/sql-query-to-find-duplicate-records-in-a-table-in-sql-server) the [functionality](https://www.mindstick.com/blog/136/using-watermark-functionality-in-textbox-by-jquery) of the sample code it just crashes. Any [ideas](https://www.mindstick.com/articles/43878/making-the-best-use-of-the-options-trade-ideas)?\
Also I can do the following just fine:

```
_textField = [[UITextField alloc] initWithFrame:               CGRectMake(50, 224, 210, 40)];
```

## Replies

### Reply by Tarun Kumar

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.


---

Original Source: https://www.mindstick.com/forum/33453/why-is-my-iphone-app-crashing

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
