iPhone ad hoc build using Xcode 4

I just switched to Xcode 4 and need to make an ad hoc build so my customer can test my app. Yet every tutorial I find is based on Xcode 3 and I can't seem to find my way with Xcode 4 on similar settings and actions I need to do. Is there a tutorial or anything out there that can help me on this? I googled it but with very poor results.

51009 次浏览

Make sure you have selected a device from the drop down menu and not the simulator.

Then in XCode 4 go to product -> archive.

After the build is complete open the organizer and selected Archives.

Here you will find your build, from here you can then select share, next XCode will ask with which profile to sign the app.

Now you have created an IPA which you can send to your testers.

I also couldn't find current (August 2013) information on this, particularly for distributing the app to iPhone users with PCs, not Macs. Sorting through the Google results, I found a lot of redundant and confusing information about iTunes Connect and Validation.

Here's what worked for me:

  1. You don't need to create an app record in iTunes Connect—that's just for when you want to put it in the store. If that's what you want, look at this: https://developer.apple.com/library/ios/documentation/ToolsLanguages/Conceptual/YourFirstAppStoreSubmission/CreateYourAppRecordiniTunesConnect/CreateYourAppRecordiniTunesConnect.html

  2. You don't need to Validate your app. That's just for when you want to put it in the store. If that's what you want, look at this: https://developer.apple.com/library/ios/recipes/xcode_help-archives_organizer/articles/validating_apps.html

  3. You do need an Ad-Hoc provisioning profile. To get one, follow the instructions under the heading: "Creating Ad Hoc Provisioning Profiles" at: https://developer.apple.com/library/ios/documentation/IDEs/Conceptual/AppDistributionGuide/TestingYouriOSApp/TestingYouriOSApp.html. Make sure you double click on the 'name.mobileprovision' file after you download it, to add it to Xcode.

  4. Don't waste time looking in your Xcode Project/Build Settings for an Ad-Hoc Code Signing Entitlement. It doesn't appear in my copy of Xcode, and I didn't need it.

  5. Even though the Ad-Hoc Code Signing Entitlement doesn't appear in the Project/Build Settings, you can see it in the Organizer/Devices/Library/Provisioning Profiles. It will have the name you gave it in step 3.

  6. Now you are ready to build a version of your app for Ad-Hoc distribution:

  7. In Xcode, make sure you are in your project window, with your project selected, and according to the accepted answer above, the iOS Device selected as the build target in the field at the top left adjacent to the Run/Stop buttons.

    1. From the Xcode Menu Bar, select Product/Build for…/ Archiving (if the "Build For…" options are greyed out, you may be in some window other than the project window, for example the Organizer window).

    2. From the Xcode menu bar, select Product/Archive

    3. Open the Organizer window (Shift-Cmd-2), select the Archives icon at the top in the middle.

    4. Highlight the version you want to distribute, and click on the "Distribute" button over on the right.

    5. Select the "Save for Enterprise or Ad-Hoc deployment" option.

    6. A "Choose an identity to sign with" dialog appears. From the dropdown list, select the iOS Distribution one you created in step 3. For me, the line with the name I created in Step 3 was greyed out, but the one directly below it worked.

    7. A dialog appears allowing you to name and save your Ad-Hoc app as an .ipa file.

  8. On your Windows PC:

    1. Copy the YourApp.ipa file and the name.mobileprovision file to somewhere like the desktop.

    2. In iTunes, find the main menu (maybe a little icon in the top left of the task bar), and select "Add File to Library… Ctrl+O"

    3. Add both the files to the library.

    4. Plug the iPhone in to the Windows PC

    5. Go to the iPhone section of iTunes, then to the Apps tab. With any luck you'll see YourApp, and you can click on Install.