iOS Reference Library Apple Developer
Search

Troubleshooting

This section describes some approaches to solving common problems that you may encounter.

Code and Compiler Warnings

If things aren’t working as they should, first compare your code with the complete listings as given in “Code Listings.”

Your code should compile without any warnings. Objective-C is a very flexible language, and so sometimes the most you get from the compiler is a warning. Typically you should treat warnings as very likely to be errors.

Check Connections in the Nib Files

As a developer, if things don’t work correctly, your natural instinct is to check your source for bugs. Cocoa adds another dimension. Much of your application’s configuration may be “encoded” in the nib files. And if you haven’t made the correct connections, then your application won’t behave as you expect.

If the text doesn’t update when you tap the button, it might be that you didn’t connect the button’s action to the view controller, or connect the view controller’s outlets to the text field or label.

If the keyboard does not disappear when you tap Done, you may not have connected the text field’s delegate or connected the view controller’s textField outlet to the text field (see “Making Connections”). If you have connected the delegate, there may be a more subtle problem (see “Delegate Method Names”).

Delegate Method Names

A common mistake with delegates is to misspell the delegate method name. Even if you’ve set the delegate object correctly, if the delegate doesn’t implement the method with exactly the right name, it won’t be invoked. It’s usually best to copy and paste delegate method declarations from the documentation.




Last updated: 2010-07-01

Did this document help you? Yes It's good, but... Not helpful...