Professional Documents
Culture Documents
Contents
Configuring 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 21
Contents
Distributing 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 46
Contents
iOS Development: FAQ 58 Developing a Static Library and Incorporating It in Your App 59 Glossary 61 Document Revision History 63
Configuring Apps 17
Listing 2-1 Listing 2-2 Determining whether youre compiling for a simulator 20 Determining whether youre compiling for a device 20
Distributing Apps 41
Figure 6-1 Items required for sharing apps with testers 42
To 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.
Prerequisites
You should be familiar with basic programming concepts. You should also understand the concepts and technologies described in:
See 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.
As 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.
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.
This section shows how to configure your iOS devices for development. It also shows how to take screenshots of your application as it runs.
Obtaining a developer certificate that allows you to sign apps. 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.
10
Provisioning 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.
Development certificate
Provisioning profile
Device identifier
Important: 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. 2. 3.
11
Choose Window > Organizer to open the Organizer window. Click Devices to display the devices organizer. Plug in your device, and select it in the devices list. Click Use for Development. Copy your device identifier from the identifier text field. 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. 8.
In the devices organizer, select Provisioning Profiles in the Library section, and click Refresh. If you dont have a developer certificate, Xcode offers to request one on your behalf:
a. b.
Have Xcode request the developer certificate for you. 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.
12
1.
If your device is not listed in the teams devices list in the iOS Provisioning Portal, add the device by following the steps in Provisioning Your Device for Generic Development (page 12). Ensure that the portal contains a provisioning profile that identifies the special requirements of your application. If the portal does not have a specialized provisioning profile for the application, the team agent or an administrator needs to create one and add your developer certificate and devices to it before you can continue.
2.
3.
In the devices organizer, select Provisioning Profiles in the Library section, and click Refresh. The specialized provisioning profile should be listed in the profiles list. If the provisioning profile is not listed and you belong to more than one iOS development team in your organization, make sure you enter the credentials for the correct iOS development team after clicking Refresh.
4. 5.
Ensure that your device is plugged into your Mac. From the provisioning profiles list, drag the specialized provisioning profile to your device.
Important: After installing the specialized provisioning profile on your device, ensure that the target that builds your app uses that provisioning profile to sign the app. See Setting Your Code Signing Identity (page 26) for more information.
13
Important: After you upgrade a devices OS, you cannot downgrade it, that is, you cannot install an earlier release of iOS on your device.
Installing public iOS versions: Use iTunes to download the latest public version of iOS and install it on your device.
Installing beta iOS versions: You can download beta versions of Xcode and iOS from the iOS Dev Center from http://developer.apple.com/devcenter/ios. You must be a member of an iOS development team to be able to download beta versions of iOS. During beta periods, you should install beta versions of iOS only on devices you dedicate to having beta versions. You cannot submit applications to the App Store using beta versions of Xcode. After you get a beta version of iOS, install it on your device. After installing the software, select the device in the devices organizer, and click Use for Development.
Capturing Screenshots
Screenshots help to document your application, and you also use them to create your apps launch image, which iOS displays when a user taps your apps icon.
Capturing screenshots in Xcode from your connected device. You can capture screenshots of your app while its connected to your Mac in the devices organizer. After you capture a screenshot, you can make it your applications launch image. To get a PNG file of the screenshot, drag it to the desktop.
Capturing screenshots on your device. You can capture screenshots directly on your device and import them into your Mac using the iPhoto application. To capture a screenshot on your device, press the Lock and Home buttons simultaneously. Your screenshot is saved in the Saved Photos album in the Photos app.
14
Note: Although the launch image includes the status bar as it looked when the screenshot was captured, iOS replaces it with the current status bar when your application launches.
Distribution certificate. A distribution certificate identifies your development team. When its stored in your keychain, it includes the teams private key. In your teams signing assets and in a distribution provisioning profile the distribution certificate includes only the teams public key. Distribution provisioning profile. A distribution provisioning profile includes your teams distribution certificate and an app ID. If the provisioning profile is for user-testing (also known as an ad hoc hoc distribution profile ), it identifies the devices on which testers can run the app identified by the app ID.
If your team doesnt have a distribution profile for the app you want to distribute, create it.
Download the distribution profile for the app you want to distribute.
Next steps: Configuring Your Project for App Store Submission (page 21)
15
Configuring Development and Distribution Assets Managing Your Signing and Provisioning Assets
In the devices organizer, select Provisioning Profiles in the Library section. In the provisioning profiles list, select the provisioning profile you want to renew. Click Renew.
In the Library section in the devices organizer, select Provisioning Profiles. From the provisioning profiles list, drag the updated provisioning profile to your device. Delete the expired or expiring provisioning profile from your device by selecting it and clicking Delete.
16
Configuring Apps
This chapter describes how to configure your apps entitlements. It also explains how to specify your apps targeted iOS release, device family, and architecture. Content specifications: This content is written for Xcode 4.3 and iOS SDK 5.0.
Target the latest iOS version. Targeting the latest version allows you to take advantage of all the features available in the latest version of iOS. However, this approach means a smaller set of users capable of installing your app on their devices because your apps cannot run on iOS versions that are earlier than the target version. Target an earlier iOS version. Targeting an earlier version lets you publish your app to a larger set of users (because your app runs on the target OS version and later versions). However, targeting an earlier version may limit the iOS features your app can use.
To specify the earliest iOS version on which you want your app to run:
17
1. 2. 3. 4.
In the project navigator, select the project. From the target list in the project editor, select the target that builds your app. Click Summary. From the Deployment Target pop-up menu, choose the iOS version you want to target.
When you build your app, your deployment target selection is reflected in the MinimumOSVersion entry in the apps Info.plist file. When you publish your app to the App Store, the store indicates the iOS version on which your app can run based on the value of this property. Note: If the SDK youre using to build the app is more recent than the apps target iOS version (for example, the base SDK is iOS 4.3 and the deployment target is iOS 4.0), Xcode displays build warnings when it detects that your app is using a feature thats not available in the targeted iOS version. You must also ensure that the symbols you use are available in the apps runtime environment. To check for their availability, use the techniques described in SDK Compatibility Guide .
Important: When building for a simulator, the generated binary runs only on the iOS Simulator version thats part of the Xcode toolset version used to build the binary. It doesnt run on earlier or later versions of iOS Simulator.
In the project navigator, select the project. From the target list in the project editor, select the target that builds your app, and click Summary.
18
3.
From the Devices pop-up menu, choose iPhone, iPad, or Universal (to target both families).
For more information on configuring your app for iPhone, iPad, or both device families, see Advanced App Tricks.
Standard. Produces an app binary with a common architecture, compatible with all supported iOS devices. This option generates the smallest app, but it may not be optimized to run at the best possible speed for all devices. Optimized. Produces an app binary optimized for each supported iOS device. However, the build time is longer than when using the Standard option, and the app is also larger because multiple instruction sets are bundled into it.
If you need to build your app so that it contains executable code for a different set of architectures than these predefined values offer, you can choose Other from the Architecture build-setting value list and enter the custom iOS-device architecture names.
19
// Set hello to "Hello, <device or simulator>"! #if TARGET_IPHONE_SIMULATOR NSString *hello = @"Hello, iOS Simulator!"; #else NSString *hello = @"Hello, iOS device!"; #endif
Listing 2-2 shows how to use the TARGET_OS_IPHONE macro in a source file to be shared between Mac OS X and iOS.
Listing 2-2 Determining whether youre compiling for a device
20
Configuring Apps Adding the iTunes Artwork to Your App for User Testing
The TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR macros are defined in the TargetConditionals.h header file.
Open your project in Xcode. In the project navigator, select your project. Choose File > Add Files to <App_Name> . Navigate to the file in your file system, and select it. Select the Copy items into destination groups folder (if needed) option, and click Add.
In your project, duplicate the Release build configuration and name the duplicate AppStore .
21
2.
Set the Code Signing Identity build setting to your teams distribution code signing identity through the
3. 4. 5.
In the target, delete the Validate Build Product build setting specification for the Release build configuration.
Managing Schemes the scheme that builds your app and name the duplicate <App_Name>-AppStore .
In the AppStore scheme, set the build configuration for the Archive action to AppStore.
22
When you want to run your app to test or debug it, you build it using the Xcode build system. If there are no build errors, you can run it in a simulator or on a device. Note: To ensure your app functions correctly on the iOS-based device models you expect the apps users to use, after simulating your apps execution in simulators, you must test it on corresponding devices. To run your app on a device, you must be a member of a development team; see Becoming a Member of a Development Team (page 9) for details. You must also identify to Xcode the devices you intend to use for development, as described in Replacing an Expired Certificate (page 15).
Specify the build-time environment. Specify the destination for which you want the product to be built: a simulator or a device. Build the app. Run the app.
This chapter describes each of the steps required to run your app. Start with Running Sample Apps (page 23) if youre interested in seeing apps that showcase iOS features. Content specifications: This content is written for Xcode 4.3 and iOS SDK 5.0.
23
1.
Choose Window > Organizer to open the Xcode Organizer, and click Documentation to display the documentation organizer. Click the Browse button (the one with the eye icon) in the navigator selector bar of the documentation organizer. Select the library for which you want to view sample code. In the text field in the content area, enter sample code . In the content area, click the name of the project you want to open. In the sample-code project page, click Open Project. Choose a location for the project.
2.
3. 4. 5. 6. 7.
In your web browser, go to http://developer.apple.com/devcenter/ios, and click the iOS Developer Library link. In the list on the left, click Sample Code under the Resource Types group. In the Documents list, click the name of the project you want to open. Click Download Sample Code. An archive containing the project directory is downloaded to your Mac. The archive may be automatically expanded for you. If it isnt, expand the archive by double-clicking it.
2. 3. 4.
5. 6.
Navigate to the sample-code project directory. Double-click the project package, a file with the .xcodeproj suffix. For example, for the HelloWorld project, double-click HelloWorld.xcodeproj. This action opens the project in Xcode. Another way to open the project is to drag the project package to the Xcode icon in the Dock. Troubleshooting: Xcode doesnt launch. Download Xcode and install it on your computer. To learn how, visit iOS Dev Center.
With the sample-code project open in Xcode, follow the instructions in the following sections to build and run the app.
24
25
Note: To ensure minimal reconfiguration of your projects as you adopt new SDK releases, instead of a specific SDK release, set the base SDK for your projects to Latest iOS. This way your project always uses the latest available SDK in the toolset.
Base SDK Missing If your project has its Base SDK setting set to a particular iOS SDK release, when you open that project with a later Xcode toolset distribution in which that SDK release is not available, the Base SDK setting has no valid value. In this case, the issue navigator lists a Missing SDK issue, as shown in Figure 3-1. To fix the Missing SDK issue, set the base SDK for the target to an available SDK release or to Latest iOS.
Figure 3-1 Project with a Missing SDK issue
26
The Code Signing Identity build setting specifies the provisioning profile and code signing identity Xcode uses to sign your binary. Xcode looks for code signing identities in your default keychain.
The possible values for the Code Signing Identity build setting are:
Dont Code Sign. Choose this option to build only for a simulator. Automatic Profile Selector. Choose an option under this selector to select a provisioning profile whose name starts with iPhone Developer or iPhone Distribution. Specific Profile. Choose the code-signing identity under a specific provisioning profile when your app requires special entitlements (see Provisioning Your Device for Specialized Development (page 12)). Expired or otherwise invalid provisioning profiles are dimmed and cannot be used. Figure 3-2 shows a set of options for the Code Signing Identity build setting with a provisioning profile for specialized development selected.
Figure 3-2
27
Project templates are configured to use the automatic selector to set the signing identity. You need to change the value of the Code Signing Identity build setting only when your app uses a specialized provisioning profile. See Replacing an Expired Certificate (page 15) for details. Important: If you need to use different code signing identities that have the same name, you must use a separate Mac OS X user account for each identity.
Xcode Displays the Unknown iOS Detected Dialog When You Plug In a Device (page 52).
28
Note: Each scheme can specify only one app-data archive. If you need to use more than one app-data archive regularly, define a scheme for each archive.
Important: In Run actions, you can specify only app-data archives that that are part of your project. See To copy app data from a development device (page 31) for details. To specify the app data to place in the apps sandbox before the app runs:
1. 2. 3.
From the Scheme toolbar menu, choose the scheme you want to use. Select the Run action. From the Application Data pop-up menu, choose the app-data archive you want to use.
Choose View > Navigators > Log to display the log navigator. In the list on the left, select the build task for which you want to view details. The log viewer in the editor area lists the operations that are part of the build.
If the build completes successfully, you can run your app as described in Running Your App (page 30).
29
Troubleshooting: Xcode Cannot Install Your App on Your Development Device (page 49)
Your Provisioning Profile Is Expired (page 50) The Code Signing Identity Build Setting Doesnt Identity a Valid Code Signing Identity in Your Keychain (page 51) Xcode Doesnt Trust Your Certificate (page 50) Your Keychain Contains Duplicate Code Signing Identities (page 51) The App ID of Your Provisioning Profile Doesnt Match Your Apps Bundle Identifier (page 52)
30
To copy app data from a development device: 1. Plug in the device containing the app whose data you want to copy.
2. Copy the apps data from the device.
After copying the app data to the file system, you can modify it to, for example, make changes that would be tedious to do in the app itself. To access the contents of the app-data archive, Control-click the archive in the Finder and choose Show Package Contents. If you want to use a particular configuration of your apps data when you run the app, add the appropriate app-data archive to your project, and specify that archive in the Run action of the appropriate scheme. See Specifying the App Data (page 28) for more information.
To copy app data to a development device: 1. Plug in the device containing the app whose data you want to replace.
2. Copy the apps data to the device.
To access your apps simulation-environment sandbox, navigate to the directory ~/Library/Application Support/iPhone Simulator/<sdk_version>/Applications in the Finder. Then open each directory in the Applications directory to find your apps binary file. Alongside the binary file are the directories that make up your apps sandbox, including Documents and Library.
Further Exploration
To learn more about using Xcode to build and run apps, see Configure Your Project.
31
You use the iOS Simulator app to run your iOS app on a Mac. By simulating the operation of your app you:
Learn about the Xcode development experience and the iOS development environment before becoming a member of a development team. Find major problems in your app during design and early testing. Test your apps user interface. Measure your apps memory usage before carrying out detailed performance analysis on iOS-based devices.
or iPad user interface in a window on your computer. This app provides several ways to interact with it by using the keyboard and mouse to simulate taps, device rotation, and other user actions. This chapter describes the ways in which you use your computers input devices to simulate the interaction between users and their devices. The chapter also describes how to uninstall apps from a simulator and how to reset the contents of a simulation environment. Content specifications: This content is written for Xcode 4.3 and iOS SDK 5.0.
32
Rotate Left. Rotates the simulator to the left. Rotate Right. Rotates the simulator to the right. Shake Gesture. Shakes the simulator. Home. Takes the simulator to the Home screen. Lock. Locks the simulator. Simulate Memory Warning. Sends the frontmost app low-memory warnings. For information on how to handle low-memory situations, see Observing Low-Memory Warnings in iOS App Programming Guide . Toggle In-Call Status Bar. Toggles the status bar between its normal state and its state when a phone call or FaceTime call is in progress. The status bar is taller in its in-call state than in its normal state. This command shows how your apps user interface looks when the user launches your app during a call. Simulate Hardware Keyboard. Toggles the software keyboard on an iPad simulator. Turn off the software keyboard to simulate using a keyboard dock or wireless keyboard with an iPad device. TV Out. Opens a window simulating the TV out signal of a device.
Performing Gestures
Table 4-1 lists gestures you can perform on a simulator (see iOS Human Interface Guidelines for more about gestures).
Table 4-1 Gesture Performing gestures in iOS Simulator Desktop action
Click. Hold down the mouse button. Double-click. 1. Place the pointer at the place where you want the swipe to start. 2. Hold down the mouse button. 3. Move the pointer in the direction you want to swipe and release the mouse button.
Flick
1. Place the pointer at the start position. 2. Hold down the mouse button. 3. Move the pointer quickly in the direction you want to flick and release the mouse button.
33
Gesture
Desktop action
Drag
1. Place the pointer at the start position. 2. Hold down the mouse button. 3. Move the pointer in the direction you want to drag.
Pinch
1. Place the pointer where you want the pinch to occur. 2. Hold down the Option key. 3. Move the circles that represent finger touches to the start position. 4. Move the center of the pinch target by holding down the Shift key, moving the circles to the desired center position, and releasing the Shift key. 5. Hold down the mouse button, move the circles to the end position, and release the Option key.
Installing Apps
Xcode installs apps in simulation environments automatically when you build your app for a simulator. See Building and Running Apps (page 23) for details. Note: You cannot install apps from the App Store in simulation environments.
Uninstalling Apps
To uninstall apps that you have installed in a simulation environment, use the same method used to uninstall apps from devices:
1.
Place the pointer over the icon of the app you want to uninstall and hold down the mouse button until the icon starts to jiggle and a close button appears. Click the close button. Click the Home button to stop the icon from jiggling.
2. 3.
34
Using iOS Simulator Viewing iOS Simulator Console and Crash Logs
35
This chapter describes practices and facilities that help you ensure that your apps code behaves as intended, that your app uses resources appropriately, and that it performs optimally. Content specifications: This content is written for Xcode 4.3 and iOS SDK 5.0.
36
Ensuring High Quality and Optimal Performance Fixing Bugs in Your App
The debug navigator. This navigator (on the left of the workspace window) shows your apps threads and stack frames, which you use to navigate your running code. Selecting an item in the debug navigator opens its file in the source editor. The source editor. You use the source editor (in the editor area) to debug your code right in your code. It provides most of the debugging features you need. You can:
Set breakpoints View the value of variables by holding the pointer over them Continue execution up to a particular code line Step in to, out of, or over function or method calls
The debug area. The debug area (below the source editor) presents a variables list and a console pane to show your programs console output. You can also issue debugger commands in the console pane. You use the debug bar, at the top of the debug area, to control your programs execution by pausing, continuing, and stepping through code.
37
Ensuring High Quality and Optimal Performance Tuning the Performance of Your App
Important: To debug an app successfully on a device, ensure that the version number of the iOS SDK your project uses is equal to or greater than the version number of the iOS version on your device. Installing the latest public version of Xcode from the App Store or the latest beta version from http://developer.apple.com/devcenter/ios should suffice.
Choose Window > Organizer to open the Organizer window. Click Devices to display the devices organizer. In the section for the device whose logs you want to view, select Device Logs.
The Device Logs pane in the Organizer contains information about app crashes. You may have to unplug your device and plug it in again to refresh the crash list. For more information about crash logs, see Understanding and Analyzing iPhone OS Application Crash Reports.
38
Ensuring High Quality and Optimal Performance Tuning the Performance of Your App
Events involving more than two fingers. Actual accelerometer readings. Although you can access your computers accelerometer (if it has one) through the UIKit framework, its readings differ from the accelerometer readings on a device. This discrepancy stems largely from the difference in the positioning of the screen in relation to the rest of the hardware between computers and iOS-based devices. Rendering by OpenGL ES. OpenGL ES uses renderers on devices that are slightly different from those it uses in a simulator. Therefore, a scene in the simulator and the same scene on a device may not be identical at the pixel level. See Drawing with OpenGL ES in iOS App Programming Guide for details.
Build and run your app on the device as described in Building and Running Apps (page 23). Stop the app. Launch Instruments.
39
Ensuring High Quality and Optimal Performance Tuning the Performance of Your App
The Instruments app is located at <Xcode>/Applications. (<Xcode> refers to the installation location of the Xcode toolset.)
4. 5.
Choose a template, such as Activity Monitor, to create the trace document. From the Target toolbar menu, choose the device containing the app from which you want to collect performance data. Add or remove instruments from the trace document to collect the data you want. From the Target toolbar menu, choose the app to launch (the same app you ran in step 1). Click Record to start collecting data. Use your app, exercising the areas you want to examine.
6. 7. 8. 9.
To learn more about measuring and analyzing app performance, see Instruments User Guide .
40
Distributing Apps
When youre ready to share your app for user testing or for general distribution through the App Store, you need to create an archive of the app using a distribution provisioning profile and send it to app testers or submit it to iTunes Connect. This chapter shows how to perform these tasks. To distribute apps, you must meet the requirements described in Provisioning a Device for Development (page 10). Content specifications: This content is written for Xcode 4.3 and iOS SDK 5.0.
41
Figure 6-1 shows the items involved in publishing apps for user testing.
Figure 6-1 Items required for sharing apps with testers
Tester Tester device ID Team Agent Tester device ID Portal Tester device ID Tester Device
Application IPA
To help users obtain the information you need to add them to your testing group and to show them how to send you crash logs, you can send them the information in Instructions for App Testers (page 44). Requirements for user testing: To publish an app for user testing, the app must have iTunes artwork. See Adding the iTunes Artwork to Your App for User Testing (page 21).
The remainder of this section describes the steps you need to perform to add testers to your team, and shows how to import the crash logs they send you into the Organizer.
Obtain the identifier of the users device. The easiest way to obtain this information is through email. Have your tester follow the instructions for sending their device identifier to you in Sending Your Device Identifier to a Developer (page 44).
42
2.
The app name in the name of the provisioning profile is optional. The app ID can identify a specific app or an app domain.
If you dont have access to the project that generates the app, obtain an iOS App Store Package (IPA) file for your app from the appropriate teammate. Otherwise, generate the IPA file yourself:
a. b. c.
2.
Download the user testing provisioning profile for your app from the iOS Provisioning Portal to your file system. (You dont have to install this profile in Xcode.) Email the user testing provisioning profile and the IPA file to your testers.
3.
43
Important: For Xcode to symbolicate crash logs (to add to the crash log information about the API used), the volume containing your archived apps and their corresponding dSYM files must be indexed by Spotlight.
Launch iTunes. Connect your device to your computer. Select the device in the Devices list. In the Summary pane, click the Serial Number label. It changes to Identifier.
5. 6.
Choose Edit > Copy. Email your device identifier to the developer. Be sure to include your name in the email.
In the Finder, drag the provisioning profile (the file with the .mobileprovision extension) to the iTunes icon in the Dock. Double-click the app archive <App_Name>.ipa. The app appears in the iTunes Applications list.
2.
3.
Sync your device. If the version of iOS on your device is earlier than the test app can run on, you need to update your device with the current version of iOS.
44
In the Finder, open a new window. Choose Go > Go to Folder. Enter ~/Library/Logs/CrashReporter/MobileDevice. Open the folder identified by your devices name. Select the crash logs named after the app youre testing. Choose Finder > Services > Mail > Send File. In the New Message window, enter the developers email address in the To field and <app_name> crash logs from <your_name> (for example, MyTestApp crash logs from Anna Haro) in the Subject field. Choose Message > Send. (Optional) Delete the crash logs you sent, to avoid sending duplicate reports later.
8. 9.
Enter the crash log directory for your operating system in the Windows search field, replacing <user_name> with your Windows user name.
45
2.
Open the folder named after your devices name and send the crash logs for the app youre testing in an email message using the subject-text format <app_name> crash logs from <your_name> (for example, MyTestApp crash logs from Anna Haro) to the apps developer.
App Store <App_Name> Distribution Profile The appropriate app ID for the app being distributed
The app name in the name of the provisioning profile is optional. The app ID can identify a specific app or an app domain.
2. 3.
Download the distribution provisioning profile. Install the distribution provisioning profile in your provisioning profiles library: Drag the <Profile_Name>.mobileprovision file to the Provisioning Profiles list in the Library section of the devices organizer.
46
1.
To learn how to configure the AppStore scheme, see Configuring Your Project for App Store Submission (page 21).
2.
Ensure that an app record for the app exists in iTunes Connect. The information in this record must match the app you want to validate or submit for publication. These are the main matching criteria:
3. 4.
Ensure that the app record status in iTunes Connect is at least Waiting for Upload.
Submit your app for distribution.
Before submitting your app for distribution, you should validate it to ensure that is passes essential iTunes Connect validation tests. Troubleshooting: Unable to find registered user with username <username>: The Unable to find registered user with username <username> dialog indicates that you are not registered in iTunes Connect.
47
This chapter shows how to address issues you might encounter as you develop your app and prepare to submit it for publication on the App Store. Content specifications: This content is written for Xcode 4.3 and iOS SDK 5.0.
Issues
Certificate Issues
Your Development Certificate Is Expired
To renew an expired development certificate:
Request a new development certificate from your team: To learn how, see Replacing an Expired Certificate (page 15).
Restore your certificate and its corresponding private key from a backup of your signing assets. To learn how, see Safeguarding and Transferring Your Signing and Provisioning Assets (page 16).
Reset your code signing assets. To learn how, see Reset Your Signing and Provisioning Assets on Your Mac and in Your Team (page 54).
48
Important: To add a development certificate to your keychain, you must be a member of a development team. To add your development certificate to your keychain, do one of the following:
Transfer your signing assets from your previous development Mac. To learn how, see Safeguarding and Transferring Your Signing and Provisioning Assets (page 16).
Reset your code signing assets. To learn how, see Reset Your Signing and Provisioning Assets on Your Mac and in Your Team (page 54).
The Apple Worldwide Developer Relations Certification Authority Certificate Is Not in Your Keychain
Developer and distribution certificates in your keychain are not valid without the Apple Worldwide Developer Relations Certification Authority certificate. Important: The Apple Worldwide Developer Relations Certification Authority certificate is part of your development teams signing assets. See Becoming a Member of a Development Team (page 9) for more information. To add this certificate to your keychain:
1. 2. 3.
Log in to the iOS Provisioning Portal using the appropriate credentials for your team. Download the Apple Worldwide Developer Relations Certification Authority certificate. Double-click the certificate or drag it to the Keychain Access icon in the Dock.
Provisioning Issues
Xcode Cannot Install Your App on Your Development Device
If Xcode cannot install your app on your development device because of a problem with the provisioning profile youre using with the app:
Ensure that the provisioning profile is properly configured in your development teams signing assets. To learn about configuring provisioning profiles, see Provisioning a Device for Development (page 10).
49
Replace the expired provisioning profile with a new copy. To learn how, see Renewing Expiring or Expired Provisioning Profiles (page 15).
Building Issues
Code Signing Errors
This section describes how to address code signing identity problems that result in build errors. Xcode Cannot Find Your Provisioning Profile You get this error message after replacing a provisioning profile with a modified version, such as when a provisioning profiles app ID is changed:
Code Sign error: Provisioning Profile 'xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx' cant be found
Ensure that the correct provisioning profile and code signing identity are selected for the value of the Code Signing Identity build setting. See Setting Your Code Signing Identity (page 26).
2.
Ensure that the correct signing identity is in your keychain. See Ensure That Your Development Signing Identity Is in Your Keychain (page 53).
Xcode Doesnt Trust Your Certificate You get this error message when Xcode cannot verify the authenticity of your development or distribution certificate:
Code Sign error: CSSMERR_TP_NOT_TRUSTED
50
Ensure that the trust level of your certificates is set correctly. To learn how, see Fix the Trust Level of Your Certificates (page 53).
The Code Signing Identity Build Setting Doesnt Identity a Valid Code Signing Identity in Your Keychain You get this error message when your certificate has expired or is otherwise invalid:
Code Signing Identity 'iPhone Developer' does not match any valid, non-expired, code-signing certificate in your keychain.
Choose Window > Organizer, and click Devices. In the Library section, select Provisioning Profiles. Click Refresh.
2.
Choose a valid code signing identity, as described in Setting Your Code Signing Identity (page 26).
Your Keychain Contains Duplicate Code Signing Identities You get one of these error messages when there are duplicate code signing identities in your keychain, such as two development identities or two distribution identities (your keychain must contain at most one code signing identity of each type):
Build error "iPhone Developer: <your_name> (XYZ123ABC): ambiguous (matches "iPhone Developer: <your_name> (XYZ123ABC)" in /Library/Keychains/System.keychain and "iPhone Developer: <your_name> (XYZ123ABC)" in /Users/../Library/Keychains/login.keychain)"
[BEROR]CodeSign error: Certificate identity 'iPhone Distribution: <your_name>' appears more than once in the keychain. The codesign tool requires there only be one.
Delete the duplicate identities from the My Certificates list in your keychain. Reset your signing assets. To learn how, see Reset Your Signing and Provisioning Assets on Your Mac and in Your Team (page 54).
51
App ID Errors
The App ID of Your Provisioning Profile Doesnt Match Your Apps Bundle Identifier When theres a conflict between theapp ID in the provisioning profile selected in the Code Signing Identity build setting and your apps bundle identifier, you get error messages like this one:
Code Sign error: Provisioning profile 'MyApp Profile' specifies the Application Identifier 'com.mycompany.MyApp.*' which doesn't match the current setting 'com.mycompany.MyApp'
Your apps bundle identifier is set correctly. The provisioning profile specified in the Code Signing Identity build setting is the correct one. The app ID the provisioning profile uses is correct. To learn how to configure app IDs, see Creating and Configuring App IDs.
Ensure that the apps targeted iOS version is equal to or greater than the iOS version installed on your device. See Specifying the Targeted iOS Version (page 17), and Installing iOS on a Device (page 13) for details. Ensure that your device contains a valid provisioning profile. See Provisioning a Device for Development (page 10). Ensure that the version number of the iOS SDK your project uses is equal to or greater than the version number of the iOS version on your device. For example, if Xcode shows iOS SDK 4.3 but your device has iOS 5.0 installed, you need to install an Xcode version that includes iOS SDK 5.0 on your Mac.
2.
3.
52
Fixing Issues
Ensure That Your Development Signing Identity Is in Your Keychain
When you try to build or archive your app, or install it on a development device, Xcode might emit code signing errors, such as when it cannot find the development signing identity (development certificate and private key) its looking for or when the development certificate your project is using is invalid. To verify that your development signing identity is in your keychain:
1. 2. 3. 4.
Launch Keychain Access. In the Category list, click My Certificates. Enter iphone developer in the search field in the top-right corner of the window. Verify that a certificate named iPhone Developer: <Your_Name> appears in the certificates list. If the certificate is missing, see Your Development Certificate Is Not in Your Keychain (page 48).
5. 6.
Click the disclosure triangle to the left of the certificate to display the private key stored in the certificate. Select the certificate, and ensure that the certificate information indicates that the certificate is valid. If the certificate is invalid, see Your Development Certificate Is Invalid (page 48).
If you are starting to develop apps on a Mac that you havent used for iOS development before, you may need to transfer your signing assets from your previous Mac. To learn how, see Safeguarding and Transferring Your Signing and Provisioning Assets (page 16).
Launch Keychain Access. In the Category list, select My Certificates, and enter iphone in the search field. For each of your iPhone certificates in the certificates list:
a.
Double-click the certificate. If the message This certificate was signed by an unknown authority message appears on the certificate, see The Apple Worldwide Developer Relations Certification Authority Certificate Is Not in Your Keychain (page 49).
b. c. d.
In the certificate window, display the Trust section by clicking the corresponding disclosure triangle. For the option When using this certificate choose Use System Defaults. Close the certificate window.
53
e.
Ensure that the certificate information for the certificate indicates that the certificate is valid. If the certificate is invalid, see Your Development Certificate Is Invalid (page 48).
4.
In the Category list, select Certificates, and enter apple worldwide in the search field. If you dont see at least one certificate named Apple Worldwide Developer Relations Certificate Authority, see The Apple Worldwide Developer Relations Certification Authority Certificate Is Not in Your Keychain (page 49).
5.
For each of the Apple Worldwide Developer Authority certificates in the certificates list:
a. b. c. d. e.
Double-click the certificate. In the certificate window, display the Trust section by clicking the corresponding disclosure triangle. For the option When using this certificate choose Use System Defaults. Close the certificate window. Ensure that the certificate information for the certificate indicates that the certificate is valid. If the certificate is invalid, see Your Development Certificate Is Invalid (page 48).
Reset Your Signing and Provisioning Assets on Your Mac and in Your Team
When you cannot retrieve your signing and provisioning assets assets from a backup (Safeguarding and Transferring Your Signing and Provisioning Assets (page 16)), you have to recreate them on your Mac and in your development team. To reset your signing and provisioning assets:
1. 2.
Quit Xcode. Delete your private and public keys and your certificate from your keychain:
a. b. c.
Launch Keychain Access (located in /Applications/Utilities). In the Category section, select Keys. For each of the private keys with a disclosure triangle next to them:
54
a.
Click the disclosure triangle to reveal the item with which the private key is associated.
b.
If the private key is associated with a developer or distribution certificate, select the private key and its corresponding public key, and press Delete.
d.
In the Category section, select My Certificates, and delete any remaining developer or distribution certificates.
3.
Log in to the iOS Provisioning Portal using the appropriate credentials for your team. Revoke your development and distribution certificates.
4.
Launch Xcode. Choose Window > Organizer to open the Organizer window, and click Devices to display the devices organizer. In the Library section, select Developer Profile. Ensure that no certificates are listed in the certificates list (the first list in the Developer Profile pane).
c. d. 5.
55
If all the provisioning profiles are not invalid, ensure that your certificates are revoked in your teams signing assets.
6.
Remove your provisioning profiles from the devices organizer and your development devices:
a. b. c.
In the devices organizer, select Provisioning Profiles in the Library section. Select all the provisioning profiles, and press Delete. For each of your development devices:
a. b. c.
Plug in your device. Select Provisioning Profiles in your devices group. Select the invalid profiles in the profiles list, and press Delete.
7.
In the devices organizer, select Provisioning Profiles in the Library section. Click Refresh. Xcode offers to request a developer certificate for you. Have Xcode request your developer certificate. If you are the team agent, Xcode also offers to request a distribution certificate for you. Have Xcode request your distribution certificate.
56
After a few moments, the team provisioning profile appears in the provisioning profiles list.
8.
In your teams signing assets, associate your new certificates with the appropriate provisioning profiles: If you are a team administrator or the agent, modify each provisioning profile by adding your certificate to it. Otherwise, have a team administrator or the agent do this for you.
9.
Install the updated provisioning profiles in the devices organizer and on your devices:
a. b.
In the devices organizer, select Provisioning Profiles in the Library section. Click Refresh. The provisioning profiles associated with your developer certificate are listed in the provisioning profiles list. Important: If you are the team agent, note that Xcode doesnt download distribution profiles. You must download them manually to distribute your app. See Distributing Apps (page 41) for more information.
57
Here are some common questions developers ask about iOS development.
How do I run my application on a device? See Specifying the Run Destination (page 28).
Does the iOS Simulator app run on network home directories? No.
Do Objective-C properties need to be backed up by instance variables or accessor methods for them to work? Yes.
Do static libraries need to be code-signed before being used in an iOS app? No.
Why is my app having problems processing PNG files? The code that is trying to use your PNG files may not understand compressed PNG files.
Turn off the Compress PNG Files build setting.
Can I develop iOS apps on Windows? No. iOS apps can be developed only on Mac OS X.
How do I link all the Objective-C classes in a static library? Set the Other Linker Flags build setting to -ObjC. If that doesnt bring in all the classes, set it to -all_load.
When should I replace deprecated APIs? Update as soon as you can, considering the iOS versions you want your app to run on. See SDK Compatibility Guide for details.
What are the minimum hardware requirements for iOS development? A Mac with an Intel processor.
58
The exported headers are in the Project group in the Copy Headers build phase. The Skip Install build setting is set to Yes.
2.
The User Header Search Paths build setting is set to the recursive absolute path of a directory under which the static librarys header files are stored. Important: If you move your static library project directory to a different location in your file system, you must update the value of the User Header Search Paths build setting to reflect the new location of the static librarys header files.
The Always Search User Paths build setting is set to Yes. The Skip Install build setting is set to No.
59
3.
In the scheme that builds the app, ensure the scheme also builds the static library for archiving.
60
Glossary
application ID A string that identifies an iOS application or a set of iOS applications from one vendor. They are similar to bundle identifiers. These are examples application IDs: GFWOTNXFIY.com.mycompany.MyApp, GFWOTNXFIY.com.mycompany.*. base SDK Project setting that specifies the default SDK to use when building the projects targets. Targets can override this setting. build configuration A named collection of build settings in a project used to build one or more products for a specific purposefor example, for debugging or for release. certificate signing request (CSR) File that contains personal information used to generate a development certificate. code completion A shortcut that automatically suggests likely completions as you type an identifier or a keyword. The suggestions are based on the text you type and the surrounding context within the file. developer certificate File that identifies an iOS application developer. Xcode uses developer certificates to sign application binaries. development team A construct that 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) in order for the people in the team to build and run apps on development devices and distribute them to customers. device type Type of device in which iOS can run. There two device types: iPhone (includes iPod touch), and iPad. entitlement A property that allows an application to access a protected iOS feature or capability. GPS eXhange Format (GPX) A file format used to identify a single location or a set of locations, known as waypoints. instrument A data-gathering agent developed using the Instruments application. Instruments collect performance information about an application or an entire system. Instruments application A graphical performance analysis tool used to gather and mine application-performance data. iOS Dev Center An Apple developer center that provides all the resources needed to develop iOS applications. To access this developer center you must be a registered Apple developer. iOS Developer Program A program that allows you to develop iOS applications, test them on iOS-based devices, and distribute them to users. iOS Provisioning Portal A restricted-access area of the iOS Dev Center that allows you to configure devices to test your iOS applications.
61
Glossary
iOS Simulator application Xcode application that simulates the operation of iOS-based devices through simulators for testing iOS applications in early stages of development. See simulator. provisioning profile A file that allows applications in development to be installed on iOS-based devices. It contains one or more development certificates, an application ID, and one or more device identifiers. simulation environment An invisible environment the iOS Simulator application uses to simulate the operation of an iOS release. Each simulation environment has its own set of system files and installed applications. The iOS Simulator application provides one simulation environment for each of the iOS versions it supports. scheme A plan for running, testing, analyzing, and archiving one or more products. simulator A visible software imitation of an iOS device running a particular iOS release. A simulator runs in a simulation environment in the iOS Simulator application. See also iOS Simulator application, simulation environment. static library Object code that is incorporated in an application binary file at link time. test case A piece of code that executes test-subject code to verify that it behaves as expected. A test case is implemented by a test-case method. test-case method An instance method of a unit-test class named test... that calls API to test and reports whether it produced the expected results. user testing provisioning profile A provisioning profile issued to users that are not on your development team. It allows these users to install and test applications that your team has not published on the App Store. Also known as ad-hoc provisioning profile.
test suite A set of test cases. See also test case. Xcode A set of tools and resources used to develop Cocoa applications (for Mac OS X), and Cocoa Touch applications (for iOS). Xcode application The main application of the Xcode integrated development environment (IDE). It manages the other applications that are part of the Xcode IDE and provides the main user interface used to develop software products.
62
This table describes the changes to Tools Workflow Guide for iOS .
Notes Made available in PDF. Incorporated Xcode 4.3 workflows. Added information about location simulation, app-data management, and obtaining distribution-only assets. Added information about simulating locations and tracks in simulators and on devices in Specifying a Location or Track (page 29). Updated Managing App Data (page 30) with new workflow and described how to specify app data at launchtime in Specifying the App Data (page 28). Added information about obtaining distribution-only assets in Setting Up Your Distribution-Only Assets (page 15). Moved most of the information about unit-testing to Xcode Unit Testing Guide . Changed title from iOS App Development Workflow Guide .
2011-10-12
Added information about iCloud entitlements and a troubleshooting chapter. Added Configuring iCloud Entitlements (page 17). Added Configuring Your Project for App Store Submission (page 21). Added iOS Development: Troubleshooting (page 48). Modified Submitting Your App for Publication on the App Store (page 46).
63
Date 2011-09-09
Notes Incorporated Xcode 4.0 user interface and concepts. Added Developing a Static Library and Incorporating It in Your App (page 59). Added Migrating a Projects Unit Testing Setup from Xcode 3.2.5 to Xcode 4.0.2.
2010-11-15
Documented changes to Base SDK build setting. Described Latest iOS value for Base SDK and added instructions for solving Missing Base SDK problem in Setting the SDK Used to Build Your App (page 25). Added instructions on moving the center of a pinch in iOS Simulator in Performing Gestures (page 33). Updated content for the workflows and requirements of the iOS SDK 4.2 distribution.
2010-08-26 2010-07-02
Made minor corrections. Changed the title from iPhone Development Guide. Updated Hello, World! tutorial to iPhone SDK 4.0. Updated Hello, World! tutorial and source code (Tutorial: Hello, World! and Hello, World! Source Code) for iOS SDK 4.0 toolset.
2010-05-28
Added information about automatic provisioning profile management, application archiving, and application distribution. Updated Building and Running Apps (page 23) with details about using the Base SDK and iPhone OS Deployment Target build setting and the Overview toolbar menu in the Project window. Updated Using iOS Simulator (page 32) with information about how the Objective-Cruntime change in iOS 4.0 affects existing iOS Simulator binaries. Updated Configuring Development and Distribution Assets (page 9) to describe automatic provisioning-profile management and how to manage developer profiles in the Xcode Organizer.
64
Date
Notes Updated Distributing Apps (page 41) with details about the use of the Build and Archive command and recommended workflow for distributing applications for testing. Added hardware-simulation support information to Using iOS Simulator (page 32).
2010-03-19
Added iPad information. Added Specifying the Targeted Devices (page 18) to describe how to specify the family of devices on which you want your application to run. Added Specifying the Targeted Devices (page 18) to explain how to upgrade an iPhone target for building iPad applications. Updated Using iOS Simulator (page 32) with iPad information.
2010-01-20 2009-08-06
Fixed typos and addressed feedback. Added information about editing property-list files, linking static libraries, and iOS Simulator versions. Made minor changes. Added Editing Property-List Files section in Configuring Apps (page 17). Added important information about debugging applications on devices to Debugging Facilities Overview (page 37). Added Setting the Device and iOS Version (page 32).
2009-05-28
Described how to set the architecture for which an application is built. Added Specifying the Targeted Architecture (page 19) to describe how to choose the architectures an application can be built for.
2009-04-08
Added information on creating entitlement property-list files. Made minor content reorganization. Added Managing Application Entitlements .
2009-03-04 2009-02-04
65
Date
Notes Updated Capturing Screenshots (page 14) to specify how to get PNG files of screen shots captured in the Organizer. Updated Building Your App (page 29) with application ID build-error information.
2009-01-06
Made minor content additions. Explained that iOS Simulator binaries can be used on only one release of the simulator.
2008-11-14
Added information about new iOS Simulator features. Added Requirements for user testing (page 42). Added information about the Simulate Memory Warning and Toggle In-Call Status Bar commands to Manipulating the Hardware (page 32). Added Core Location Functionality . Added information about using static libraries in iOS applications to Creating an iOS Application Project .
2008-10-15
New document that describes how to develop iPhone applications using Xcode. Incorporates content previously published in iPhone OS Programming Guide and iOS Simulator Programming Guide .
66
Apple Inc. 2012 Apple Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, mechanical, electronic, photocopying, recording, or otherwise, without prior written permission of Apple Inc., with the following exceptions: Any person is hereby authorized to store documentation on a single computer for personal use only and to print copies of documentation for personal use provided that the documentation contains Apples copyright notice. No licenses, express or implied, are granted with respect to any of the technology described in this document. Apple retains all intellectual property rights associated with the technology described in this document. This document is intended to assist application developers to develop applications only for Apple-labeled computers. Apple Inc. 1 Infinite Loop Cupertino, CA 95014 408-996-1010 Apple, the Apple logo, Cocoa, Cocoa Touch, FaceTime, Finder, Instruments, iPad, iPhone, iPhoto, iPod, iPod touch, iTunes, Keychain, Mac, Mac OS, Objective-C, OS X, Shake, Spotlight, and Xcode are trademarks of Apple Inc., registered in the U.S. and other countries. Retina is a trademark of Apple Inc. iCloud is a service mark of Apple Inc., registered in the U.S. and other countries. App Store is a service mark of Apple Inc. Intel and Intel Core are registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries. OpenGL is a registered trademark of Silicon Graphics, Inc. iOS is a trademark or registered trademark of Cisco in the U.S. and other countries and is used under license.
Even though Apple has reviewed this document, APPLE MAKES NO WARRANTY OR REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT TO THIS DOCUMENT, ITS QUALITY, ACCURACY, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. AS A RESULT, THIS DOCUMENT IS PROVIDED AS IS, AND YOU, THE READER, ARE ASSUMING THE ENTIRE RISK AS TO ITS QUALITY AND ACCURACY. IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES RESULTING FROM ANY DEFECT OR INACCURACY IN THIS DOCUMENT, even if advised of the possibility of such damages. THE WARRANTY AND REMEDIES SET FORTH ABOVE ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL OR WRITTEN, EXPRESS OR IMPLIED. No Apple dealer, agent, or employee is authorized to make any modification, extension, or addition to this warranty. Some states do not allow the exclusion or limitation of implied warranties or liability for incidental or consequential damages, so the above limitation or
exclusion may not apply to you. This warranty gives you specific legal rights, and you may also have other rights which vary from state to state.