Flipkart Search

Search This Blog

Thursday, November 26, 2009

Funny UIPickerView Animation

//Take a NSTimer object and a integer variable in your header file like this

   NSTimer *timer;
   int ComponentNumber;

//Put this line into your viewDidLoad

    ComponentNumber=0;
    timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(ChangeComponentNumber) userInfo:nil repeats:YES];


-(void)ChangeComponentNumber
{
    if(ComponentNumber>8)
    {
        [timer invalidate];
        return;
    }
    else if(ComponentNumber==4)
    {
        ComponentNumber=ComponentNumber+1;
        [self performSelector:@selector(HidePickerComponents) withObject:nil afterDelay:0.0];
    }
    else
    {       
        [self performSelector:@selector(HidePickerComponents) withObject:nil afterDelay:0.0];
    }
}
-(void)HidePickerComponents
{   
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1.0];   
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:AlarmSoundPicker cache:YES];
    [(UIView*)[[AlarmSoundPicker subviews] objectAtIndex:ComponentNumber] setHidden:YES];   
    [UIView commitAnimations];   
    ComponentNumber=ComponentNumber+1;
   
}

Wednesday, November 11, 2009

Convert All TimeZones To UTC TimeZone format

//*******Convert Any TimeZone To UTC*******//

-(NSString *)getUTCFormateDate:(NSDate *)localDate
{
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    NSTimeZone *timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
    [dateFormatter setTimeZone:timeZone];
    [dateFormatter setDateFormat:@"yyyy-MM-dd HH:mm:ss"];
    NSString *dateString = [dateFormatter stringFromDate:localDate];
    return dateString;
}

Saturday, November 7, 2009

Change navigation bar color in iphone sdk

here is how ou change your navigation bar color.

navigationController.navigationBar.tintColor=[UIColor colorWithRed:42/256.0 green:60/256.0 blue:80/256.0 alpha:1.0];

just replace the (42,60,80) to your desired RGB Value.

Generate Apple Push Notification Certificate

Generating a Certificate Signing Request

To request an iPhone Development Certificate, you first need to generate a Certificate Signing Request (CSR) utilizing the Keychain Access application in Mac OS X Leopard. The creation of a CSR will prompt Keychain Access to simultaneously generate your public and private key pair establishing your iPhone Developer identity. Your private key is stored in the login Keychain by default and can be viewed in the Keychain Access application under the ‘Keys’ category. To generate a CSR:
  1. In your Applications folder, open the Utilities folder and launch Keychain Access.
  2. In the Preferences menu, set Online Certificate Status Protocol (OSCP) and Certificate Revocation List (CRL) to “Off”.
    Keychain Access Preferences
  3. Choose Keychain Access -> Certificate Assistant -> Request a Certificate from a Certificate Authority. Note: If you have a noncompliant private key highlighted in the Keychain during this process, the resulting Certificate Request will not be accepted by the Program Portal. Confirm that you are selecting “Request a Certificate From a Certificate Authority...” and not selecting “Request a Certificate From a Certificate Authority with …”

    Request a Certificate

  4. In the User Email Address field, enter your email address. Please ensure that the email address entered matches the information that was submitted when you registered as an iPhone Developer.
  5. In the Common Name field enter your name. Please ensure that the name entered matches the information that was submitted when you registered as an iPhone Developer.
  6. No CA (Certificate Authority) Email Address is required. The ‘Required’ message will be removed after completing the following step.
  7. Select the ‘Saved to Disk’ radio button and if prompted, select ‘Let me specify key pair information’ and click ‘Continue’.
    Certificate Information

  8. If ‘Let me specify key pair’ was selected, specify a file name and click ‘Save’. In the following screen select ‘2048 bits’ for the Key Size and ‘RSA’ for the Algorithm. Click ‘Continue’.
    Key Pair Information

  9. The Certificate Assistant will create a CSR file on your desktop.



Submitting a Certificate Signing Request for Approval


  1. After creating a CSR, log in to the iPhone Developer Program Portal and navigate to ‘Certificates’ > ‘Development’ and click ‘Add Certificate’.
  2. Click the ‘Choose file’ button, select your CSR and click ‘Submit’. If the Key Size was not set to 2048 bits during the CSR creation process, the Portal will reject the CSR.
  3. Upon submission, Team Admins will be notified via email of the certificate request.
  4. Once your CSR is approved or rejected by a Team Admin, you will be notified via email of the change in your certificate status.
    Submit Certificate Signing Request

Approving Certificate Signing Requests


  1. After submitting a CSR for approval, Team Admins will be directed to the ‘Development’ tab of the ‘Certificates’ section. Here, CSRs can be approved or rejected by clicking the corresponding action next to each request.
  2. Once a CSR is approved or rejected, the requesting Team Member is notified via email of the change in their certificate status. Each iPhone Development Certificate is available to both the Team Member who submitted the CSR for approval and to the Team Admin(s).
    Downloading and Installing Development Certificates

Downloading and Installing Development Certificates


  1. In the ‘Certificates’ > ’Distribution’ section of the Portal, control-click the WWDR Intermediate Certificate link and select “Saved Linked File to Downloads” to initiate download of the certificate.
  2. On your local machine, double-click the WWDR Intermediate certificate to launch Keychain Access and install.
  3. Upon CSR approval, Team Members and Team Admins can download their certificates via the ‘Certificates’ section of the Program Portal. Click ‘Download’ next to the certificate name to download your iPhone Development Certificate to your local machine.
  4. On your local machine, double-click the downloaded .cer file to launch Keychain Access and install your certificate.
  5. Team Members can only download their own iPhone Development Certificates. Team Admins have the authority to download the public certificates of all of their Team Members. Apple never receives the private key for a CSR. The private keys are not available to anyone except the original key pair creator and are stored in the system keychain of that Team Member.
    Keychain Access - Add Certificate
    Keychain Access - Certificate Issued


Generating an App ID


  1. Team Agents or Team Admins should navigate to the ‘App ID’ section of the Program 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 Program 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. You need to create an App ID without .* in the iPhone developer Portal. An App ID without .* means its unique and works only for a single application(for Push-Notification).
  6. 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

  7. 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 Program 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 'Details' 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 iPhone 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.



Creating a Development Provisioning Profile

  1. In the ‘Provisioning’ section of the Portal, Team Admins should click 'Add' on the Development tab.
  2. Enter a name for the provisioning profile.
  3. Specify which devices will be associated with the provisioning profile. You must specify a device in order for that device to utilize the provisioning profile. If a device's UDID is not included in the provisioning profile the profile and your application cannot be installed on that device.
  4. Specify which iPhone Development Certificates will be associated with the provisioning profile. You must specify an iPhone Development Certificate in order for the application code signed with that same certificate to run on the device.
  5. Specify a single App ID for the Development Provisioning Profile. Each Development Provisioning Profile can specify only ONE App ID, therefore, if you have applications requiring different Keychain access, you will need to create a separate Development Provisioning Profile for each of those applications. If you are installing a suite of applications with the same required Keychain access or have a set of applications not requiring access to the Keychain, use an App ID containing the wild-card asterisk character to build all of your applications.
  6. Click ‘Submit’ to generate your Development Provisioning Profile.

    Create Development Provisioning Profile

Installing a Development Provisioning Profile

All Team Agents, Admins and Members can download a Development Provisioning Profile from the ‘Provisioning’ section of the Portal after it has been created. Only those developers whose Apple device IDs and iPhone Development Certificates are included in the provisioning profile will be able to install and test their application on their device.
  1. In the ‘Provisioning’ section of the Program Portal, click the download button next to the desired provisioning profile.
  2. Drag the downloaded file onto the Xcode application icon in the dock or into the ‘Organizer’ window within Xcode. This will automatically copy the .mobileprovision file to the proper directory. Alternatively, you can drag the .mobileprovision file onto the iTunes icon in the dock or copy the file to ‘~/Library/MobileDevice/Provisioning Profiles’. If the directory does not exist you will need to create it. Click on the ‘+’ button in the Provisioning section of the Organizer window to install your .mobileprovision file.
    Provisioning Profile in Xcode
    Provisioning Profile in Finder


Building and Installing your Development Application

Now that you have an approved iPhone Development Certificate, an assigned Apple device and a properly installed Development Provisioning Profile, Xcode can now build your application and install it on your development device. If you have a single iPhone Development Certificate and iPhone Development Provisioning Profile, you don’t need to change any settings in Xcode to start running your applications. To compile and install your code:
  1. Launch Xcode and open your project.
  2. In the Project Window, select ‘Device - iPhone OS’ from the ‘Device | Debug’ drop down menu in the upper-left hand corner.

    Select Device
  3. Highlight the project Target and select the ‘Info’ icon from the top menu bar.
    Select Project Info
  4. In the Target Info window, navigate to the ‘Build’ pane. Click the ‘Any iPhone OS Device’ pop-up menu below the ‘Code Signing Identity’ field and select the iPhone Development Certificate/Provisioning Profile pair you wish to sign and install your code with. Your iPhone Development certificate will be in bold with the Provisioning Profile associated with it in grey above. In the example below, ‘iPhone Developer: Team Leader’ is the Development Certificate and ‘My First Development Provisioning Profile’ is the .mobileprovision file paired with it.
    Select Development Profile
    Note: If the private key for your iPhone Development certificate is missing, or if your iPhone Development certificate is not included in a provisioning profile, you will be unable to select the iPhone Development Certificate/Provisioning Profile pair and you will see the following. Re-installing the private key or downloading a provisioning profile with your iPhone Development certificate included in it will correct this.
    Missing Certificate Error
  5. In the Properties Pane of the Target Info window, enter the Bundle Identifier portion of your App ID. If you have used an explicit App ID you must enter the Bundle Identifier portion of the App ID in the Identifier field. For example enter com.domainname.applicationname if your App ID is A1B2C3D4E5.com.domainname.applicationname. If you have used a wildcard asterisk character in your App ID, replace the asterisk with whatever string you choose.

    Enter the Bundle Identifier




Installing the SSL Certificate and Key on the Server

You should install the SSL distribution certificate and private cryptographic key you obtained earlier on the
server computer on which the provider code runs and from which it connects with the sandbox or production
versions of APNs. To do so, complete the following steps:
1. Open Keychain Access utility and click the My Certificates category in the left pane.
2. Find the certificate you want to install and open its disclosure triangle.
When you open the disclosure triangle, you'll see both a certificate and a private key.
3. Select both the certificate and key,select ExportItems from the File menu,and export them as a Personal
Information Exchange(.p12)file.
4. Copy the.p12 file to the new computer.
5. On Mac OSX and Mac OSX Server systems, double-click the.p12 file to install it in the keychain on the
new computer.
6. If you use a windows based server follow below steps.
7. You have imported the aps_developer_identity.cer to the keychain. Then you have to export these new cert and the private key of this cert (not the public key) and saved as .p12 files.
8. Then you use these commands to generate the cert and key in Mac’s Terminal for PEM format (Privacy Enhanced Mail Security Certificate)
openssl pkcs12 -clcerts -nokeys -out cert.pem -in cert.p12
openssl pkcs12 -nocerts -out key.pem -in key.p12

9. The cert.pem and key.pem files will be used by your own program communicating with APNS.
10. If you want to remove the passphase of private key in key.pem, do this
openssl rsa -in key.pem -out key.unencrypted.pem
Then combine the certificate and key
cat cert.pem key.unencrypted.pem > ck.pem
But please set the file permission of this unencrypted key by using chmod 400 and is only readable by root in a sever configuration.

Wednesday, September 30, 2009

Core Animation for Mac OS X and the iPhone: Creating Compelling Dynamic User Interfaces


Author: Bill Dudney
Publisher: Pragmatic Programmers, LLC, The on October 15, 2008
Pages: Paperback, 182 pages
Synopsis: Mac OS X Leopard introduces a fantastic new technology that makes writing applications with animated and cinematic user interfaces much easier. We'll explore this new technology by starting with the familiar concepts you already know from the pre-Leopard development kits.

Then we'll see how they apply to the new frameworks and APIs. We'll build on your existing knowledge of Cocoa and bring you efficiently up to speed on what Core Animation is all about.

With this book in hand, you can add Core Animation to your Cocoa applications, and make stunning user interfaces that your user's will be showing off to their friends.
Get the book here

Wednesday, September 23, 2009

Run your iPhone application on both iPhone OS 2.0 and iPhone OS 3.0 and above versions

first of all in your application delegate create a varaible like this

your appdelegate header file.

float version;

then create property for accessing to another classes

@property (nonatomic, assign) float version;

in appdelegate implementation file

@synthesize version;

in this method
- (void)applicationDidFinishLaunching:(UIApplication *)application {
  
    version =[[[UIDevice currentDevice] systemVersion] floatValue];
    //NSLog(@"Current version no=%f",version);
  }


now in the class where you are getting warning of method deprecations...
in header file of class
declare this

@class yourAppDelegate;

now where you declare instance variable declare your appdelegate.
    yourAppDelegate *AppDelegate;

now in implementation file of the class
import header file of your appdelegate
#import "yourAppDelegate.h"

in the viewDidLoadMethod.

- (void)viewDidLoad {
    [super viewDidLoad];
    AppDelegate=[[UIApplication sharedApplication] delegate];
  }

 now where you are getting warning use this code.I am using temporary statements you can put your code.

if (AppDelegate.version >= 3.0)
    {

       //put your 3.0 code here
        NSLog(@"Current OS VErsion %f",AppDelegate.version);
        cell.textLabel.text=cellValue;
        [cell.textLabel setFont:[UIFont systemFontOfSize:15.0]];
        [cell.textLabel setLineBreakMode:UILineBreakModeTailTruncation];// iPhone 3.0 code here
    }   
    else   
    {

        //put your 2.0 code here
        NSLog(@"Current OS VErsion %f",AppDelegate.version);
        cell.text=cellValue;   
        [cell setFont:[UIFont systemFontOfSize:15.0]];
        [cell setLineBreakMode:UILineBreakModeTailTruncation];
    } 











use this everywhere to get rid of those warnings..

now the final part.

set active target device 3.0 debug.


change base sdk to 3.0



and change deployment target to iphone os 2.0.



note you will get warnings but don't worry it will work fine.

to check it's working run your app in any iphone which have 2.0 OS.

if you don't have iPhone with OS 3.0 check in simulator.

Saturday, September 12, 2009

Upgrading your iPhone OS 2.0 Application to 3.0 and Handle Deprecation Warnings

The warnings I was getting are as follows:
warning: ’setImage:’ is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/
Headers/UITableViewCell.h:199)
warning: ’setText:’ is deprecated (declared at /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/
iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/
Headers/UITableViewCell.h:199)
Before…


//This worked perfect in OS 2.0
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
     static NSString *UserSettingButtonCellIdentifier = @"Cell";
 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:UserSettingButtonCellIdentifier];
 if (cell == nil) {
  cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier: UserSettingButtonCellIdentifier] autorelease];
 }
     NSUInteger row = [indexPath row];
     UserSetting *rowData = [list objectAtIndex:row];
     UIImage *image = [UIImage imageNamed:@"MyImage.png"];
     if (row != 0)
         cell.image = image; //WARNING here
     cell.text = rowData.name; //WARNING here
     [rowData release];
     return cell;
}
//the tableView method is completely deprecated.
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
 return UITableViewCellAccessoryDisclosureIndicator;
}
After, doing the mods to get rid of the deprecated warnings:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 static NSString *UserSettingButtonCellIdentifier = @"Cell";
 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:UserSettingButtonCellIdentifier];
 if (cell == nil) {
  cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier: UserSettingButtonCellIdentifier] autorelease];
 }
 NSUInteger row = [indexPath row];
 UserSetting *rowData = [list objectAtIndex:row];
 UIImage *image = [UIImage imageNamed:@"MyImage.png"];
 if (row != 0)
  cell.imageView.image = image; //FIXED here
 cell.textLabel.text = rowData.name; //FIXED here
 
#ifdef __IPHONE_3_0
        //This is a replacement for the tableView method
 cell.accessoryType =  UITableViewCellAccessoryDisclosureIndicator;
#endif
 
 [rowData release];
 return cell;
}
#ifndef __IPHONE_3_0
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
 return UITableViewCellAccessoryDisclosureIndicator;
}
#endif

Friday, September 11, 2009

find the documents directory on the iPhone in Just One Line Code

there are quite a few ways to find the documents directory on the iPhone. For those of you who don’t know, the documents directory of an application is the location where you should save your application data. While finding the documents directory is a trivial task, it is very important when coding most applications. Apple has provided quite a few ways for resolving the path to this directory.
If you read through some of Apple’s sample code, you will see their code to do this is generally 3 or 4 lines long. This seems like a lot of code to perform such a simple task. Here is a nice one-line of code for you to use in your applications.

[NSHomeDirectory() stringByAppendingPathComponent:@"Documents/YourDatabaseFileNameWithExtension"];

Here is the old method i was using before i found this on icodeblog.com...thanks to Brandon.

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask,YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *MyDatabasePath = [documentsDirectory stringByAppendingString:@"/YourDatabaseFileNameWithExtension"];

Saturday, September 5, 2009

Installing The Application on iPhone/iPod


  1. Connect your iPhone/iPod touch to your computer.
  2. Open iTunes.
  3. Extract the included zip file. You will see a .mobileprovision file and another .ipa.
  4. Drag-and-drop the .mobileprovision file onto Library, Applications in iTunes.
    Windows Add Mobile Provision File Screenshot
  5. Double-click the .ipa(extension) file to install the application in iTunes
  6. Verify that the application shows up in Library, Applications. Note that it will have the default Apple icon.
    Windows iTunes Library Applications Screenshot
  7. In iTunes, select your Device under Devices, choose the Application tab, and make sure that the new application is checked.
    Windows iTunes Devices iPhone Applications Screenshot
  8. Sync your Device and the app should now be installed on your device.
  9. Try out the newly-installed app. 


Troubleshooting

  1. Reboot the device. Then sync.
  2. Restart iTunes
  3. Send me screen shots of any error messages you get.

Thursday, September 3, 2009

Debugging From Xcode To Real Device(Jail-Broken)

Some random iPhone stuff

Have fun ...

Using gdb to debug on the iPhone (no need for OSX)

The goal here is to debug application on real-hardware. To do that you must follow some conditions :

  • Get gdb itself

    Good news, gdb is now available on cydia. So you can install it very easily. It comes all setup with all the needed signature / entitlements to have full functionalities. If you're interested in building it yourself, you'll find the original apple sources and the needed patches / build scripts on the telesphoreo repository

    The other way (previously only way) is to grab it from the SDK. Inside the .dmg you will find a package named iPhoneHostSideTools.pkg. Inside, there is Platforms/iPhoneOS.platform/Developer/usr/libexec/gdb/gdb-arm-apple-darwin. Just copy it to the iPhone, it's a universal binary that supports armv6 just fine.
    gdb is under GNU licence so you should be free to redistribute the binary as well I think.

    For information, the original Apple source are here.

    To enhance functionality you should add some entitlements to the apple binary. Use theses : for codesign, for ldid. To apply them :

    codesign -s "iPhone developer" --entitlements gdb.xcent -f gdb-arm-apple-darwin

    or

    ldid -Sgdb.xml gdb-arm-apple-darwin
  • Taget armv6

    Apple's modified gdb is kinda picky. It will only work properly on ARMv6 arch. ARM isn't sufficient ... You can see the different in cpusubtype in the output of otool :

    lain:iPhone tnt$ otool -h test.arm
    test.arm:
    Mach header
    magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
    0xfeedface 12 0 0x00 2 12 860 0x00000085

    lain:iPhone tnt$ otool -h test.armv6
    test.armv6:
    Mach header
    magic cputype cpusubtype caps filetype ncmds sizeofcmds flags
    0xfeedface 12 6 0x00 2 12 860 0x00000085

    To make sure of that you must make sure you have -arch armv6 (or -march=armv6 -mcpu=arm1176jzf-s, depending on your compiler) in you CFLAGS / LDFLAGS. Like this :

    /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0 -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk test.c -o test
  • Sign the binary with entitlements

    Update: Actually if you used the entitlements I provide to sign gdb, or if you used the gdb of cydia, this step is no longer required.

    Next, you need to sign the binary you want to debug with entitlements. For details on that, see the 'Using XCode with Pwned iPhone', it's described there. I do it with codesign on OSX but ldid also support theses.

    If you're planning on doing it with ldid, the easier it to apt-get install it on your phone and do it there.

    ldid -Smyapp.xml myapp

    The myapp.xml is the XML file describing the entitlements. I generate them using a simple script but for this simple purpose you could just always use a static one that would look like this :





    application-identifier
    test
    get-task-allow



    Update : If you applied enhanced entitlements to gdb as described in the first point, you don't need entitlements on your binary.

Using XCode with Pwned iPhone

The idea here is to use the official SDK to create applications without having to pay for an 'official' certificate and provisioning profile.

Note that the instructions here are experimental. I can't be held responsible for whatever happens if you try them ... That being said, I can hardly imagine any issue that couldn't be solved by a DFU restore ...

Make Build & Go" + Debugging works

If you're not a fully registred / paying developer, you can use XCode to compile apps but some functions won't work. Like the 'Build & go' button, the automatic signing or the debugger. It's however possible to make them work ! Just follow the steps ...

  • Create a self-signed signing certificate

    Apple has a nice page explaining how to do that. Make sure to name your certificate 'iPhone developer'.

  • Add a custom build step to sign executables

    A pwned iPhone doesn't need a valid signature ... but it still needs one, or at least the hashes ... (for more details see on www.saurik.com). Jay Freeman made a small utility called ldid that add thoses hashes. However here we will use the official codesign utility, provided by Apple, with our self-signed identity.

    To make remote debugging work, we also need to add entitlements to the Application. This will be handled by codesign as well. We will however need a small python utility gen_entitlements.py to generate the entitlement file. Download it, place it somewhere on your disk and make it executable.

    So, to execute codesign properly during the build, you will need to add a custom build step to each of your XCode projects. Select the menu options "Project > New Build Phase > New Run Script Build Phase", and enter the following script (don't forget to replace /Users/youruser/bin by the correct path to gen_entitlements.py) :

    export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
    if [ "${PLATFORM_NAME}" == "iphoneos" ]; then
    /Users/youruser/bin/gen_entitlements.py "my.company.${PROJECT_NAME}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent";
    codesign -f -s "iPhone developer" --resource-rules "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/ResourceRules.plist" \
    --entitlements "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/${PROJECT_NAME}.xcent" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}/"
    fi
  • Remove signature checks from MobileInstallation & SpringBoard

    The final step is to bypass some security checks in some executable. The idea is simple to patch them, using a small software. Of course, after patching, you need to re-generate a signature for the new binaries to get loaded properly. All-in-all, it's easier to do all that on your Mac. So open a console and cut & paste the instructions (I assume you have ssh on the iPhone and that it's IP is 192.168.0.1) :

    The binary patch has been written for 2.0.0 and I didn't get a change to test/update it to 2.0.1 ... so make sure you have a backup of the files and an active ssh if needed

    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    osx:~ user$
    mkdir iphone_tmp
    cd iphone_tmp
    scp root@192.168.0.1:/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation .
    scp root@192.168.0.1:/System/Library/CoreServices/SpringBoard.app/SpringBoard .
    cp MobileInstallation MobileInstallation.bak
    cp SpringBoard SpringBoard.bak
    curl -O http://www.246tNt.com/iPhone/iphone_binary_patch
    curl -O http://www.246tNt.com/iPhone/SpringBoard.xcent
    chmod +x ./iphone_binary_patch
    ./iphone_binary_patch
    export CODESIGN_ALLOCATE=/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/codesign_allocate
    codesign -s "iPhone developer" -f MobileInstallation
    codesign -s "iPhone developer" --entitlements SpringBoard.xcent -f SpringBoard
    scp MobileInstallation root@192.168.0.1:/System/Library/PrivateFrameworks/MobileInstallation.framework/MobileInstallation
    scp SpringBoard root@192.168.0.1:/System/Library/CoreServices/SpringBoard.app/SpringBoard

    Finally, reboot the phone ... and enjoy :) Note that you may have to restart XCode and re-plug the iPhone for the connection to work. Also, if you had done previous attempts without following this how-to, you might need to clear the /var/mobile/Media/PublicStaging directory on the iPhone.

source taken from:--http://www.246tnt.com/iPhone/#xcode