Developing for the App StoreContentsAbout the Application Development Process5At a Glance5Developing for Apple’s Platforms Is a Mix of Administrative and Coding Tasks5 Apps Published on the App Store Must Be Approved by Apple5Apps Published on the App Store Must Be Cryptographically Signed6The Majority of Your Coding Time Is Spent in Xcode6Administrative Tasks are Performed with Several Resources6Many Behaviors of an App Are Defined by Data,Not Code7How to Use This Document7Building an App for the App Store8Prepare the Development Team8Configure the Project8Develop the App9Publish the App in the App Store9Preparing the Development Team10Enrolling in an Apple Developer Program10Adding Members to a Team11Understanding Membership Privilege Levels11Organizing the Team in iTunes Connect13Organizing the Development Team14Creating Your Team’s Signing Certificates17An Example:Signing an iOS App During Development17Setting Up a Developer for Code Signing20To Learn More21Creating a Project22Configuring an Xcode Project for an App22Creating Provisioning Profiles for Your App23App Concepts23A Bundle ID Uniquely Identifies an App24App IDs Are Used to Match Apps to Services and Development Teams25Provisioning Profiles Authorize an App to Launch26ContentsDistributing an App Requires a Distribution Profile28To Learn More28Developing an App29Designing an App30Use the Model-View-Controller Pattern31Use Data-Driven Designs32Writing Code33Treat Warnings as Errors33Use the Analyze Action in Xcode to Find Less Obvious Coding Errors34 Implement Unit Tests and User Interface Tests34Polishing and Testing an App35Test on Various Devices35Use the Archive Action to Create Test Versions of an App35Use Instruments to Guide Your Efforts35Ensure That Your App Meets the Approval Guidelines36Creating Great Apps36Design User-Focused Apps36Develop a Security Model36Ensure Your App Runs Reliably37Tune Your App’s Performance38To Learn More38Best Practices in Coding and App Design39Publishing an App in the App Store40Configuring App Data in iTunes Connect40Submitting the App for Approval41Shipping an App41Responding to User Issues42To Learn More42Document Revision History44Glossary45Figures and TablesBuilding an App for the App Store8Figure1-1Development process overview8Preparing the Development Team10Figure2-1Steps to create a development team10Figure2-2An individual is the team agent15Figure2-3A small development team15Figure2-4A large development team16Figure2-5Overview of the iOS development provisioning process18Figure2-6The process for approving a device and getting a signing certificate20 Table2-1Team roles12Table2-2Privileges assigned to each membership level12Table2-3iTunes Connect roles and responsibilities13Table2-4Abbreviated list of iTunes Connect modules,including availability by role14Creating a Project22Figure3-1Starting a new project22Figure3-2Common uses for an app’s bundle ID24Figure3-3Explicit app ID25Figure3-4Wildcard app IDs26Figure3-5Examples of wildcard matching26Figure3-6Overview of the development provisioning process27Developing an App29Figure4-1The development process29Figure4-2The development process is an iterative process29Figure4-3Distribution between development tasks varies over time30Figure4-4Model-View-Controller pattern31There has never been a better time to create apps for iOS and OS X.Apple provides tools that make development easy and straightforward.This document presents a high-level view of the stages in developing an app,from creating a team to responding to feedback fromusers.Develop Test DistributeAt a GlanceThis document walks you through the process of developing apps for the App Store.By the time you finish reading this document,you should be ready to organize your development team and devise a plan to design,code,and publish an app on the App Store.Developing for Apple’s Platforms Is a Mix of Administrative and Coding Tasks Most of the time spent developing your app is spent on coding tasks,but throughout the development process,there are also a number of administrative tasks you must perform.This mix of tasks can be handled by a single developer,or the work can be divided between different people on a development team.Most administrative tasks appear at the start and the end of a development project.For example,when you develop your first app,one person must sign an agreement with Apple to become an Apple developer.This person,known as the team agent ,bears the legal responsibility for the team,adds people to the team and defines each person’s responsibilities and privileges.Chapters “Building an App for the App Store” (page 8)Apps Published on the App Store Must Be Approved by AppleThe App Store is a curated store and restricts what apps may be sold on the App Store.Apple takes these precautions to provide the best experience possible for our users.For example,apps that are sold on the App Store must not crash or exhibit other major bugs.A major part of the publishing process is to submit your app to Apple for approval.About the Application Development ProcessAt a GlanceRelevant Chapters “Publishing an App in the App Store” (page 40)Apps Published on the App Store Must Be Cryptographically SignedCode signing is used to provide a layer of security to users,your development team,and Apple.Signing an app makes it resistant to malicious tampering;if an attacker modifies the app,it can no longer be executed because the code signing has been broken.Code signing also provides a clear chain of responsibility if malicious code is included in a signed app.Although both iOS and OS X require code signing to publish an app on the App Store,iOS takes this security a step further;no apps can execute on an iOS device,even during development, unless they are signed.When you organize a development team,the team agent(or a person that task is delegated to)decides which members of your team are permitted to sign your apps and creates the necessary code signing resources for those developers.Relevant Chapters “Preparing the Development Team” (page 10),“Creating a Project” (page 22)The Majority of Your Coding Time Is Spent in XcodeXcode integrates coding,debugging,and user interface design in a single development environment.You use Xcode throughout the development process,even using it when you are ready to submit an app for approval. When you install Xcode,other apps are installed with Xcode that you can use to improve the quality of your apps.For example,the Instruments application provides many tools to record and analyze data about how an app acts while ing the data,you can formulate plans to ensure that your apps run correctly and efficiently.Relevant Chapters “Creating a Project” (page 22),“Developing an App” (page 29)Administrative Tasks are Performed with Several ResourcesWhen you manage a team,you use various resources to perform tasks.Here are the most frequently used resources:●The Member Center website is primarily used by the team agent to invite members to join the developmentteam and to configure their privilege levels.●The iOS Provisioning Portal(or for OS X development,the Developer Certificate Utility app)is used tocreate the code signing resources for your team.A team admin(either the team agent or a member of the team this task has been delegated to)uses these tools to provide the necessary code signing resources to members of your team.How to Use This Document●The iTunes Connect website is used to manage information related to the business side of your appdevelopment,including sales and financial information,information displayed in the App Store for your app,and information stored on Apple’s servers for your apps.As with the Member Center,the team agent decides how much access each person on your team is permitted on iTunes Connect.Relevant Chapters “Preparing the Development Team” (page 10),“Creating a Project” (page 22),“Publishing an App in the App Store” (page 40)Many Behaviors of an App Are Defined by Data,Not CodeIn addition to the code you write,data you provide is used to define how the store displays your app as well as how your app executes.The data can even affect what the operating system displays about your app when it isn’t running.Some data is contained in files stored alongside an executable;this combination of data and files is referred to as an application bundle.Other data is stored on Apple servers—for example,information displayed for your app on the App Store is primarily stored on iTunes Connect.Regardless of where the data is stored,keep in mind that an app is more than a simple executable;it exists in an ecosystem of code,data,and services.Relevant Chapters “Creating a Project” (page 22),“Developing an App” (page 29),“Publishing anApp in the App Store” (page 40)How to Use This DocumentRegardless of the role you play on a development team,you should read this document to get a better understanding of steps the team must follow to develop an app for the App Store.If you are a programmer,some concepts described in this document will make more sense to you if you finish one of the following app tutorials before reading this document:●iOS:Start Developing iOS Apps Today●OS X:Start Developing Mac Apps TodayBuilding an App for the App StoreHere are the steps to create and ship an app for the App Store.Although these steps are presented in a specific, logical order,occasionally the needs of your app or your development team require you to perform these steps in a different order or even backtrack to a step you have already performed.For example,any time you add someone to your team,you have to go back and perform some administration tasks.Figure1-1shows a high-level overview of the development process;each of these steps is primarily an administrative step or a coding step.Administrative steps are usually handled by the team agent or someone the team agent has delegated some authority to.Coding tasks are primarily handled by programmers on the team.Figure1-1Development process overviewThe remainder of this chapter explains each of these ter chapters go into more detail about the steps and the kinds of tasks that must be performed to complete them.Prepare the Development TeamOne person signs up as a team agent and in the process creates a new development team.The team agent can invite other people to join the team and set their access privileges.Finally,the team sets up code signing certificates and other resources necessary for developers on the team to sign apps.Configure the ProjectThe next step is to create a new Xcode project for the app.You choose an Xcode template that most closely corresponds to the kind of app you want to make and customize the initial settings for the app.You also create other items required to sign and publish your app.Building an App for the App StoreDevelop the AppDepending on the design of your app and the services you plan to use in it,you may find yourself performing other kinds of app configuration in this step.Some Apple technologies require a combination of code you write and data you configure to operate properly.For example,Apple Push Notification Service requires you to create special certificates used to authenticate your server to the push notification service.If you know up front that you plan to use push notification in your app,you may also create these push notification certificates during this step.Develop the AppThis step is what most people think of when they talk about developing an app:Designing user interfaces and functionality,implementing those ideas in code,and testing the resulting app to ensure it works correctly. While a lot of this work is programming,this step also includes other important tasks,such as creating data assets used by the app.These assets,including but not limited to icons,sound files,and artwork,are used directly by the app or by the operating system on the app’s behalf.Many assets need to be localized into other languages or locales;an important part of designing your app is planning for the assets you need to create and knowing which assets should be localized.You continue to polish and refine your app until it is ready to ship.Publish the App in the App StorePublishing an app on the App Store requires a few administrative tasks.Your team provides the information displayed for the app by the App Store.You also submit the app to Apple for approval.Once the app is approved, you set the date the app should appear for sale in the App Store.Then,you use Apple’s tools to monitor the sales of the app,customer reviews,and crash reports.These data can help you prepare bug fixes and help you decide on what improvements to make in a major revision to the app.When you have bug fix or a major revision ready to ship,you send it for approval and set a publication date,just as you did for the initial release.Preparing the Development TeamMost people think of a development team as a group of programmers,designers,and artists who work together to develop an app.That explanation is also true when you develop for iOS or OS X,but it isn’t complete.A development team takes on the additional meaning of a group created and managed on the Apple Developer website.Some additional tasks during the development process are performed using this development team you’ve created.If you create a team with yourself as the only member,you take on all of these tasks.If you are part of a larger team,the work and the responsibilities may be divided between the group.Each person on the development team has a unique Apple ID,an account used by the developer programs to authenticate that person.Further,access privileges can be configured separately for each person.This flexibility allows your team to restrict critical tasks,such as publishing the app on the App Store,to a small subset of its participants.This chapter starts by describing the various roles that members of a team may fill.It then provides guidance about how you may want to go about organizing the team.Finally,it describes work the team must do to allow people of the team to sign apps.Figure2-1shows all of the required steps.Figure2-1Steps to create a development teamAdministrativeEnrolling in an Apple Developer ProgramTo start,one person must enroll in either the iOS or OS X developer program;this person becomes the team agent for the team.The team agent may enroll in both programs if your team intends to develop apps for both operating systems.During this step,the team agent signs the legal agreements required to become an Apple developer and prepares the financial paperwork so that the team can be paid for purchases from the App Store.The team agent is special;he or she has unrestricted access to the team and is legally responsible for the team. The team agent also performs most of the tasks to organize the team.If desired,after others have joined the team,the team agent can delegate some of this authority to other members of the team,allowing those others to perform these tasks instead.Important Because the team agent is the person with legal responsibility for the team,the team may not demote the team agent using the tools on the website,nor can the team agent’s privileges be restricted. To change the person acting as the team agent,you must contact Apple directly.The team agent might need to sign updated or new licensing agreements,particularly when the team wants to incorporate specific technologies into an app.For example,an app that uses the iAd service requires your team agent to sign a separate agreement.Adding Members to a TeamAfter the team agent has joined a developer program,he or she adds other people to the team and sets their privileges.If you are the team agent and the sole developer on your team,no additional configuration is needed,because the team agent always has access to all account features.However,you should continue to read this section to understand the kinds of tasks you may need to perform throughout the rest of the development process.To add a new person to the team,the team agent sends an invitation to the person;part of sending an invitation includes setting that person’s privileges on the team.When he or she accepts the invitation,that person is automatically added to the team.Understanding Membership Privilege LevelsA person’s membership level on the team defines the level of access he or she has to the Apple developer webpages and the team information stored there.This privilege level extends to the kinds of tasks that developer is allowed to perform on behalf of the team.For example,only certain members of the team are allowed to publish apps on the App Store.By giving you control over these task privileges,Apple makes it easier for you to maintain good security practices for the team.If the team has joined multiple developer programs,when you configure a person’s privileges,you set a separate privilege level for each program.You can also choose to not give someone access to a program.Table2-1lists the roles a team participant can play and provides a basic description of each.Each level of access includes all the capabilities of the levels below it.Table 2-1Team roles DescriptionRole A team agent is legally responsible for the team and acts as the primary contact withApple.The team agent can change the access level of any other member of the team.Team agent A team admin can set the privilege levels of other participants,although a teamadmin cannot demote the team agent.Team admins manage all assets used to signyour apps,either during development or when your team is ready to distribute anapp.Team admins are the only people on a team that can sign apps for distributionon nondevelopment devices.Team admins also approve signing certificate requestsmade by team members.Team admin A team member gains access to prerelease content delivered by Apple on thatprogram’s portal.A team member can also sign apps during development,and butonly after he or she makes a request for a development signing certificate and hasthat request approved by a team admin.Team memberTable 2-2drills deeper into this list of privileges granted to members of your team.Although this document hasn’t explained all these privileges,most will be clear to you by the time you finish reading it.Table 2-2Privileges assigned to each membership level TeammemberTeam admin Team agent Privilege Legal responsibility for the teamPrimary contact with AppleInvite team admins and team membersApprove a request for a development signingcertificateAdd devices for development and user testingCreate app IDsRequest a distribution signing certificate from AppleCreate development and distribution provisioningprofilesTeammemberTeam admin Team agent Privilege Enable app IDs to use Apple Push Notification orIn-App PurchaseCreate SSL certificates for the Apple Push NotificationServiceRequest a development signing certificateDownload development provisioning profilesView prerelease website contentOrganizing the Team in iTunes ConnectThe privileges set in the previous section primarily pertain to the development process:They define who is allowed to sign apps,who is allowed to create signing certificates,and so on.However,the team agent also manages access privileges to the iTunes Connect website.For example,changing the price of an app is a task you likely want to limit to a small number of people on your team.Access to the iTunes Connect website is configured separately and is designed to be more fine-grained than the access you set in Member Center.On iTunes Connect,each person on the team can be assigned one or more roles;each role has different privileges.Table 2-3describes the roles at a high level.Table 2-3iTunes Connect roles and responsibilities ResponsibilitiesRole The legal role is automatically assigned to the team agent,and only the team agent ispermitted to have this access.The legal role allows the team agent to sign legal contractsand other agreements.Legal The admin role grants access to all tasks in iTunes Connect except for those assigned tothe legal role.A team agent is always assigned the admin role,and this access cannot berevoked without changing which person on the team acts as the team agent.An admincan assign iTunes Connect roles to other people on the team.Admin The finance role grants access to financial reports and sales information.The finance rolealso authorizes the person to view contract,tax,and banking information.Finance The sales role grants access only to sales data.SalesOrganizing the Team in iTunes ConnectResponsibilitiesRoleTechnicalThe technical role grants the ability to edit the app information stored in iTunes Connectand to create test accounts needed to test In-App Purchase support in an app.Table2-4lists the most common modules you need to access in iTunes Connect,along with the roles that are allowed to access each module.The legal role is not shown,because only the team agent has those rights.All participants have the ability to edit their own personal details stored in their accounts in iTunes Connect.Table2-4Abbreviated list of iTunes Connect modules,including availability by roleAdminResponsibilityFinanceTechnicalSalesManage UsersManage Your ApplicationsManage Test UsersSales and TrendsContracts,Tax,and BankingPayments and Financial ReportsOrganizing the Development TeamNow that you understand the roles people can assume in Member Center and iTunes Connect,you should consider how you want to organize the anizing the team requires more than setting privileges described above.The size of the team affects how you organize it and its assets.The smallest team is a single person—you.You act as the team agent and have full privileges to perform any task.The disadvantage of a one-person team is that you have to do all the work.You need to set up the assets needed to sign and publish an app,configure all the information in iTunes Connect,develop an app,and market it.Figure2-2An individual is the team agentAgentAdminMembersA more common configuration is a small developer team.On a small team,the team agent is also a programmer, but defers some of the administration overhead to another person on the team.The team agent handles all of the financial and sales operations for the team,while the team admin ensures that the developers on the team have what they need to get the job done.Figure2-3A small development teamSource code serverAgentAdminMembersIf your team is large,you can divide the tasks further.Some people on the team might not be programmers,including the team admin.The sales and financial roles might be filled by people with a business background.You might even have in-house testers who are not also programmers.The task of creating and shipping apps could be delegated to one or more dedicated team admins.You might even partition the work further and divide the team between iOS and OS X development.Figure 2-4A large developmentteamBuild botAgentAdminsFinanceSalesTestersMembers As the team grows,the need for coordination between the different people on the team increases.In particular,the cost of development errors increases when you have more programmers on the team.For example,if you are the sole member of the team,you can store all your work on a single computer and do all of the work there.Xcode even allows you to create a local source code repository to store your code.But what happens when the team grows in size?When the team grows to a moderate size,you need more infrastructure.You want a separate computer to act as a remote source code repository;members of the team pull down the code from the remote repository to their computers,make changes,and send those changes back to the server.But when multiple developers are syncing code,the chance of an error being checked into the code increases.To minimize problems,you usually want multiple branches of development,including stable branches that hold the code you use to build yourshipping app and experimental or developmental branches used for new development.These strategies require a deeper understanding of the underlying source code repository and require you to define specific policies that describe how code gets integrated between the different branches you maintain.If your team grows very large,checking erroneous code into developmental branches could impair your team’s productivity.By the time you discover an error,it might already have been synced to other people’s computers. After you correct the error,propagating the fixes to everyone on the team still takes time.The frequency of such incidents and the time lost for each incident increase as the size of the team increases;these losses,when aggregated,cripple your team’s effectiveness.To avoid this lost productivity,you should add additional infrastructure for code management.For example,you might adopt a process of continuous integration by creating a dedicated build machine(known as a build bot)that automatically checks out each change and rebuilds your app.By building new changes as they arrive,you discover errors earlier;you might even configure the server to back out such changes before others on the team pull down the offending code.If your project includes unit tests or automated user tests,the build computer can also run those tests to verify that your source code still passes the tests.This process,known as smoke testing,increases the team’s confidence that code stored in the development branches builds and works properly.As the team grows larger,you want to automate tasks that are repeatable,predictable,and costly to perform by hand.By automating common tasks,you reduce the burden on the team and allow it to focus on designing and implementing code.Creating Your Team’s Signing CertificatesApps distributed on the App Store must be cryptographically signed.You may also need to sign the app during development.●On OS X,an app must be signed during development if it uses iCloud or application sandboxing.●On iOS,all apps must be signed during development.Regardless of which platform you are developing for,everyone on the team should understand the code signing process.This section describes the assets that are needed to sign an app and authorize it to run on a device,and then explains how people on the team acquire the assets they need to sign apps.Some of these assets should be created now as you organize your team;the rest are created each time you start a new project.An Example:Signing an iOS App During DevelopmentFigure2-5shows everything that is needed to build and sign an iOS app during development.Signing apps during OS X development or signing to distribute an app on either platform follows similar procedures.For now,focus on this example.While you are developing an iOS app,it can only be installed on iOS devicesspecifically marked for development.To run an app on such a development device,you install a signed version of the app and a development provisioning profile that authorizes the signed app to be launched.Without a profile that authorizes it to launch,iOS prevents the app from launching.Figure 2-5Overview of the iOS development provisioning processBuild and signSigned applicationTeam adminDevelopment deviceCreating development provisioning profiles is described in detail in “Creating a Project” (page 22);for now,understand that a development provisioning profile is a signed file whose contents define the scope of the profile:●The development profile authorizes a specific set of apps to run.●The development profile authorizes a specific list of devices to run those apps.●The development profile authorizes a specific list of development certificates to sign those apps.。