IPhone programming has been around in the market since 6 years. The development time for iPhone tends to be less and fast. Like other development domains developers tend to get into small but common mistakes. We have listed out some common mistakes in iPhone development which if avoided can save lots of time and make your app efficient.
1. UITabbarController’s view positioning
Add the UITabbarController’s view to the main window not to a subview. . It is meant to be the root controller of your app. If you add it to other controllers, it will not behave correctly.
2. String Comparison
== is used to compare pointers not stringsTo compare strings use isEqualToString:, isEqual: or compare
3. Insert / Update not working?
Many times you might have come across situations where your insert/update commands didn’t seemed to modify your database. Check if you are not looking at a wrong db file. During the build phase the resources are copied to“/Users/$user_name/Library/Application Support/iPhone Simulator/$sdk_version/Applications/$app_id/$app_name.app”
4. Retina images not showing
For retina you have the second set of images with that @2x attached to them. IF you come across a situation where you cannot see your @2x images in device, take a breath and check the image names.
The images should be like:
1x images – image.png (Correct)
1x images – [email protected] (Wrong)
2x images – [email protected] (Correct , there is a suffix @2x to images)
Keep both the images in the same folder in the project.
5. Adding a control dynamically
You will come across situation of adding a control dynamically (on run). Always remember that it must be added as a subview of parent view.
6. Lost data when new version of iOS was upgraded?
If your app has a database and you want the user to keep the data even if he upgrades the iOS store it in Cache directory. IF you store it in Documents directory when the user upgrades his iOS his data shall be lost as it the path differs for the installed iOS.
7. Position of Subview
While adding a subview, keep in mind to reference the ‘bounds’ of your parent view when positioning your subviews on screen not the main view.
These were few common mistakes which developers should avoid. You can share your experience of such mistakes here and help the iPhone developer community.