Iphone Apps







Iphone Apps:



How to Make an iPhone App



Ever had a good idea for an iPhone App but didn’t know where to start?. This article will introduce you to some basic setup steps to follow, the hardware and software you will need, things to start learning and places to find them and finally the App Store submission process. It will focus on native iPhone applications using Objective-C but will not provide an in-depth Objective-C tutorial. Although there are a number of frameworks that allow you to build apps in other languages, many of the steps here still apply. The time needed to get familiar with Objective-C will depend on your past programming experience, your ability to grasp it and the complexity of your application. There is no shortcut or quick way. If you intend to make a career out of iPhone development, you will never stop learning; it’s a vast subject that continues to grow every day. If you intend to learn just enough to build that app you have in mind, then the task at hand may be smaller and this article will help save you some time.

Steps

  1. Setup. At a minimum you will need the Apple iPhone SDK (software development kit) installed. You can download it here. Among other things, this kit includes an iPhone simulator that allows you to test your app. To test on a physical iPhone, iPad or iPod and then distribute to the App Store, you will need an Apple developer license. The basic license is $99 per year. After you have purchased your license, you can log into the iOS Provisioning portal and download and install your crispy new development certificate. If your app requires a custom user interface or is a game, you will also need an image editing program like Adobe Photoshop to create your graphical assets.Once you have the iPhone SDK installed, you will have an array of new programs to help you. XCode, Interface Builder & Instruments are the main three. See Apple documentation on these.
  2. Learning. Note: you will need an Apple developer account to view many of the folowing links. Apple’s iOS Dev Center contains a massive amount of documentation, how to’s and samples to help you learn and is the best place to start reading. There is some required reading you must do and it’s best to get this over with first.This information will help you design your project to Apple standards. If you like developer videos visit the Apple World Wide Developer Conference “WWDC10” and check out some session videos.It may make sense for you focus on articles and samples that closely match the areas needed to complete the type of app you have in mind. Navigating views, getting data from the internet, storing data on the device, viewing images, creating animation etc. It’s unlikely you will find everything you need in one article so keep bookmarks of topics, documentation and tutorials you consider applicable. This will create a set of resources you will need as reference while building your app.
  3. Experiment. Log into your Apple developer account then download and run some of the sample projects in XCode just to get the feel of it. Try some demo apps and read tutorials from web resources like http://www.iphonedevsdk.com/. Spend a couple of days doing this.
  4. Setup your app. Each application that runs on the iPhone has a unique id and a set of certificates needed to authenticate the developer “you” with the app. A Development certificate, an Ad-Hoc certificate and a Distribution certificate. The Development certificate allows you do build and test on your iPhone using the computer you work on.Each iPhone has a unique UDID. This is available by plugging in your device and starting iTunes 7.7 or later. Select the device and click the Summary tab. Click the serial number and it will change to the 40 character UDID. You can copy and paste this where needed.If you want to test your app on a device that you do not own “a friends”, you need to create an Ad-Hoc certificate that contains your friends device UDID. When it’s time to send your app to the App Store, you need to create a Distribution certificate. Note: you need to be logged into the Apple Dev Center to perform the following tasks.
    • Creating an app id by going to iOS Provisioning Portal selecting App ID’s and Pressing the “New App ID” button. Fill in the common name, Bundle Seed and Bundle Identifier fields. Then press Submit. There is nothing to download here, it just lets Apple know they have a potential new app and they can assign an id to.
    • Provisioning Profiles are created by clicking “Provisioning” and then “new Profile”. here you can create a new Development profile for your app. Then click the Distribution tab and create two profiles, one App Store and one Ad-Hoc. If you do intend to test on a friend’s device, click Devices in the menu and add the device name and UDID, this will allow it to be listed when you create an Ad-Hoc certificate. Download all three profiles once they are created and pop them into the folder /Users/YourName/Library/MobileDevice/Provisioning Profiles.
  5. Start Coding. This article is not intended to be an Objective-C tutorial, that part you can only learn with time, dedication and the Apple recourses listed, so lets assume you have coded some functionality and are ready to test. You can do this on the iPhone Simulator or your physical device.Start XCode, create a new iPhone project using the app name and then setup the project info. This step is necessary to tell XCode what architecture, SDK, device type and certificates to use. Select the the Project name in the Groups and Files list “first file” and press the blue Info button in the toolbar. There is a mass of overwhelming information here but for now only concern yourself with the red circled area. Here you need to choose the certificate to compile with for each type of build. If you successfully performed the certificate creation, download and install steps from above, the certificates shall be listed here. Development, Ad-Hoc and Distribution. Development works for the simulator and your device. Ad-Hoc for friends device and Distribution for the App Store. It’s time to configure all your build types.
    • Make sure Debug is selected for the configuration drop down, choose the Development certificate for code signing. Double check the item listed “Targeted Device Family” to make sure you are creating an app for the type of device you intended.
    • Change the configuration drop down to release and choose your Distribution certificate for the code signing.
    • Click the Configurations Tab at the top and in the list, select Release, then at the bottom click Duplicate. Rename this configuration to Ad-Hoc. Go back to the Build Tab and select Ad-Hoc from the configuration drop down. This time choose your Ad-Hoc certificate for the code signing and close the project info window.
    • Back in XCode choose File -> New File. In the left panel choose Code Signing. In the right panel choose Entitlements. Name it Entitlements.plist and create it. It will be added to your resources. Click on it and uncheck the get-task-allow checkbox.
    • Go back to your project info window and select the Ad-Hoc from configurations and set the value for Code Signing Entitlements to Entitlements.plist. You now have three build configurations. Close the project info window.
  6. Test. Choose Simulator and Debug from the drop down list and press the “Build and Run” icon. If all goes well, the iPhone simulator should launch and your app should run. I should point out that the simulator does not have all the functionality of the iPhone device and some things might not work. Accelerometer and GPS location services to name two. If your app ran in the simulator, it’s time to test it on the device. Make sure your iPhone, iPad or iPod touch is plugged into a USB port using the cable that came with it. If iTunes or iPhoto open, just go ahead and close them. From the drop down list in the toolbar, choose Device and Debug and then the “Build and Run” icon again. After a few seconds the app should launch on the device. What a great feeling when you see this for the first time. Congratulations. Test the app to assure the expected functionality and then close it.
  7. Debug. If your app crashed, you need to start figuring out what happened and why. Again, this is a vast subject and there are a million reasons your app may have crashed. Some more required reading from apple about debugging.Open the debug console and read the error messages. Most of the time they are rather cryptic and make no sense to a beginner. Honestly, if you do not understand the error, try googling the error message. 9 times out of 10, there is a post on the Apple development forum where someone else has asked the same question and if you are lucky, a friendly seasoned developer has answered their plea. Debugging can be a very time consuming and tedious time for you. If you don’t give up and persevere, in time you will get better at it, start to recognize the errors, track them down quickly and even expect them on occasions. One common mistake is releasing an object from memory more than once. Another is forgetting to allocate memory and initialize an object before trying to add or assign to it. With each app your errors will become fewer and fewer. Honestly, it does happen.
  8. Check memory usage. the iPhone has a very limited amount of memory. Each time you allocate an object some memory, you have to release it when you are done with it and give back the memory. Yes more required reading. When will it end?. It’s only difficult and tedious the first or second time.Instruments is the iPhone SDK tool for viewing and analyzing your memory usage amongst other things. With Device and Debug selected as before, choose Run -> Run with Performance Tool -> Leaks. This will launch Instruments and start the app on your device. Go ahead and use the app as normal. It will seem to freeze periodically as instruments records and analyzes your memory usage. Any leaks will result in a red spike in the leaks timeline. Press the red record button to stop the app and then click on the leaks timeline. The source of the leaks will be displayed in the lower half of the screen. Double clicking on the leaked objects will attempt to take you to the responsible code or clicking on the little arrow in the address column will show you the leak history. Sometimes where the leak is detected is not necessarily where it originated from.If you get really stumped, try by process of elimination, comment out and or carefully bypass areas of your code and run it. Sometimes you can narrow down the general area and then eventually home in on the responsible line. When you know where it is, you can fix or rewrite it. Remember, using Google can often provide you with the quickest direct links to internal Apple forums or documentation that deal with your issue. Believe me, you will not be the first nor the last to run into a particular problem. Sometimes you will find entire articles written to help understand certain problematic things. you are not alone.
  9. Ad-Hoc Distribution. Assuming you have everything working, no crashes, no leaks, it’s time to send your app to a friend or colleague to test. This is not an entirely necessary step but worth while. You can get valuable feedback from a fresh pair of eyes and see how your app fairs on other devices that may have different iOS versions installed. If one of your app features uses the camera for example, what happens when it’s run on an iPod touch?. It’s up to you to gracefully handle this in your code. You may not have thought of everything and Ad-Hoc testing can reveal lots of issues that you never took steps to avoid in your nice controlled development environment.Choose Device from the drop down list and press the “Build” icon. Don’t press build and run. No need to run the development app on your device with an Ad-Hoc or Distribution certificate. In the Finder, navigate to your projects build folder and look for the Ad-Hoc-iphoneos folder. Inside there will be an app. Copy your AdHoc.mobileprovision certificate from the folder /Users/YourName/Library/MobileDevice/Provisioning Profiles into here. Select the app and the certificate and zip them up. This archive can be given to your friend for testing. Warning: most email servers will complain and not allow email with Binary attachments, so it’s best to ftp or deliver by some other file sharing service or using a USB drive.
  10. Review. The big day has arrived and its time to send you app to Apple for review. All the careful steps you have painstakingly endured up till now were to speed up the review process. Any mistakes in the UI that do not conform to the human interface guidelines, crashes, bad memory leaks, etc. will show up when the Apple engineers test your app and they will reject your binary, this will set you back a couple of weeks, so read the documentation and follow the process the best you can. Now would be a good time to double check everything.
    • Check your app runs perfectly from beginning to end without crashing.
    • Check for memory leaks.
    • Check it conforms to interface guidelines.
    • If your app requires internet access, make sure you have taken steps to notify the user and disable those features.
    • If you have implemented the iAd framework, make sure you are hiding the iAd view when no data or internet is available.
    • Check the project info again for correct target device, target iOS version, app version number etc.
    • Visit http://developer.apple.com/news/ios/appstoretips/ for a list of things to watch out for.
  11. App Store. Create your Distribution build by selecting Device and Release from the drop down. press the “Build” icon. In the Finder, navigate to your projects build folder and look for the Release-iphoneos folder. Inside there will be an app. Zip it up. Log into your Apple developer account and click on iTunes Connect to start setting up your App Store account. Setup your Contracts, Banking and Tax information using the forms. Apple makes this very easy. You will need your personal financial details. There are a number of steps to complete. Take your time and double check everything, after all, this is where all the money will flow from your awesome app. When you have completed all this, you are ready to submit your app.
    • Go to your iTunes Connect dash board. If you have any unfinished steps to complete for setup, they will be listed at the top of the page.
    • Click Manage Your Applications.
    • Click Add new Application.
    • Fill out the App name, SKU number and select the bundle id. The app bundle you created in step 4 will show in the drop down. Select it.
    • Fill out the forms providing your app description, keywords, support site, category, contact email, copyright etc.
    • Fill out the Rights and Pricing forms.
    • Have your iTunes artwork ready. Large 512x512 icon, some screen shots of your app. Screen shots can be grabbed from the iPhone simulator using command shift 4 and dragging the cross-hair over the area. Make sure they are 320x480 for iPhone and 768x1024 for iPad. Upload them.
    • Fill out any other information that pertains to your app and if you implemented the iAd framework, enable it for your app then click done.
    • Click the ready to upload Binary and you will be taken to a screen that directs you to download the Application Uploader tool. Download it and press done.
    • Install the Application Uploader tool and launch it. The first time it will ask for your iTunes log in information, fill it in.
    • The Application Uploader tool will check your iTunes Connect account and find any apps you have ready to upload binaries for. They will be displayed in the drop down. Select the one you want, choose the Distribution zip you created at the beginning of this step and upload it. The uploader will check some internal stuff within the bundle and will error if it finds anything incorrect. Version number, missing icon etc. If everything is fine, it will upload the zip and finish.
    • Go back to your iTunes Connect account, click Manage Applications and you should see a little orange light next to you app icon with the words “Waiting for review”. Congratulations, you are done here for now.
  12. Wait. Nothing to do now except wait for the review process. Perhaps you can get cracking on your next app. Apple will notify you in a few days or weeks via email if your application state changes to “In review”. When it goes into review, the process is very quick. If it fails the initial barrage of tests you will get a rejection email probably the same day telling you why and Apple will offer suggestions for fixing it. When you fix it, it’s as easy as uploading a new binary, however, you go back to the end of the review line. If your app passes inspection, Apple will send you an email informing you that your app is ready for sale. Your orange light turns green. Phew.
  13. Promote. If all went well, you are probably feeling pretty good about yourself. After all, you worked hard and overcame some difficult problems. Now you are in a global market place. You will be selling your app in many countries and perhaps even making some money. Having a presence on the App Store gives you enormous potential but you need to do more.Blogging, tweeting, facebooking, emailing, and even perhaps running some web banner advertisement for your app. Apple gives you the ability to generate a number of promotional codes for paid apps that allow free downloads. You might want to post a few of those in choice spots around the web that you frequent. There are numerous sites dedicated to helping you promote your app, Google a few and choose one that you feel will serve you best.Do all you can to spread the word. In the end the overall popularity of your app will depend on how unique, fun, or useful it really is. User reviews and ratings are very important to move up the ranks. Securing a spot in the Featured apps, New and Noteworthy or Staff Picks is where you want to be. Good luck!.
  14. Watch. Download the free ITC Mobile for your iPhone and each day log in and check your sales, markets and countries of sale. This is the fun part!. Apple will periodically send you emails with links to your latest sales data. You can download them for your records.

Tips

  • Try to be original and not duplicate apps that already exist on the App Store. Do a thorough search of the App Store to find out what's available. Of course, if your idea is flat out better, then go for it.
  • Try to test on as many different iDevices you can get your hands on. Even better if they have varying iOS versions installed.
  • If you like printed reference, hit Amazon.com to find some iPhone development books.
  • Always look for ways to improve your app.

Warnings

  • The iPhone SDK is constantly changing and the devices evolving. If an SDK upgrade is made available during a project, make sure you read the what's new and changes before you jump on it. Unless stated by Apple that all new submissions must be compiled with the new SDK version, it may not be necessary for you at this point. If you do upgrade, some of the methods you have used may have become obsolete and although not likely to produce more than a warning at compile time, be safe.
  • When you succeed and get an app on the App Store, don't be intimidated by mean people who write nasty reviews. Some give helpful feedback and some just like to bitch.
  • It's addictive, you might not be able to stop.
  • You are not guaranteed lots of downloads or sales, don't get discouraged.

Things You'll Need