How to deal with iPhone Device Provisioning without Stabbing Your Eyes Out

    July 31st, 2009 Posted by: - posted under:Articles

    Introduction

    So for any developer than has joined the iPhone Development program and attempted to throw their app on their phone, the process of provisioning is a familiar and likely painful process. Like many developer you may have several projects going on possibly for several organizations. You can think of provisioning as the paper work your app needs to fill out in order to “board” your phone. The process involves ____ steps:

    1. Get an iPhone Developer Account
    2. Create a certificate request
    3. Download your approved certificate
    4. Register your device
    5. Create an App Id for some app (eg. com.exampleComapny.exampleProduct
    6. Create a provisioning profile that says an app with a certain App ID can run on a device with a certain ID

    While there may be a headache or two in the first several steps, Apple does provide a fairly robust overview of how to accomplish those things. We are going to focus on a developer who has gone through these steps and has a provisioning profile available on their machine. Now you may have multiple provisioning profiles on a single machine, but doing that just involves more work. I use this quick trick to modify projects to my provioioning profile so that I can help test etc.

    Instructions

    Step 1

    Assuming you already have a project created, open up the terminal and navigate into the directory for the project. In my case I have a project called “MyTesterProject”.

    Picture 15

    Step 2

    Now if we do an ls command we can see that there is a .xcodeproj in this directory. We are going to navigate into that. Although in Finder this may look like a file, it is actually a bundle or folder that has things contained in it. Using the change directory command (cd) we can navigate into the project.

    Picture 16Picture 17

    Step 3

    Listing out the directory here we can see that there are several files. The one we are going to focus on is project.pbxproj. This is the file that contains all the configuration settings for this project. What I do here through the terminal is use the command mate to open text mate, however you may use vi or pico or whatever other text editor you like to open the file.

    Picture 18Picture 19

    Step 4

    Now you are going to search for whatever developer this project is currently linked to. For this example lets pretend that this project is configured for a provisioning profile for “Collin Ruffenach” but we want to change it. Search through this document and find the developers name.

    Picture 20

    Step 5

    You will find the name in a section of text that looks similar to this. You need to replace whatever name is there with your name. The other important field begins with “PROVISIONING_ PROFILE”.

    Picture 21

    The number that you are to replace the provisioning profile number with will be found in xCode. If you go into xCode and into the Window menu, you will see an option for organizer. In organizer you can see all your provisioning profiles. Pick the one you have made for your self and get the Profile Identifier, this is what you will put for the PROVISIONING_PROFILE:

    Picture 25Picture 26Picture 27

    Step 6

    The last thing to do is go into the info.plist file for the project and make sure to change the Bundle Identifier to match the one for the provisioning profile you have. I know at first this seems like a kind of invasive way to do things, but it has really sped up my development and testing time. Hope this tip works for you guys. Thanks for reading and Happy Coding!

    Picture 24