views:

226

answers:

4

Hi,

I have a UILabel Outlet, and everytime I access its text property with multiple characters, then it will crash and gives me EXC_BAD_ACCESS. Its very weird and I can't find any solution for this issue.

Thanks. sasayins

+1  A: 

Did you synthesize the property? are you releasing it somewhere by mistake? gotta put some code up in order for us to help you...

Daniel
Yeah sir, I synthesize the IBOutlet.
sasayins
+1  A: 

You probably forgot to link the outlet in Interface Builder to the desired UILabel. This means that the UILabel is currently nil (non existent). Drag a line from the file owner to the UILabel to connect the outlet in Interface Builder.

MiRAGe
It's connected in the interface building. And IBOutlet UILabel is not nil, I used a debugger to check for this.
sasayins
you're gonna have to place some code here then.
MiRAGe
+1  A: 

When it got EXC _BAD _ACCESS, would you mind get the backtrace and post it here?

Or better: post the code where you access/modify the UILabel.

unknownthreat
Hi Sir, what is backtrace? Sorry I am new to xcode. Thanks a lot.
sasayins
A backtrace is a list of the function calls that are currently active in a thread. (source: www.gnu.org/s/libc/manual/html_node/Backtraces.html) More info at: http://en.wikipedia.org/wiki/Stack_trace . When your program crushes, there should be a blue "(gdb)" shown up in your debugger console. Type "bt" for backtrace and you will see all the functions in the stack. It may give you a hint for where your program really crashes.
unknownthreat
+1  A: 

Make sure that your outlet does not have the same name as a property of one of the super classes of your view controller. For example, UIViewController has a title property, and if you create an outlet with the name of "title" you are overriding this property and will most likely have problems.

Paul Franceus