40
Packaging and Distributing Your Applications Well done for making it here. You have successfully built your application and are now ready to release it to the rest of the world. All you need to do now is decide how to deploy and market it. We will take a look at what is required in order to submit our application to the Apple App Store, and share our creations with the rest of the community. In this appendix, we will focus on how we can effectively use Instruments within our applications to track down areas within our iOS applications that could be affecting the overall performance on the user's iOS device. We will take a look into each of the different types of built-in instruments, which come as a part of the Instruments application, and how we can use SystemTrace for iOS Instrument to help you track down system calls, memory, and threads that may be affecting the application's performance on your iOS applications. In this appendix we will: Learn about the iOS Human Interface Guidelines Introduce you to the Instruments environment Use Xcode instruments to ensure your application is running smoothly Set up your profiles for testing and distribution of your apps Set up your iOS development team and certificates Create application IDs and learn to register iOS devices for testing Learn how to price your applications and avoid them from being rejected Learn how to successfully market and promote your applications We have an exciting project ahead of us, so let's get started.

Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

Well done for making it here. You have successfully built your application and are now ready to release it to the rest of the world. All you need to do now is decide how to deploy and market it.

We will take a look at what is required in order to submit our application to the Apple App Store, and share our creations with the rest of the community. In this appendix, we will focus on how we can effectively use Instruments within our applications to track down areas within our iOS applications that could be affecting the overall performance on the user's iOS device.

We will take a look into each of the different types of built-in instruments, which come as a part of the Instruments application, and how we can use SystemTrace for iOS Instrument to help you track down system calls, memory, and threads that may be affecting the application's performance on your iOS applications.

In this appendix we will:

• Learn about the iOS Human Interface Guidelines• Introduce you to the Instruments environment• Use Xcode instruments to ensure your application is running smoothly• Setupyourprofilesfortestinganddistributionofyourapps• SetupyouriOSdevelopmentteamandcertificates• Create application IDs and learn to register iOS devices for testing• Learn how to price your applications and avoid them from being rejected• Learn how to successfully market and promote your applications

We have an exciting project ahead of us, so let's get started.

Page 2: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 396 ]

The iOS Human Interface GuidelinesWhenever you start to begin creating iOS applications, it is important to keep in mind and follow the iOS Human Interface Guidelines document that Apple provides. This document describes the guidelines and principles that help you design a consistent user interface and user experience for your iOS app.

This document provides you with the guidelines needed for developing applications thatrunefficientlyandeffectively on the iOS platform. This involves considering the screen dimension sizes of your window, the memory limitations, as well as the ease and use of the application.

Other areas are covered to ensure the consistency of your application as you navigate from one screen to another, as well as the principles for developing good user interfaces. This document also includes a wealth of information on how to go about providing status updates when the network is down, or other feedback through usingmessages,ifanunlikelyerrorhasoccurredorifafieldcannotbeleftblank.

There is other information relating to the proper use and appearance of views and controls; for example, navigation and toolbars, alert dialogs, Table views, buttons and icons, as well as sizes for custom icons and images.

For more information about the Apple iOS Human Interface Guidelines document, you can refer to the Apple Developer Documentation at the provided URL: https://developer.apple.com/library/ios/#documentation/Userexperience/Conceptual/mobilehig/MobileHIG.pdf.

Using Xcode instrumentsThe Instruments application is a powerful tool that enables you to collect information about the performance of your application over time. Through the use of the Instruments application, you can gather information based on a variety of different types of data, and enable yourself to view them side-by-side at the same time. This allows you to spot trends that would be hard to spot otherwise, and this can be used to see code running by your program along with the corresponding memory usage.

Page 3: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 397 ]

In the next section, we will be taking a look at how we can use these instruments to check to ensure that our application is running without any problems, and performing at its best when it is run on the iOS device.

How to ensure your application is running smoothlyThe instruments application comes with a standard library, which you can use to examinethevariousaspectsofyourcode.Youcanconfigureinstrumentstogatherdata about the same process or about different processes on the system. Each instrumentcollectsanddisplaysdifferenttypesofinformationrelatingtofileaccess,memory usage, network connections, and so on. One common use for instruments is to perform a system trace on your application.

This fantastic new instrument, which was added to the release of Xcode 4.2, helps you track down system calls, memory, and threads that may be affecting application performance on your iOS applications.

To show the use of the System Trace for iOS instrument, we will use the RouteTracker application that we created back in Chapter 6, RouteTracker Application. There are many ways in which you can start the instruments application; you can run instruments and then have it launch the iOS application, or you can use the tools under the Product menu from within Xcode. In the next section, this will show you howtorunandprofiletheRouteTracker application project.

Running and profiling the Route Tracker projectBeforeweproceedtoprofileour RouteTracker project, wemustfirstlaunchtheXcode development environment. This can be located in the /Xcode4/Applications folder. Alternatively, you can use spotlight to search for Xcode, by typing Xcode into the search box window.

1. Choose File | Open or press Command + O.2. Double-click on the RouteTracker folder.

Page 4: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 398 ]

3. Select the RouteTracker.xcodeprojfile.

4. Next, click on the OpenbuttontocontinuetoloadthefileintotheXcodeworkspace environment.

Next, wewillstartrunningandprofilingourapplication,whichwillbeusedtoperform a system trace on what threads and systems calls are being processed.

To run the Instruments application from within the Xcode environment, select Product | Build For | Profiling inside the Product menu or by using the keyboard shortcut Shift + Command + I, and then select the Profile option from the Product menu to launch the Instruments application. Similarly, you can use the keyboard shortcut Command + I.

Page 5: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 399 ]

Once this option has been selected, you will eventually see the Instruments application window display on your screen. This is shown in the following screenshot:

Page 6: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 400 ]

The following table gives an overview of each of the templates that are available and required for iOS development:

Template DescriptionBlank Creates an empty trace document to which you can add your

own combinations of instruments.Time Profiler Performs low-overhead and time-based sampling of one or all

processes.System Trace Provides you with the ability to profile against different aspects

of the operating system that could be affecting application performance.

Activity Monitor This monitors overall CPU, memory, disk, and network activity.

Automation Automates user interface tests within your application.Energy Diagnostics Displays diagnostics information regarding the amount of

energy being used on the device for GPU activity, display brightness, sleep/wake, Bluetooth, Wi-Fi, and GPS.

Network Connections With this instrument, it's possible to see how much data is flowing over each connection, for each application, as well as interesting statistics, such as round trip times and retransmission requests. You can use this information to help reduce network traffic and energy consumption.

Allocations Monitors memory and object-allocation patterns within your program.

Leaks Detects memory leaks within your application. Threads Analyzes thread state transitions within a process, including

running and terminated threads, thread state, and associated back traces.

File Activity Monitors an application's interaction with the file system.

The type of instrument that we want to use for this example is the System Trace Instrument. Select the System Trace option, then click on the Profile button to proceed to load the Instruments Trace Documentwindow,andstartprofilingourRouteTracker application.

Your application will then be analyzed, and each system call and thread that hasbeenmadetomemorywillbeprofiled.ThesealsoincludeVirtual Memory (VM) operations.

Page 7: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 401 ]

After a number of seconds have passed, your trace information is displayed, and this will contain information relating to the thread and system calls, and their duration that your application is currently making. Other information, such as VM faults, is also recorded.

YoucanchoosetostoptheapplicationfromprofilingbyclickingontheRecord button, since the Instruments application has already done its full analysis.

VM faultsVM is an auxiliary storage that is located on a computer's hard disk that the operating system uses when the Random Access Memory (RAM) is full, and is used for all normal computer applications. Many computers do not have their virtual memory set properly, and, as a result, they are not achieving maximum performance, resulting in a system fault.

Page 8: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 402 ]

ThefollowingscreenshotshowstheinstrumentsapplicationprofilingourRouteTracker, using a number of different types of instruments to monitor the system behavior:

The following information in the table outlines each feature of the instruments application, and provides a description about what each part covers:

Instruments feature DescriptionInstruments pane This section lists all of the instruments, which have been added

for those that you want to profile against. New instruments can be added by selecting and then dragging each one from the instruments library into this pane. Items within this pane can also be deleted.

Track pane This section displays a graphical summary of the data returned by the current instruments. Each instrument has its own track, which provides a chart of the data that is collected by that instrument. The information within this pane is read-only.

Page 9: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 403 ]

Instruments feature DescriptionDetail pane This section shows the details of the data collected by each of

the instruments. It displays the set of events gathered and used to create the graphical view in the track pane. Depending on the type of instrument, information that is represented within this pane can be customized to represent the data differently.

Extended detail pane This section shows you detailed information about the item that is currently selected in the Detail pane. This pane displays the complete stack trace, timestamp, and other instrument-specific data gathered for the given event.

Navigation bar This shows you where you are, and the steps you took to get there. It includes two menus—the active instrument menu and the detail view menu. You can click on the entries within the navigation bar to select the active instrument, and the level and type of information in the detail view.

The instrument's trace document toolbar allows you to add and control instruments, openview,andconfigurethetrackpane.

The following table provides an explanation for each of the different controls on the toolbar:

Toolbar item DescriptionPause/Resume button Pauses the gathering of trace data during a recording. Selecting

this option does not actually stop the recording; it just simply stops the instruments from gathering data while a recording is in progress. When the Pause button has been pressed, in the track pane, it will show a gap in the trace data to highlight this.

Record/Stop button Starts or stops the recording process. You use this button to begin gathering trace data for your application.

Loop button Enables you to set whether the recorder should loop during playback, to repeat the recorded steps continuously. This can be useful, if you want to gather multiple runs for a given set of steps.

Target menu Selects the trace target for the document. This is the process for which data is gathered.

Page 10: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 404 ]

Toolbar item DescriptionInspection Range control

This enables you to select a time range in the track pane. When this has been set, the instruments display only the data collected within the specified time period. Using the buttons with this control enables you to set the start and end points of the inspection range, and to clear the current range.

Time/Run control Shows the time elapsed by the current document trace. If the trace document contains multiple data runs associated with it, you can use the arrow controls to choose which run data you want to display in the track pane.

View control Hides or shows the Instruments pane, Detail pane, and Extended View pane. This control makes it easier to only focus on the area in which you are interested in.

Library button Hides or shows the instrument library window.Search field This option filters information within the Detail pane, based on

a search term that you enter.

The Instruments application comes part of the Xcode 4 Tools installation, and can be found located within the <Root>/Developer/Applications folder, where <Root> is the installation folder where Xcode 4 is installed on your system.

If you are interested in reading more about Instruments, you can refer to the Instruments User Guide documentation, at the following URL: http://developer.apple.com/library/ios/#documentation/DeveloperTools/Conceptual/InstrumentsUserGuide/Introduction/Introduction.html.

Distributing your applicationYou have finallybuiltyourapplicationandhavetestedittoensurethatitisfreefromerrors, and you are ready to package up your application and upload it to the Apple App Store for others to download and enjoy.

In this section, we will be taking a look at how to go about signing up to the iOS Developer Program, how to go about setting up an iOS Development team, as well as learning how to go about creating and assigning roles to users, and which user roles are allowed to log into the iOS Developer Portal to manage users, view sales ortrends,paymentsandfinancialreports,orusersthathavetheabilitytoaddnewdevices in order to test apps on each of the iOS devices.

Page 11: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 405 ]

The iOS Developer ProgramThe iOS Developer Program is a fantastic program that provides you with a means of sharing your applications with the rest of the iOS community.

Before you can test, submit, or give your applications to your friends, so that they can do some testing of your application and provide you with some constructive feedback, you must sign up with the iOS Developer Program.

To sign up, you will need to go to https://developer.apple.com/programs/ios/, and then click on the Enroll Now button to proceed.

For most developers wanting to release their applications to the App Store, they can simply sign up for the Standard program, which costs US$99 per year or US$299 for Enterprise users. Prices vary depending on which path you want to take—either register as an Individual/Company or an Enterprise Developer.

If you are interested in learning more about the differences between the StandardandEnterpriseprograms,youcanfindoutmoreinformationby referring to the following URL: https://developer.apple.com/programs/start/ios/.

When you become a member, you will have access to numerous resources to help you get started. The following is a list of some of the things that you will be able to access upon becoming a member:

• Helpful getting started guides to help you get up and running• Helpful tips, which show you how to submit your apps to the App Store• Access to programming guides for various areas of iOS development

Page 12: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 406 ]

• Access to sample code—TableViews, CoreData, OpenGL ES, and so on• Ability to download current releases of the software• Preview/beta releases of the iOS and iOS SDK• Access to the Apple developer forums• Access to Developer videos on iOS development and World Wide Developer

Conference (WWDC)

Setting up your iOS development teamBefore you can submit your application to the Apple App Store for approval, you will need to set up your iOS development team. This enables you or the people within your organization to log in to the iOS Developer portal website to test apps on the iOS devices they are being deployed to, add additional iOS devices to the account to be used for testing, and so on.

In order to set up your team for iOS development, follow these steps:

1. Log in to the iOS Developer Portal website. 2. Click on the Member Center link that is located right at the top. 3. Sign in to your account using your Apple ID and password.

Page 13: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 407 ]

4. This will then display the Developer Program Resources page, as shown in the following screenshot:

Page 14: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 408 ]

5. Next, click on the iTunes Connect button, as highlighted in the preceding screenshot. This will display the iTunes Connect page, where you have the ability to check on various things, such as Sales and Trends as well as Manage your In App Purchases:

6. Click on the Manage Users button to add yourself or the people within your organization, who will be able to log in to the iOS Developer Program portal, test apps on iOS devices, add iOS devices to the account for testing, and so on.

Page 15: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 409 ]

7. Select the iTunes Connect User option as highlighted in the preceding screenshot. This will bring up the Add New User option pane from where you can add a new user, as highlighted in the following screenshot:

The list in the preceding screenshot shows a list of any existing users, which you have set up previously, along with their details and roles that they have been set up with and have access to.

8. Next, click on the Add New User button.

9. Fill in the Personal Details page for the person that you will be adding to your development team, and click the Continue button.

Page 16: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 410 ]

10. Next, we will need to assign which roles the user will take on.

11. Choose from one of the four options, and click on the Continue button to proceed to the finalstep in the wizard, where we will be assigning the relevantnotificationtypesandterritoriesthatwillbeassignedtotheuser.

Page 17: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 411 ]

12. Onceyouhavefinishedspecifyingthedifferenttypesofnotificationmethodsfor each territory, click on the Save Changes button. The new user account will thenbecreated,andaconfirmatione-mailwillbesenttotheuser'saccount for them to activate their account.

Page 18: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 412 ]

Thefollowingtableexplainseachofthedifferenttypesofnotificationsthatareshown in the preceding screenshot:

Notification DescriptionApp Status Provides e-mail alerts with app status updates.Contract Provides e-mail alerts with contract status updates (for example,

contract expiration warnings) or if iTunes needs more contract information.

Financial Report Provides e-mail alerts when finance reports are available for download on iTunes Connect.

Payment Provides e-mail alerts when payment(s) to your bank are returned.

Getting an iOS development certificateThefirststepsthatare required before we can start to proceed to generate our iOS developmentcertificateandregistertheprovisioningprofilesthatwillbeusedforboth development and distribution, will be to generate a Certificate Requestfile. Thiscertificatewillenableyoutorequestthedevelopmentcertificatethatwillbeused for code signing your application.

In this section, we will be taking a look into the steps involved in generating an iOS developmentcertificate.Thiscertificateisencryptedandservesthepurposeasyourdigitalidentification,andyoumustsignyourappusingthiscertificatebeforeyoucan run and test any applications that you develop on your iOS device.

InordertogenerateacertificaterequestforiOSdevelopment,youmustfirstgenerate a Certificate Signing Request (CSR) using the pre-installed Mac OS X Keychain Access application by following these steps:

1. To begin, launch the Keychain Access application located within your /Applications/Utilities folder.

2. Next, from Keychain Access | Certificate Assistant, choose the Request a Certificate From a Certificate Authority… option:

Page 19: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 413 ]

3. Next,weneedtoprovidesomeinformationbeforethecertificatecanbe generated. Enter the required information as shown in the following screenshot, ensuring that you have selected the Saved to disk and the Let me specify key pair information options:

Page 20: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 414 ]

4. Oncealltheinformationhasbeenfilledout,clickontheContinue button. You will beaskedtospecifyanameforthecertificate;acceptthedefaultsuggested name and click on the Save button:

5. Atthispoint,thecertificateisbeingcreatedatthelocationspecified. You will be asked to specify the Key Size and Algorithm to use.

6. Accept the default bits of 2048 bits and RSA Algorithm.7. Click on the Continue button. 8. Click on Donewhenthefinalscreenappears.

Page 21: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 415 ]

In our next section, we will be taking a look at how to obtain a development certificatethatwillenableustocode-signourapplications,sothatwecanthendeploy this to our iOS device.

Getting the development certificateOnceacertificaterequest has been generated, you will need to use it to request what is called A Development Certificate fromApple.Thisdevelopmentcertificatewillbe used for code signing your applications, in order to deploy your applications onto the real device.

To generate a development request, follow these steps:

1. Log in to the iOS Developer portal at https://developer.apple.com/devcenter/ios/index.action.

Page 22: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 416 ]

2. Click on iOS Provisioning Portal, located on the right-hand side of the page.

3. Click on the Certificates tab, located on the left-hand side of the panel.4. Next, click on the Development tab.

5. Click on the Request Certificate button.6. Click on the Choose File button.7. Next,selectthecertificaterequestfilethatyoucreatedinthe

previous section. 8. Click on the Submit button once you are done.

At this point, youshouldseethatthecertificatewouldbeshowingaPending issuance status. This is shown in the following screenshot:

Page 23: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 417 ]

Afterafewseconds,thepagewillrefreshandthecertificatewillbereadyand you will be able to download it. Once it is downloaded, double-click on thefiletoinstallitwithintheKeychain Access application, as shown in the following screenshot:

In our next section, we will be taking a look at how to go about registering the iOS devices, required for development and testing.

Page 24: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 418 ]

Registering devices for testingBefore you can start testing your iOS applications on your devices for distribution and testing, you will need to register the devices to support your mobile provisioningprofile.Todothis,youwillneedtheUnique Device Identifier (UDID), or a Universally Unique Identifier (UUID) for each of those devices.

Onceyouhaveobtainedthedeviceidentifiers,youwillneedtoobtaineachoftheusers' devices in the same way you obtained your own. To register each device, follow these simple steps:

1. Open the Organizer window, by selecting Window | Organizer.2. Next, copy the Identifierfieldasshownbytherectangleinthefollowing

screenshot, and save it using your favorite text editor.

3. Log back in to the Apple iOS Developer Center page.4. Click on the iOS Provisioning Portal link on the right-hand side of the page.

Page 25: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 419 ]

5. Next, from the iOS Provisioning Portal page, click on the Devices tab.6. Click on the Manage tab, and then click on the Add Devices button.

7. Our next step is to provide a meaningful name for each of the devices that will be used for testing.

8. Provide a value for Device Name and UDID for Device ID, then click on the Submit button to save your changes.

Clicking on the + button will allow you to add additional devices at once. Upon clicking on the Submit button, you will have successfully registered each of the devices you provided. You will need to go through the same process if you intend to deploy to additional devices.

In the next section, we will be taking a look at how to go about creating the applicationIDsanddevelopmentprovisioningprofiles,sothatwecanusethese to deploy applications to test on our iOS devices.

Page 26: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 420 ]

Creating the application App IDEach iOS application that you create must have a unique application ID that identifiesitself.TheAppIDispartoftheprovisioningprofile,andidentifies an app or a suite of related applications.

It is used when your applications communicate with the iOS hardware accessories, the ApplePushNotificationservice,andwhensharingdatabetweenyourapplications.

In the following steps, we will take a look at how to create an application ID.

1. Log back in to the Apple iOS Developer Center page, and click on the iOS Provisioning Portal link on the right-hand side of the page.

2. Next, click on the App IDs menu located at the left-hand side of the page, then click on the New App ID button:

3. Next, provide a description that will be used to identify RouteTracker, as this is the App ID you will be using later.

4. Click on Use Team ID for Bundle Seed ID (App ID Prefix), ensuring that you provide a suitable name for your Bundle Identifier (App ID Suffix).

Page 27: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 421 ]

The Use Team ID option may not always be visible, as this is dependent on whether you set yourself up as an individual or company.

5. Finally, click on the Submit button.

In the following screenshot, you should now see the newly created App ID that you created in the previous step, together with those you may have previously created:

Page 28: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 422 ]

Creating a provisioning profileIn this section, we will look at how we go about creating aprovisioningprofile,sothatyourapplicationcanbeinstalledontoarealiOSdevice.Creatingprovisioningprofilesgives you the ability to assign team members, who are authorized to install and test an application on their iOS devices. When it is installed, it contains the iOS development certificatesforeachteammember,aswellastheUDIDandtheAppID.

Inordertocreateaprovisioningprofile,followthesesimplesteps

1. In the iOS Provisioning Portal, click on the Provisioning tab, then click on the New Profile button:

2. Once the New Profilebuttonhasbeenclicked,theprovisioningprofilescreenappears, which is shown in the preceding screenshot.

3. Next, enter in Development_Profile as the value for Profile Name, ensuringthatyouselectallthecertificatesthatyouwouldliketoassociatewith this provisioning.

4. Select RouteTracker as the value for App ID.5. Finally, check all the devices that you would like to provision.6. Click on the Submitbuttononcefinished:

Page 29: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 423 ]

You can choose to register additional devices using the iOS Provisioning Portal by clicking on the Devices tab, and then follow the steps outlined in the section Registering devices for testing located within this document.

Atthispoint,theprovisioningprofilewillbeshownwithapendingapproval status. After a few seconds, you should see that the status changes from Pending to Active. If this does not happen, you may need to refresh your browser. At this point, you will be able to download your mobile provisioningfile.

Page 30: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 424 ]

7. Click on the Download button to download your Provisioning Profile. You will notice thatwhenyoudownloadthemobileprovisioningfile,thefilewillbe named Development_Profile.mobileprovision. In the next section, we will look at how to deploy an application to an iOS device using thiscertificate.

Using the provisioning profile to install the App on an iOS deviceNow that we have generated our developmentcertificateandhavecreatedourprovisioningprofiles,thefinalthingthatweneedtodoismodifyoneofourexistingexamples that we created in a previous chapter, so that it can be deployed onto an iOS device.

1. Launch Xcode from the /Xcode4/Applications folder.2. Choose File | Open, or press Command + O.3. Select the RouteTracker.xcodeprojfile.4. Click on the Open button to continue and have the application opened into

the Xcode Workspace environment.5. Next, open the Organizer window by selecting Window | Organizer or by

pressing Shift + Command + 2.

This process will enable us to add the Mobile Provisioning profile that we created in the previous sections to our project.

Page 31: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 425 ]

6. Then, click on the Import button. 7. Select the Development_Profile.mobileprovisionfile.8. Next, select the RouteTracker project from Project Navigator.9. Then, from the Build Settings tab, move to the Code Signing section.10. Select Any iOS SDK,andchooseyourcertificatefromthedrop-downlist.

Your certificate will be shown in bold, with your provisioning profile in gray. If you don't import a valid provisioning certificate, you wont be able to deploy or upload your iOS applications to the Apple App Store.

11. Next, from the Project Navigator window, click on your project, click on the Targets section, and then the Summary page.

Page 32: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 426 ]

12. Scroll down till you get to the Entitlements section, and check the Enable Entitlementscheckbox.ThiswilladdafilecalledRouteTracker.entitlements to your project.

13. Build and run your application to see if all works well. You will be asked to grant accesstothecertificate.ClickonAlways Allow.

Whenever you add entitlements to your project, you need to remember that they are directly bound to your application's provisioning profile.

Archiving and submitting apps using Xcode 4Before archivingyourapplication,weneedtoensurethatthetargetapplicationfileisself-contained. What this means is that if the target applicationfilereliesonanystaticlibraries, it ensures that those libraries are a part of the application binary, by setting Validate Built Product | Release to Yes within the Build Settings section of the target that builds and archives the application.

Page 33: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 427 ]

Our next step is to make sure the Archive action of the scheme has the appropriate destination set for the type of application to be archived.

1. Choose Product | Edit Scheme… in the Product menu, or alternatively press Command + <.

2. Next, ensure that Destination has been set to use iOS Device, and Build Configuration has been set to use the Release scheme.

Before submitting an application to the App Store, or sharing it with others, you create an application archive that will enable you to share your App (.IPA) with other developers and testers, or distribute it to users.

Page 34: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 428 ]

3. Select Product | Archive from the Xcode menu, and it will begin to create the application archive. Eventually, the archive's organizer window will be displayed, as shown in the following screenshot:

4. Click on the Validate… button to have Xcode validate your app. You will need to sign in with your Apple ID in order to proceed.

5. Once youhavesatisfiedthenecessaryvalidationrequirements,clickon the Distribute… button to submit your application to Apple.

In order to have your application considered for inclusion on the Apple App store, you must submit the archive to iTunes Connect. This is to ensure that your application archive passes the essential iTunes Connect validation tests. Xcode can validate this for you before you submit it.

For more information on other ways of distributing your applications check out the provided link made available through the Apple Developer Connection website at http://developer.apple.com/library/ios/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/090-Distribute_Your_App/distribute_app.html.

Page 35: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 429 ]

Testing your applicationBefore submitting your application for approval to the Apple App Store, you need to ensure that it works properly and is free from problems. The iOS simulator is a good place to start, and although not everything can be tested within the simulator, it proves a good starting point.

Whilst your application may run perfectly within the simulator, problems may still exist when it has been deployed to the iOS device; it is always best to deploy it to a real iOS device running the latest versions of iOS. You can also make use of the Instruments application to ensure that no memory leaks exist within your application and avoid having your app crash on the users' devices. If your app crashes, it could also prevent your application from being successfully approved and being displayed on the App Store by Apple.

Preparing your App for submission through iTunes ConnectWhen you have tested your application to ensure that it all works and is free from problems and you have set up all of your accounts, you will want to start uploading your application to the App Store. Please bear in mind that only a release version of your application can be uploaded.

1. Log in to iTunes Connect, then click on the Manage Your Applications button.

Page 36: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 430 ]

2. Next, click on the Add New App link to begin adding your app to the App Store.

3. Next, we need to enter the application details for the application we are uploading. Enter the application details.

4. Click on the Continue button to proceed with the next step. The SKU Numberisauniqueidentifierthatyoucreateforyourapp:

5. In the next step, we specify values for the Availability Date and Price Tier for when the application should be made available for download:

Page 37: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 431 ]

There are up to 87+ pricing tiers to choose from, including an option for selling your application for free. On clicking on the Continue button, you will be directed to the Metadatascreen,whereyouarerequiredtofillintheinformationpertainingtoyourapplication.Thefieldsinthatscreenalongwith their description are listed in the following table:

Screen field DescriptionVersion Number This can be anything that you like. It is preferable to

start at 1.0.Description This is the application description that can contain up

to 4,000 characters.Primary Category These contain up to 20 different categories to choose

from, including Games, Entertainment, Business, Books, and so on.

Secondary Category (optional) You can choose from Secondary Category. Keywords These help return results faster when a customer is

searching for an application within iTunes.Copyright The name of the person or entity that owns the

exclusive rights to the app, preceded by the year the rights were obtained (for example, 2012 GENIESOFT STUDIOS).

Contact Email Address An e-mail address where users can contact you, if there are problems with your app.

Support URL A URL that provides support for the app you are adding. This will be visible to customers on the App Store.

App URL (optional) A URL with information about the app you are adding. If provided, this will be visible to customers on the App Store.

Review Notes (optional) Additional information about your app and/or your in-app purchases. Review Notes cannot be longer than 4000 bytes.

Page 38: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 432 ]

When Apple released their iOS 3.0 release, they included a rating scheme that allowed parents to control which applications their children could download. This is a compulsory area of the application distribution process, and must be completed before you can submit your application.

The age limit will change depending on how you go about rating your application. Ensure that you rate this correctly as Apple uses this information during their internal process and reviews how you score your application.

Ways in which you can avoid your app being rejectedAs with any application that you develop, there are many reasons why Apple may reject your application, and this can be as simple as the application crashing or not conforming to the iOS Human Interface Guidelines. The following list outlines the possibilities to watch out for to avoid your application being rejected:

• Application does not run on the latest version of iOS.• Application fails to comply with the guidelines as outlined in the iOS Human

Interface Guidelines.

Page 39: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Appendix

[ 433 ]

• Has a similarity to features found in native iOS applications.• Functionality does not work or perform as outlined.• Application crashes on the iOS device.• Differences between your application icons—both large and small icons are

shown differently.• Failure to informtheuserthroughnotificationmessages,suchasthe

connection to the network is unavailable, or if an error has occurred.• Collection of personal user data without receiving their permission.• The use of Apple's private APIs (such as the built-in text-to-speech

functionality) is strictly prohibited. If Apple determines that your application makes use of such functionality, then it is going to get rejected immediately.

For more information about learning the different ways in which Apple can reject your application, you can check out the following link provided: http://developer.apple.com/appstore/resources/approval/guidelines.html.

Pricing your applications accordinglyHow much you should charge for your application is a tough question amongst developers and companies selling their applications on the App Store. One of the tactics that I have found many developers seem to adopt is to start selling their application at $6.99 and then, shortly after release, they temporarily drop the price by a couple of dollars, or sometimes offer 50 to 80 percent off the price for a limited time.

Byreducingtheprice,thiswillcreateasurefiresale,encouragingpeopletorushinand purchase before the limited time expires, which can also increase the number of sales for your application within the iTunes App Store, hence getting it into the top ten, or even to number one.

Methods to market and promote your applicationCongratulations, you have successfully submitted and installed your application on the Apple App Store, and you are really excited to tell the world about your latest creation. Although you can make a lot of money from selling your applications, you must be willing to put in a bit of effort to promote your application.

Page 40: Packaging and Distributing Your Applications · The iOS Human Interface Guidelines Whenever you start to begin creating iOS applications, it is important to keep in mind and follow

Packaging and Distributing Your Applications

[ 434 ]

In order to sell any piece of software, using the traditional ways is always the most effective. Some of the ways are explained as follows:

• Using Apple's iTunes Connect to monitor and manage sales• Makinguseofwebsites,brochures,andflyers• Networking during social gatherings• Advertising in computer magazines, such as Mac User, or iPhone User,

or websites• Updating your application and changing its price often to increase sales• Creating and making use of application promotional codes to give to

your testers

Using one or more of these methods can help you gain an interest in your application and drive up the sales of your application.

SummaryIn this appendix, we focused on the Xcode Instruments application and how we can use this brilliant tool to ensure that our application runs smoothly; in particular, the Systems Trace for iOS Instrument to help track-down system calls, memory, and threads that may be affecting application performance on your iOS applications.

We looked at how to go about signing up to the iOS development program, how to createprovisioningprofiles,applicationIDs,andhowtoregisterdevicesrequired for testing, as well as the steps required to submit our application to the Apple App Store.

Tofinishup,welookedatwhatarethebestwaystogoaboutpricingourapplications, and the ways in which we can avoid our applications from being rejected by Apple, by following the Apple iOS Human Interface Guidelines. We have now come to the end of the book.

I hope you have enjoyed reading it as much as I did writing it. This is certainly not the end of the road for you. There is a lot of stuff to explore in the world of Xcode and iOS development. Don't worry! You won't be on your own. There are many developers out there (http://developer.apple.com/devforums/), who are more than willing to help you in case you get stuck at any point of time.

I hope to see your upcoming iOS applications on the Apple App Store very soon!