Setup SalesWarrior App on XCode to compile and deliver on an iPad
Setup SalesWarrior App on XCode
A. Download XCode, AWS S3 SDK for iOS, and the source code:
- Download and Install XCode version 5.0 or higher (https://developer.apple.com/xcode/downloads/)
- Download and Unzip Amazon S3 SDK for iOS (http://aws.amazon.com/sdkforios/)
Open XCode and click on "Check out an existing project"
- Enter in a repository location: https://bitbucket.org/cmaldonados2r/ipad.git , and click Next.
- (You will be prompted for username and password on first try. Your bitbucket username is shift2right, and password is your original 2013 password)
- Enter in a directory where the workspace will be created on the machine and click Next. Wait for the source code to be downloaded from BitBucket.
B. Fix/Re-link AWS S3 SDK library to locally downloaded library:
- Click on WasteManagementCRM on the top left (in blue), then click on Build Phases tab.
- Open up "Link Binary With Libraries" section.
- Select AWSS3.framework, and click on the - (minus) sign to remove it.
- Click on the + (plus) sign to add in the AWSS3.framework from the unzipped directory for the S3 SDK for iOS.
C. Compile and run the app locally on Simulator:
- On top left Title bar, click on WasteManagementCRM (next to pencil and ruler icon), and select WasteManagementCRM_DEV, and select iOS Simulator - iPad.
- Click on the triangle right arrow on the top left to run on the Simulator.
D. Compile and run through a device:
- The device needs to be set on Development mode on XCode
- Plug-in a device
- Go to Organizer under Window menu
- Select the device then click on button "Development Mode"
- Close Organizer Window
- On top left Title bar, click on WasteManagementCRM (next to pencil and ruler icon), and select WasteManagementCRM_DEV, and select iOS Device.
- Click on the triangle right arrow on the top left to run on the device.
For deploying to a device a developer provisioning profile is needed as well as the device's UUID. A Distribution Provisioning profile is needed if the app is to be sent to the Apple Store or to be distributed as an Enterprise App.
An Ad-hoc distribution provisioning profile is needed when deploying to a device remotely through TestFlight or hosted elsewhere.
E. Setup Distribution Certificate and Provisioning Profile. Here are a graph that depicts the Provisioning Profile Process as generic blocks.
- Create a Certificate Signing Request (CSR)
- Use Keychain MacOSX application to generate one. This is needed to create a public and private key of your identity. It will be attached for you (the public part) to the certificate (next step).
- From Keychain Access menu choose Certificate Assistant and then Request a Certificate From a Certificate Authority
- Fill in only:
- User Email Address
- Save To Disk
- You'll need this file to attach it in step 2
- Use Keychain MacOSX application to generate one. This is needed to create a public and private key of your identity. It will be attached for you (the public part) to the certificate (next step).
- Generate a Certificate
- There are two types
- Developer - Used to distribute apps to developers and testers
- Distribution - Used to distribute apps to Apple Store or an Enterprise Distribution (ad-hoc)
- Click on Development link in the Developer portal to generate a Developer Certificate by uploading the CSR file generated in step 1.
- Once generation has finished, download it to your computer, to a folder where you can later clearly identify it
- There are two types
- App ID. A string that identifies the application that will be supported by the provisioning profile. Normally the App ID is the reversed company domain name with the app name at the end: com.shift2right.saleswarrior. If the app belongs to a group of other apps, the App ID should end with an asterisk: com.shift2right.* which will allow to sign several related apps.
- This string can be found in the bundle identifier in XCode:
- Go to Project Navigator and select the project name 'WasteManagementCRM'
- Click on General tab and find the bundle identifier as the first field on the detail editor
- On Developer portal, click on App IDs link and create a new one that matches your bundle identifier from XCode.
- This string can be found in the bundle identifier in XCode:
- Device UUID. In order to distribute the binary to test devices or to Enterprise devices, the provisioning profile must include device's UUID. You can collect these UUIDs by plugin in the device and either in XCode or iTunes check the UUID and add them in the App ID section. Membership includes 100 devices per year, renewable each year.
- Click on Devices in the portal
- Click on the PLUS sign (top right) to add one by one or in bulk from a formatted file.
- You won't be able to change UUID once submitted. You can change the name though.
- You can cancel a UUID and its slot will be available in 3 months.
- Provisioning Profiles
- There are two types
- Developer - Used to distribute apps to developers and testers
- Distribution - Used to distribute apps to Apple Store or as an Enterprise Distribution (ad-hoc)
- Click on Development and then the PLUS button (top right)
- Next, choose iOS App Development and click Continue
- Choose now the App ID for the app you'll be generating a provisioning for. Click Continue.
- Choose the Certificate you generated in step 2. Click Continue.
- Choose the devices IDs that will be included in the provisioning profile. Click Continue.
- Give it a clear and formatted name (highly recommended). I'd suggest something like [ADHOC_]<TYPE>_DDMMMYYYY
- [ADHOC] - Just an identifier that the provisioning profile is for AD-HOC deployment (Enterprise) or not
- <TYPE> - Could be DEV or PROD
- DD - day in double digits
- MM - abbreviated month name
- YYYY - year
- Once generation has finished, download it to your computer, to a folder where you can later clearly identify it
- There are two types
- Install them in your developer computer
- Open the folder where you downloaded your certificate (step 2) and the provisioning profile (step 5)
- Double-click the Certificate so XCode can install it
- Double-click the Provisioning Profile so XCode can install it
- Use the provisioning profile to sign an app. The Provisioning Profile contains now the CSR (your identity), the Certificate (public key), the App ID (bundle identifier) and Device UUIDs, so it's time to generate a binary and sign it with the provisioning profile to be able to install it on the devices:
- Plug-in a device to your Mac
- From the Schema pop-up (top left on XCode), select WasteManagementCRM_DEV, and then select the name of the device from the combo
- Choose Run from Product menu
- After building, XCode will choose the provisioning profile to run on the plugged-in device.
- Check that the provisioning profile was installed onto the device by going to Settings-->General-->Profiles
Official Apple Info Page on Provisioning Profiles
More infomation can be found on Apple site. It may need signing in to the Developer Account.