Friday 30 November 2012

Converting Latitude and Longitude in to Coordinates.....

Try this:
CLLocationCoordinate2D coord = CLLocationCoordinate2DMake(latitudeInFloat, longitudeInFloat);
MKMapPoint point = MKMapPointForCoordinate(coord);
NSLog(@"x is %i and y is %i",point.x,point.y);

Thursday 29 November 2012

Creating your App ID By APPLE.com

Test Application
An App ID is a unique identifier that iOS uses to allows your application to connect to the Apple Push Notification service, share keychain data between applications, and communicate with external hardware accessories you wish to pair your iOS application with. In order to install your application on an iOS based device, you will need to create an App ID. 

Each App ID consists of a universally unique 10 character “Bundle Seed ID” prefix generated by Apple and a “Bundle Identifier” suffix that is entered by a Team Admin in the Provisioning Portal. The recommended practice is to use a reverse-domain name style string for the “Bundle Identifier” portion of the App ID. An example App ID would be: 8E549T7128.com.apple.AddressBook. 

If you are creating a suite of applications that will share the same Keychain access (e.g. sharing passwords between applications) or have no Keychain Access requirements, you can create a single App ID for your entire application suite utilizing a trailing asterisk as a wild-card character. The wild-card character must be the last character in the App ID string. Example App IDs for this situation could be: R2T24EVAEE.com.domainname.* or R2T24EVAEE.* 

In these wild-card situations, you’ll simply replace the asterisk with whatever string you wish in the CF Bundle Identifier field in Xcode.
Generating an App ID
  1. Team Agents or Team Admins should navigate to the ‘App ID’ section of the Provisioning Portal.
  2. Click ‘Add ID’.
  3. Enter a common name for your App ID. This is a name for easy reference and identification within the Provisioning Portal.
  4. Enter a Bundle Identifier in the free-form text field. The recommended usage is a reverse-domain name style string, e.g., com.domainname.applicationname. For a suite of applications sharing the same Keychain access, you should use a wild-card character in the Bundle Identifier (e.g. com.domainname.* or *). This Bundle Identifier will need to match whatever CF Bundle Identifier you use for your application in Xcode.
  5. Click ‘Submit’. At this time, the 10 character Bundle Seed ID is generated and concatenated with the Bundle Identifier you entered. This resulting string is your App ID. Note: The Bundle Seed ID does not need to be entered into Xcode.
    Create App ID
  6. Generate a new App ID for each set of applications with shared Keychain Access needs. If you are creating a suite of applications that will share the same Keychain access (e.g. sharing passwords between applications) or have a set of applications with no Keychain Access requirements, create a single App ID for all applications utilizing a trailing asterisk as a wild-card character.
Registering an App ID for Apple Push Notification service
  1. In the App ID section of the Provisioning Portal, locate the App ID you wish to use with the Apple Push Notification service. Only App IDs with a specific bundle ID can be used with the APNs. You cannot use a “wild-card” application ID. You must see “Available” under the Apple Push Notification service column to register this App ID and configure a certificate for this App ID.
  2. Click the 'Configure' link next to your desired App ID.
  3. In the Configure App ID page, check the Enable Push Notification Services box and click the Configure button. Clicking this button launches the APNs Assistant, which guides you through the next series of steps that create your App ID specific Client SSL certificate.
  4. Download the Client SSL certificate file to your download location. Navigate to that location and double-click the certificate file (which has an extension of cer) to install it in your keychain.
  5. When you are finished, click Done in the APNS Assistant.
  6. Double-clicking the file launches Keychain Access. Make sure you install the certificate in your login keychain on the computer you are using for provider development. The APNs SSL certificate should be installed on your notification server.
  7. When you finish these steps you are returned to the Configure App ID page of the iOS Dev Center portal. The certificate should be badged with a green circle and the label “Enabled”.
  8. To complete the APNs set-up process, you will need to create a new provisioning profile containing your APNs-enabled App ID.
Registering an App ID for In App Purchases and Game Center
NOTE: You must create a new In App Purchase Test User account in iTunes Connect in order to utilize the In App Purchase Sandbox for testing. Any existing iTunes or iOS Developer accounts cannot be used for sandbox testing. Refer to the iTunes Connect Developer Guide for instructions on creating these test accounts. In order to utilize the Game Center Sandbox for testing, you must also create a new Game Center Test User account in the Game Center application on your device.
  1. All explicit App IDs are automatically enabled for In App Purchase and Game Center. Wildcard App IDs and duplicates of existing explicit App IDs are ineligible for In App Purchase and Game Center.
  2. Go to the Manage In App Purchase module in iTunes Connect to set up your In App Purchase.

Add 'Rate This App' Feature To iphone App Using Appirater...

Appirater - Remember your users to Rate your App (iOS)

I saw that @mitchellapps posted a similar tutorial but it uses a different approach and I think Appirater has a more active support and it can be easily localized. 

Tutorial: 
1 - Download source code from https://github.com/arashpayan/appirater 

2 - Copy the files to your project (only the .h and .m files are required, the other files are optional) 

3 - Add CFNetwork and SystemConfiguration frameworks (They are added by default on BT 1.5) 

4 - Open xxx_appDelegate.m and make the following changes: 

4.1 - Add #import "Appirater.h" (I'm not telling you where to add this, come on!!!) 

4.2 - At the end of the didFinishLaunchingWithOptions method before the "return TRUE;" add the following line (don't forget the ; at the end): 
[Appirater appLaunched:YES]; 

4.3 - Right after the didFinishLaunchingWithOptions method add another method as following: 
//Appirater Entered Foreground 
-(void)applicationWillEnterForeground:(UIApplication *)application{ 
[Appirater appEnteredForeground:YES]; 
} 

4.4 - Congratulations, you are done tweaking BT source code!!! Now lets configure the Appirater code... 

5 - Open the Appirater.h file that you copied to your project. This file is very well commented, but if you are rrreeeeallllyyyy lazy I will show you the most important options: 

5.1 - Enter your iTunes Connect App ID at the #define APPIRATER_APP_ID line. 
5.2 - APPIRATER_DAYS_UNTIL_PROMPT - number of days the user will have to have your app installed before prompting, anything from 10 to 20 should be fine. 
5.4 - APPIRATER_USES_UNTIL_PROMPT - number of times a user has to use your app before they get prompted to rate it, anything from 5 to 10 should be fine. 
5.5 - APPIRATER_TIME_BEFORE_REMINDING - If the user taps the "Remind me later" options thats the amount of days the app will wait to prompt the user again. I like to use 1 or 2. 

6 - To localize it to any language all you need to do is create a localization for your project (I'm not covering this), add the following strings and change the second part of each string: 

/* Appirater */ 
"If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!" = "If you enjoy using %@, would you mind taking a moment to rate it? It won't take more than a minute. Thanks for your support!"; 
"Rate %@" = "Rate %@"; 
"No, Thanks" = "No, Thanks"; 
"Remind me later" = "Remind me later"; 

7. Debugging: 
7.1 At the Appirater.h file search for APPIRATER_DEBUG, it's set to NO by default but if you want to test/debug you can set it to YES and it will show you the alert everytime you open the app. 
7.2 !IMPORTANT! Remember to set it to NO before submitting your app to the App Store. 

I think this is my first tut here on BT, so please be nice and don't be lazy. Its a VERY simple modification and even beginners can do this if they put some effort.
 Appirater as used in Prayer Book app

Wednesday 28 November 2012

good Example to store Images in sqlite...

1. Project Requirements

I suggest that you have at least a basic understanding of SQLite, writing SQL statements, the XCode interface and using the terminal in OSX. If you don’t know anything about any of these topics then this tutorial probably isn’t for you.

2. Creating our SQLite database for our tutorial

We first need to create a database for use with our application. For the purposes of this tutorial we will be building a database of animals along with a little information on them and a picture.
Fire up a new Terminal window and make a new folder to store the database in, here are the commands I ran
cd /Users/lookaflyingdonkey/Documents
mkdir SQLiteTutorial
cd SQLiteTutorial
sqlite3 AnimalDatabase.sql
You should now be at a “sqlite” command prompt, this is where we will be building our database structure and entering some test data.
For our example we need the name of the animal, a short description and a link to an image. Follow the commands below to create the table and to enter some sample data.
CREATE TABLE animals ( id INTEGER PRIMARY KEY, name VARCHAR(50), description TEXT, image VARCHAR(255) );

INSERT INTO animals (name, description, image) VALUES ('Elephant', 'The elephant is a very large animal that lives in Africa and Asia', 'http://dblog.com.au/wp-content/elephant.jpg');
INSERT INTO animals (name, description, image) VALUES ('Monkey', 'Monkies can be VERY naughty and often steal clothing from unsuspecting tourists', 'http://dblog.com.au/wp-content/monkey.jpg');
INSERT INTO animals (name, description, image) VALUES ('Galah', 'Galahs are a wonderful bird and they make a great pet (I should know, I have one)', 'http://dblog.com.au/wp-content/galah.jpg');
INSERT INTO animals (name, description, image) VALUES ('Kangaroo', 'Well I had to add the Kangaroo as they are the essence of the Australian image', 'http://dblog.com.au/wp-content/kangaroo.jpg');
The first command will create the table with the required structure and the next four will insert some test data for us to work with. To ensure that you have entered the data correctly you can execute “SELECT * FROM animals;” and see if it returns the items above. Once you are confident that everything had been created successfully you can leave the sqlite command line by typing “.quit”.

3. Creating our Project

Now that our database is all ready to go we need to setup our X-Code project.
Start off by creating a new “Navigation-Based Application”.
Give your Project a name, I called mine “SQLiteTutorial”.
Now set your screen layout to how you prefer it, I suggest making the window as large as possible, and making the code view as tall as possible by dragging the horizontal slider to the top. This will allow you the most room to move when building your application.
Now its time to create the required classes and views for our application, we will start off by making our views.
Right Click on the “Resources” folder in the left hand pane and click “Add File”, we want to create a new “View XIB” under the “User Interfaces” group.
We now need to give it a name, to stick the Apple’s naming conventions we are going to call it“AnimalViewController.xib”, Now Click “Finish”.
Now we need to create two classes, the first one will represent an animal, right click on the “Classes” folder in the left hand pane, click “Add > New File…”, choose the “NSObject subclass” template under the “Cocoa Touch Classes” group and name it “Animal”.
The second class will be for our AnimalsViewController, right click on the “Classes” folder in the left hand pane, click “Add > New File…”, choose the “UIViewController subclass” under the “Cocoa Touch Classes” group and name it “AnimalViewController”.

4. Adding SQLite Framework and our Animal Database

Now that we have created all of our views and classes it is time to start the real grunt work.
First off we need to include the SQLite libraries so our application can utilise them. To do this you will need to right click on the “Frameworks” folder in the left hand pane, then click on “Add > Existing Frameworks…”, then navigate to “/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/” and double click the “libsqlite3.0.dylib” file. A popup will appear, just click “Add” and the library will be added to your project.
We also need to add our database we created earlier to the Resources folder, to do this simply right click on the “Resources” folder, click “Add > Existing Files…”, navigate to the location you created the database in then double click on the AnimalDatabase.sql file. Another popup will appear, just click add.
All done with the importing, time to code!

5. The Coding begins!

We are going to start the coding by building our “Animal” object, every animal will have 3 properties, a name, a description and an image URL.
Open up the “Animal.h” file from the “Classes” folder and edit its contents to look like below,
#import <UIKit/UIKit.h>

@interface Animal : NSObject {
 NSString *name;
 NSString *description;
 NSString *imageURL;
}

@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *description;
@property (nonatomic, retain) NSString *imageURL;

-(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u;

@end
Most of the above code should be pretty familiar to you, the only thing that may not be is the initWithNameline, this line will allow us to create a new object with the required data, we could have used the default initfunction, but it will be easier for us to define our own.
Now we will actually have to implement the Animal Object, open up the “Animal.m” file and edit its contents to look like below:
#import "Animal.h"

@implementation Animal
@synthesize name, description, imageURL;

-(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u {
 self.name = n;
 self.description = d;
 self.imageURL = u;
 return self;
}
@end
The above code should be pretty easy to read as well, it basically stores the supplied data from the initWithName function and return the object (self).
Now its time to setup the Application delegate to access the database.
Open up the “SQLiteTutorialAppDelegate.h” and edit its contents to look like below:
#import <UIKit/UIKit.h>
#import <sqlite3.h> // Import the SQLite database framework

@interface SQLiteTutorialAppDelegate : NSObject  {

    UIWindow *window;
    UINavigationController *navigationController;

 // Database variables
 NSString *databaseName;
 NSString *databasePath;

 // Array to store the animal objects
 NSMutableArray *animals;
}

@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
@property (nonatomic, retain) NSMutableArray *animals;

@end
What we are doing here is importing the SQLite database framework and creating some variables for storing the database details and an array of animal objects.
Now open up the “SQLiteTutorialAppDelegate.m” file and edit its contents to look like below:
#import "SQLiteTutorialAppDelegate.h"
#import "RootViewController.h"
#import "Animal.h" // Import the animal object header

@implementation SQLiteTutorialAppDelegate

@synthesize window;
@synthesize navigationController;
@synthesize animals; // Synthesize the aminals array

- (void)applicationDidFinishLaunching:(UIApplication *)application {
 // Setup some globals
 databaseName = @"AnimalDatabase.sql";

 // Get the path to the documents directory and append the databaseName
 NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
 NSString *documentsDir = [documentPaths objectAtIndex:0];
 databasePath = [documentsDir stringByAppendingPathComponent:databaseName];

 // Execute the "checkAndCreateDatabase" function
 [self checkAndCreateDatabase];

 // Query the database for all animal records and construct the "animals" array
 [self readAnimalsFromDatabase];

 // Configure and show the window
 [window addSubview:[navigationController view]];
 [window makeKeyAndVisible];
}

- (void)applicationWillTerminate:(UIApplication *)application {
 // Save data if appropriate
}

- (void)dealloc {
 [animals release];
 [navigationController release];
 [window release];
 [super dealloc];
}

-(void) checkAndCreateDatabase{
 // Check if the SQL database has already been saved to the users phone, if not then copy it over
 BOOL success;

 // Create a FileManager object, we will use this to check the status
 // of the database and to copy it over if required
 NSFileManager *fileManager = [NSFileManager defaultManager];

 // Check if the database has already been created in the users filesystem
 success = [fileManager fileExistsAtPath:databasePath];

 // If the database already exists then return without doing anything
 if(success) return;

 // If not then proceed to copy the database from the application to the users filesystem

 // Get the path to the database in the application package
 NSString *databasePathFromApp = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:databaseName];

 // Copy the database from the package to the users filesystem
 [fileManager copyItemAtPath:databasePathFromApp toPath:databasePath error:nil];

 [fileManager release];
}

-(void) readAnimalsFromDatabase {
 // Setup the database object
 sqlite3 *database;

 // Init the animals Array
 animals = [[NSMutableArray alloc] init];

 // Open the database from the users filessytem
 if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) {
  // Setup the SQL Statement and compile it for faster access
  const char *sqlStatement = "select * from animals";
  sqlite3_stmt *compiledStatement;
  if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
   // Loop through the results and add them to the feeds array
   while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
    // Read the data from the result row
    NSString *aName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
    NSString *aDescription = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 2)];
    NSString *aImageUrl = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 3)];

    // Create a new animal object with the data from the database
    Animal *animal = [[Animal alloc] initWithName:aName description:aDescription url:aImageUrl];

    // Add the animal object to the animals Array
    [animals addObject:animal];

    [animal release];
   }
  }
  // Release the compiled statement from memory
  sqlite3_finalize(compiledStatement);

 }
 sqlite3_close(database);

}

@end
Now I know that may look like a fair bit of code and it probably also looks quite scary! But really it is quite simple and I have tried to comment nearly every line to describe to you what the line does and why it is there.
The checkAndCreateDatabase function checks to see if we have already copied our database from the application bundle to the users filesystem (in their documents folder), if the database hasn’t already been created or it has been removed for some reason it will be recreated from the default database.
Next the readAnimalsFromDatabase function will make a connection to the database that is stored in the users documents folder, and then executes the SQL statement “SELECT * FROM animals”. It will then go through each row that is returned and it will extract the name, description and imageURL from the result and build an Animal object for each. You will see the “sqlite3_column_text” function used here, there are many more of these for returning other field types such as “sqlite3_column_int” for integers,“sqlite3_column_blob” for blobs or “sqlite3_column_value” to get an unknown value.
Now that we have the data in our array and we have it in our known format we are ready to start displaying it.
Open up the “RootViewController.m” file and edit the numberOfRowsInSection to look like the following:
SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
return appDelegate.animals.count;
What this does is it creates a link to the application delegate, and then the second line returns the size f the animals array in out Application delegate, this array was filled previously from the SQLite database.
Now in the cellForRowAtIndexPath function you will need at change it to look like the following:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
    }

    // Set up the cell
    SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
 Animal *animal = (Animal *)[appDelegate.animals objectAtIndex:indexPath.row];

 [cell setText:animal.name];
 return cell;
}
We pretty much just added 3 lines under the “// Set up the cell” line, the first one is the same as we added previously to access the application delegate. The second line creates a new Animal object based on the array from the application delegate, it will be used to create a row for each individual record in the database. On the final line we are just setting the text of the cell to the name field from the Animal object.
You can now run the program and you should see a table view with the 4 animals we added to the database, if you added more than my default animals you should see them in here as well.
We will now setup the AnimalViewController, open up the “AnimalViewController.h” file and edit its contents to below:
#import <UIKit/UIKit.h>

@interface AnimalViewController : UIViewController {
 IBOutlet UITextView *animalDesciption;
 IBOutlet UIImageView *animalImage;
}

@property (nonatomic, retain) IBOutlet UITextView *animalDesciption;
@property (nonatomic, retain) IBOutlet UIImageView *animalImage;

@end
What we are doing above is adding an outlet for the description and image for the Animal, we will use these later on when we link the view up.
Now open up the “AnimalViewController.m” file and add a synthesize call for for the description and image, this will go under the “@implementation AnimalViewController” line, like so:
#import "AnimalViewController.h"

@implementation AnimalViewController

@synthesize animalDesciption, animalImage;
Now it is time to make the detailed view page appear when you select a record. Open up the “AnimalViewController.xib” file from the resources folder and the interface builder should appear.
The first thing we need to do is to set the File’s Owner Class to AnimalViewController, this is done by selecting the “File’s Owner” item in the main window and then clicking Tools > Identity Inspector in the top menu, and then selecting AnimalViewController from the class dropdown.
Your inspector window should now look like this:
We are going to be using a UITextView for the description (as it will allow for word wrapping and scrolling in the case that the description is quite large) and a UIImageView to display the image. I have laid mine out like below:
Now that we have everything laid out it is time to link them all up, start by holding control and click+dragfrom the “File’s Owner” to the “View” objects, a little gray menu will appear and you will need to select view. Now hold control and click+drag from the “File’s Owner” to the UITextView in the layout window, you should see “animalDescription” in the popup list, select it. Repeat this process for the UIImageView and you should see animalImage appear, select it also.
Now save the interface and close the interface builder.
Nearly done! All we have to do now is to setup the code for when a user presses on a record in the table view.
Open up the “RootViewController.h” file and edit its contents to below:
#import <UIKit/UIKit.h>
#import "AnimalViewController.h"

@interface RootViewController : UITableViewController {
 AnimalViewController *animalView;
}

@property(nonatomic, retain) AnimalViewController *animalView; 

@end
We are creating an instance of the AnimalViewController to be used bu the RootViewController when a user presses on an item.
Now open up the “RootViewController.m” file and edit the top part of the file to look like below:
#import "RootViewController.h"
#import "SQLiteTutorialAppDelegate.h"
#import "Animal.h"

@implementation RootViewController
@synthesize animalView;
This will just synthesize the animalView that we just added.
First up lets set the default title of our view, to do this you need to uncomment the viewDidLoad function, and edit it to below:
- (void)viewDidLoad {
    [super viewDidLoad];
    // Uncomment the following line to add the Edit button to the navigation bar.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

 self.title = @"My Zoo";
}
We also need to edit the didSelectRowAtIndexPath
function in this file, edit it to look like below:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    // Navigation logic -- create and push a new view controller
 SQLiteTutorialAppDelegate *appDelegate = (SQLiteTutorialAppDelegate *)[[UIApplication sharedApplication] delegate];
 Animal *animal = (Animal *)[appDelegate.animals objectAtIndex:indexPath.row];

 if(self.animalView == nil) {
  AnimalViewController *viewController = [[AnimalViewController alloc] initWithNibName:@"AnimalViewController" bundle:nil];
  self.animalView = viewController;
  [viewController release];
 }

 // Setup the animation
 [self.navigationController pushViewController:self.animalView animated:YES];
 // Set the title of the view to the animal's name
 self.animalView.title = [animal name];
 // Set the description field to the animals description
 [self.animalView.animalDesciption setText:[animal description]];
 // Load the animals image into a NSData boject and then assign it to the UIImageView
 NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:[animal imageURL]]];
 UIImage *animalImage = [[UIImage alloc] initWithData:imageData cache:YES];
 self.animalView.animalImage.image = animalImage;

}
What we are doing here is checking to see if the animalView object has already been created, if not then create it.
The next few lines are used to setup the animation (slide from right to left) and to set the actual data fields to those of the selected animal.
Now you should be ready to fire up the application and see it in all its glory.
You should see your windows looking like below.
 

5. Project Files

Here are the source files for this project: Download the project source files

Tuesday 27 November 2012

Ad-hoc Testing of Application in Real Device

The instructions that Apple provides are not very concise or clear. This is how I created a general provisioning profile that will work with multiple apps, and added a beta tester.
My setup:
  • Xcode 3.2.1
  • iPhone SDK 3.1.3
Before you get started, make sure that..
  • You can run the app on your own iPhone through Xcode.

Step A: Add devices to the Provisioning Portal

  1. Send an email to each beta tester with the following message:
    To get my app on onto your iPhone I need some information about your phone. Guess what, there is an app for that!
    Click on the below link and install and then run the app.
    This app will create an email. Please send it to me.
  2. Collect all the UDIDs from your testers.
  3. Go to the Provisioning Portal.
  4. Go to the section Devices.
  5. Click on the button Add Devices and add the devices previously collected.

Step B: Create a new provisioning profile

  1. Start the Mac OS utility program Keychain Access.
  2. In its main menu, select Keychain Access / Certificate Assistant / Request a Certificate From a Certificate Authority...
  3. The dialog that pops up should aready have your email and name it it.
  4. Select the radio button Saved to disk and Continue.
  5. Save the file to disk.
  6. Go back to the Provisioning Portal.
  7. Go to the section Certificates.
  8. Go to the tab Distribution.
  9. Click the button Request Certificate.
  10. Upload the file you created with Keychain Access:CertificateSigningRequest.certSigningRequest.
  11. Click the button Aprove.
  12. Refresh your browser until the status reads Issued.
  13. Click the Download button and save the file distribution_identify.cer.
  14. Doubleclick the file to add it to the Keychain.
  15. Backup the certificate by selecting its private key and the File / Export Items....
  16. Go back to the Provisioning Portal again.
  17. Go to the section Provisioning.
  18. Go to the tab Distribution.
  19. Click the button New Profile.
  20. Select the radio button Ad hoc.
  21. Enter a profile name, I named mine Evertsson Common Ad Hoc.
  22. Select the app id. I have a common app id to use for multiple apps: Evertsson Common.
  23. Select the devices, in my case my own and my tester's.
  24. Submit.
  25. Refresh the browser until the status field reads Active.
  26. Click the button Download and save the file to disk.
  27. Doubleclick the file to add it to Xcode.

Step C: Build the app for distribution

  1. Open your project in Xcode.
  2. Open the Project Info pane: In Groups & Files select the topmost item and press Cmd+I.
  3. Go to the tab Configuration.
  4. Select the configuration Release.
  5. Click the button Duplicate and name it Distribution.
  6. Close the Project Info pane.
  7. Open the Target Info pane: In Groups & Files expand Targets, select your target and press Cmd+I.
  8. Go to the tab Build.
  9. Select the Configuration named Distribution.
  10. Find the section Code Signing.
  11. Set the value of Code Signing Identity / Any iPhone OS Device to iPhone Distribution.
  12. Close the Target Info pane.
  13. In the main window select the Active Configuration to Distribution.
  14. Create a new file from the file template Code Signing / Entitlements.
  15. Name it Entitlements.plist.
  16. In this file, uncheck the checkbox get-task-allow.
  17. Bring up the Target Info pane, and find the section Code Signing again.
  18. After Code Signing Entitlements enter the file name Entitlements.plist.
  19. Save, clean, and build the project.
  20. In Groups & Files find the folder MyApp / Products and expand it.
  21. Right click the app and select Reveal in Finder.
  22. Zip the .app file and the .mobileprovision file and send the archive to your tester.
    Here is my app. To install it onto your phone:
    1. Unzip the archive file.
    2. Open iTunes.
    3. Drag both files into iTunes and drop them on the Library group.
    4. Sync your phone to install the app.
Done! Phew. This worked for me. So far I've only added one tester.