Iphone development

Download Iphone development

Post on 07-May-2015

320 views

Category:

Technology

7 download

Embed Size (px)

DESCRIPTION

IPHONE & MAC DEVELOPMENT APPLICATION DEVELOPMENT FOR THE IPHONE USING APPLE'S OFFICIAL SDK.

TRANSCRIPT

<ul><li>1.Tools Workflow Guide for iOS</li></ul><p>2. ContentsAbout the Tools Workflow for iOS 6 At a Glance 6 Obtain and Manage Essential Development Assets 7 Learn iOS Coding Techniques by Examining Example Projects 7 Configure iCloud-Storage Access in Your App 7 Simulate iOS on Your Mac 7 Run Your App on Your New iOS Device 7 Ensure Your App Keeps Running as Designed 7 Perform Realistic User Testing of Your App 8 Prerequisites 8 See Also 8Configuring Development and Distribution Assets 9 Becoming a Member of a Development Team 9 Setting Up Your Development Devices 10 Provisioning a Device for Development 10 Installing iOS on a Device 13 Capturing Screenshots 14 Setting Up Your Distribution-Only Assets 15 Managing Your Signing and Provisioning Assets 15 Replacing an Expired Certificate 15 Renewing Expiring or Expired Provisioning Profiles 15 Safeguarding and Transferring Your Signing and Provisioning Assets 16Configuring Apps 17 Configuring iCloud Entitlements 17 Specifying the Targeted iOS Version 17 Specifying the Targeted Devices 18 Specifying the Targeted Architecture 19 Compiling and Linking Code Conditionally 20 Compiling Source Code Conditionally for iOS App 20 Linking Frameworks Conditionally for iOS Apps 21 Adding the iTunes Artwork to Your App for User Testing 21 Configuring Your Project for App Store Submission 212012-09-19 | 2012 Apple Inc. All Rights Reserved.2 3. ContentsBuilding and Running Apps 23 Running Sample Apps 23 The Build-and-Run Workflow 25 Specifying the Buildtime Environment 25 Specifying the Runtime Environment 28 Building Your App 29 Running Your App 30 Managing App Data 30 Further Exploration 31Using iOS Simulator 32 Setting the Device and iOS Version 32 Manipulating the Hardware 32 Performing Gestures 33 Installing Apps 34 Uninstalling Apps 34 Resetting Content and Settings 34 Viewing iOS Simulator Console and Crash Logs 35 Simulation Environment File System Location 35 Hardware Simulation Support 35Ensuring High Quality and Optimal Performance 36 Ensuring Your Code Is Correct 36 Fixing Bugs in Your App 36 Debugging Facilities Overview 37 Viewing Console Output and Device Logs 38 Tuning the Performance of Your App 38 The Instruments App 39Distributing Apps 41 Publishing Your App for User Testing 41 Adding User Testing Devices to Your Team 42 Configuring the User Testing Provisioning Profile 43 Sending Your App to Testers 43 Importing Crash Logs from Testers 43 Instructions for App Testers 44 Publishing Your App on the App Store 46 Creating a Distribution Provisioning Profile for Your App 46 Submitting Your App for Publication on the App Store 462012-09-19 | 2012 Apple Inc. All Rights Reserved.3 4. ContentsiOS Development: Troubleshooting 48 Issues 48 Certificate Issues 48 Provisioning Issues 49 Building Issues 50 Debugging Information Issues 52 Fixing Issues 53 Ensure That Your Development Signing Identity Is in Your Keychain 53 Fix the Trust Level of Your Certificates 53 Reset Your Signing and Provisioning Assets on Your Mac and in Your Team 54iOS Development: FAQ 58 Developing a Static Library and Incorporating It in Your App 59 Glossary 61 Document Revision History 632012-09-19 | 2012 Apple Inc. All Rights Reserved.4 5. Figures, Tables, and ListingsConfiguring Development and Distribution Assets 9 Figure 1-1Digital assets required for iOS development 11Configuring Apps 17 Listing 2-1 Listing 2-2Determining whether youre compiling for a simulator 20 Determining whether youre compiling for a device 20Building and Running Apps 23 Figure 3-1 Figure 3-2Project with a Missing SDK issue 26 Code Signing Identity options with a specialized provisioning profile selected 27Using iOS Simulator 32 Table 4-1Performing gestures in iOS Simulator 33Distributing Apps 41 Figure 6-1Items required for sharing apps with testers 422012-09-19 | 2012 Apple Inc. All Rights Reserved.5 6. About the Tools Workflow for iOSTo develop iOS apps, you use Xcode, Apples first-class integrated development environment (IDE). Xcode provides all the tools needed to design your apps user interface and write the code that brings it to life.At a Glance This document describes how to perform the workflows required to develop and publish your iOS apps, including running your app on development devices and sharing it with users for testing before publishing it on the App Store. The content in this document is written for Xcode 4.3 and iOS SDK 5.0.2012-09-19 | 2012 Apple Inc. All Rights Reserved.6 7. About the Tools Workflow for iOS At a GlanceObtain and Manage Essential Development Assets Before you can run iOS apps on your iOS devices, you must obtain essential development assets, including code signing certificates, that authenticate you as an iOS app developer. Chapter: Configuring Development and Distribution Assets (page 9)Learn iOS Coding Techniques by Examining Example Projects Viewing and analyzing iOS sample-code projects is a great way to learn how to use particular technologies and APIs. You can incorporate the code in sample projects in your own projects to get going quickly. Section: Running Sample Apps (page 23)Configure iCloud-Storage Access in Your App To use iCloud storage in your app you need to specify the apps iCloud entitlements. Section: Configuring iCloud Entitlements (page 17)Simulate iOS on Your Mac When youre designing your apps user experience, you can simulate its operation in your Mac using iOS Simulator. With iOS Simulator you can get an idea of how your app will work on a device. Chapter: Using iOS Simulator (page 32)Run Your App on Your New iOS Device After obtaining an iOS device to use in your development efforts, set it up so that you can install and run your app on it. Section: Setting Up Your Development Devices (page 10)Ensure Your App Keeps Running as Designed As you make changes to your app, you might introduce bugs in your code. Prevent your current work from undoing your past efforts by incorporating unit testing in your development strategy.2012-09-19 | 2012 Apple Inc. All Rights Reserved.7 8. About the Tools Workflow for iOS PrerequisitesChapter: Ensuring High Quality and Optimal Performance (page 36)Perform Realistic User Testing of Your App You cannot test your app the same way the users of your app will use it. They have different data and different usage patterns. Before publishing your app on the App Store, put it through real-world testing to find and solve as many problems as possible. Section: Publishing Your App for User Testing (page 41)Prerequisites You should be familiar with basic programming concepts. You should also understand the concepts and technologies described in: Developing for the App StoreiOS App Programming GuideSee Also To learn more about the iOS SDK, visit http://developer.apple.com/devcenter/ios. To learn more about Xcode, visit http://developer.apple.com/xcode. Note: Xcode requires a Mac.If youre interested in developing iOS web applications, visit http://developer.apple.com/devcenter/safari/library.2012-09-19 | 2012 Apple Inc. All Rights Reserved.8 9. Configuring Development and Distribution AssetsAs a registered Apple developer, you have access to iOS developer documentation and can build iOS apps that run in simulators. (To become a registered Apple developer, visit http://developer.apple.com/programs/register.) Being a registered Apple developer, however, doesnt allow you to run apps on iOS devices. To do so you must also be a member of a development team. See Becoming a Member of a Development Team (page 9) for more information. This chapter shows how to configure your Mac and iOS devices for iOS development. The chapter also describes how to safeguard the digital identifications required to install apps on devices for development and distribute them to app testers and App Store customers. Content specifications: This content is written for Xcode 4.3 and iOS SDK 5.0.Becoming a Member of a Development Team To install apps that are under development on iOS devices, you must be part of a development team . A development team associates a legal entity (a person, company, or organization), people (one or more persons involved in developing and distributing the teams apps), and online development resources (the iOS and Mac provisioning portals). The people on the team can then build and run apps on development devices and distribute them to customers. If you are authorized to distribute apps, you can send them to testers to get feedback on real-world performance. As a distributor, you can also publish apps on the App Store. You become a member of a development team in one of two ways: You are invited to join a team by an authorized person.You create your own team by enrolling in the iOS Developer Program. To enroll in the program, visit http://developer.apple.com/programs/ios.2012-09-19 | 2012 Apple Inc. All Rights Reserved.9 10. Configuring Development and Distribution Assets Setting Up Your Development DevicesSetting Up Your Development Devices With iOS Simulator you can start developing iOS apps without using iOS-based devices. Use simulators to familiarize yourself with the API and development workflows used to develop applications. However, you must always test your apps on actual devices before publishing them to ensure that they run as intended and to tune them for performance on actual hardware. Note: If your team duties are only to distribute apps and you dont handle development devices, skip this section and go to Setting Up Your Distribution-Only Assets (page 15).This section shows how to configure your iOS devices for development. It also shows how to take screenshots of your application as it runs.Provisioning a Device for Development To run apps youre developing on a device, you must set up the device for development. This process involves these main tasks, which you do in Xcode: 1.Obtaining a developer certificate that allows you to sign apps.2.Obtaining a provisioning profile that identifies your developer certificate, your device, and the applications you can run on the device.To run apps on a device, you must configure your Mac and your device for iOS development. This section presents an overview of the items you need to develop an iOS application on your Mac and run the application on a device. Note: Configuring an iOS-based device for development does not affect its normal operation.In preparing your device for development, Xcode creates or obtains the following digital assets: Certificate request. A certificate request (also known as a certificate signing request, or CSR) contains personal information used to generate your development certificate . Development certificate. A development certificate identifies you as an app developer. When its stored in your keychain, it includes your private key. In your development teams signing assets and in your provisioning profile , it includes only your public key. When Xcode builds your app for installation on a device, it looks for your developer certificate in your keychain. If it finds the certificate, Xcode signs your app. Otherwise, it reports a build error.2012-09-19 | 2012 Apple Inc. All Rights Reserved.10 11. Configuring Development and Distribution Assets Setting Up Your Development DevicesProvisioning profile. A provisioning profile associates one or more developer certificates and one or more devices with an app ID. To install applications signed with your developer certificate on a device, you must install at least one provisioning profile on the device. This provisioning profile must identify you (through your developer certificate) and your device (by listing its device identifier). If youre part of a multimember iOS development team, other members of your team, if they have appropriately defined provisioning profiles, can run applications that you build on their devices.Figure 1-1 illustrates the relationship between these digital assets. Figure 1-1Digital assets required for iOS development Keychain (login)XcodePortalPrivate keyDevelopment certificate requestDevelopment certificate requestDevelopment certificateDevelopment certificateDevelopment certificate Public key Tester device IDPrivate keyProvisioning profileApp ID Provisioning profile Device identifier Device identifier Device identifier App ID Development certificate Device identifierDevice identifierImportant: To provision a device for development, you must be part of an iOS development team. To learn how become part of a development team, see Becoming a Member of a Development Team (page 9). Before continuing, you must know whether you are registered as the agent, an administrator, or a member of your iOS-development team. To find your access level in the iOS Provisioning Portal: 1.Log in to the portal.2.Click Member Center.3.Click People.2012-09-19 | 2012 Apple Inc. All Rights Reserved.11 12. Configuring Development and Distribution Assets Setting Up Your Development DevicesProvisioning Your Device for Generic Development For Administrators or the Team Agent If you are a team administrator or the team agent, provision your device for generic development. Xcode installs your development certificate in your keychain (if its not there already), and installs the team provisioning profile on your device. For Team Members To provision your device for generic development: 1.Choose Window &gt; Organizer to open the Organizer window.2.Click Devices to display the devices organizer.3.Plug in your device, and select it in the devices list.4.Click Use for Development.5.Copy your device identifier from the identifier text field.6.Send a message containing your device identifier to your team agent requesting that of your device be added to the teams list of devices. Wait until the team agent tells you that the device has been added to the teams devices list before continuing.7.In the devices organizer, select Provisioning Profiles in the Library section, and click Refresh.8.If you dont have a developer certificate, Xcode offers to request one on your behalf: a.Have Xcode request the developer certificate for you.b.Notify the team agent that Xcode requested a developer certificate for you.Wait until the team agent tells you that your developer certificate has been issued before continuing. 9.Ensure that your device is plugged into your Mac, and that its listed in the devices organizer.10. Select Provisioning Profiles in the Library section, and click Refresh.Xcode installs your developer certificate in your keychain (if the certificate is not there already), and installs the team provisioning profile on your device.Provisioning Your Device for Specialized Development If your app requires special iOS-development features (such as iCloud storage, push notifications, in-app purchases, and Game Center), you must provision your device for specialized development. To provision a device for specialized development:2012-09-19 | 2012 Apple Inc. All Rights Reserved.12 13. Configuring Development and Distribution Assets Setting Up Your Development...</p>