Archive

Archive for the ‘xCode’ Category

How to generate certificate and provisioning profile on apple developer site

May 21st, 2011 4 comments

Friends,

Here are steps to generate certificate and provisioning profile from apple developer site for signing iphone application.

STEP 1: Open http://developer.apple.com/ios and login with your developer account. Note that you need to purchase $99 or $299 developer program from apple to do this. Once you login to developer site, you will get screen as shown in below image.

Apple Developer Provisioning Portal Home

 

STEP 2: Now from that screen click on iOS Provisioning Portal. This will open screen as shown in below image.

Apple Developer Provisioning Portal Home

STEP 3: Now click on Certificates from left navigation of previous page. Now on this page you can see two main tabs: Development and Distribution. So here you can create certificate for development and distribution separately. If you didn’t created certificate yet then you can see “Request Certificate” button. So click on that will open screen that will ask you for Certificate Signing Request(CSR) file. That you can create as from this post. You can see below screen once you click on Request Certificate” button. It will open screen as shown in below image.

STEP 4: Now choose CSR file as we have created in previous step as from this post and click on Submit button. I have created certificate from my team member account so I can’t see Distribution tab but you can see it from your mail developer account. Now this will create certificate for you. You need to approve this certificate from list of certificates available on your Developer or Distribution tab. Once you approved it, download and save it on your MAC.

STEP 5: Install certificate on Mac.

Once you have downloaded that certificate, just open that .cer file by double clicking on it. This will install your certificate to your development machine. Remember that you need to have private key for installing this certificate and you can get this private ket from Mac on which you have created your CSR. So remember to always backup your private key from your Mac. To get this private key, you need to open your keychain access program and find relevant private ket and take backup by right click on it and click on Export and follow on screen instructions.

STEP 6: Add App Id

Once you have completed with creating and installing certificate, you need to create application id for your unique iphone app. For this, click on App IDs from left navigation on apple iOS Provisioning Portal. Doing this will open screen as shown below.

Create Application IdSTEP 7: Now click on New App ID button. This will ask you for “Description” and unique “Bundle Identifier” as shown in below image.

New Application Identifier

STEP 8: Now provide Description to identify your app id. Write Bundle Identifier as reverse domain name format like com.macymind.myappname. Click on Submit will generate new app id for you.

STEP 9: Now its time to create provisioning profile. From left navigation of Provisioning Portal, Click on Provisioning link. This will show you list of all profiles for particular type as Development or Distribution. Click on New Profile on this screen and follow on screen instructions to create new provisioning profile. Now download this newly created Provisioning Profile on your mac. Now for installing this provisioning profile to your xCode, drag and drop this file on xCode icon on your dock.

Let me know if you have any problem or suggestion for this article.

 

How to Generate Certificate Signing Request (CSR)

May 20th, 2011 No comments

Here are steps to generate certificate signing request (CSR).

STEP 1: Open Keychain Access application on your MAC system.

STEP 2: Now from KeyChain Access menu choose Certificate Assistant > Request a Certificate From a Certificate Authority… as shown in below image.

Create Certificate Signing Request

 

STEP 3: STEP 2 will open form dialog as shown in below image. Provide “User Email Address” and “Common Name”. Select “Save to disk” option and click on Continue button.

NOTE: If you are using CSR for creating certificate on apple site then also select “Let me specify key pair information” and provide 2048 as key size when asked.

Create Certificate Signing Request

STEP 4: Once you complete STEP 3, it will ask you to specify destination and name of resulting CSR file. Give name and specify destination for CSR file. I used my desktop as destination and name as “CetificateSigningRequest.certSigningRequest” as shown in below image.

 

Create Certificate Signing Request

 

STEP 5: STEP 4 will save CSR on your specified destination. Below image show a confirmation message for successful saving of CSR file.

Create Certificate Signing RequestNow we have generated CSR file. You can use it for creating Certificate for Apple Developer Site and also for Push Notification.

Please feel free to write comment if you have any doubt.

Apple Push Notification Server is not working

May 13th, 2011 No comments

Friends,

Today I noticed that, apple’s push notification server is not working.

I have tried to send push message but it was not able to connect to push notification gateway server.

Then I tried to ping on both production and development push gateway of apple, but it was failed.

Is there anybody facing same issue?
Anyone has solution for this?

 

UPDATE

This is issue with my hosting server. My Server was blocking out bound socket connection on port 2195 which is port used by apple push gateway server. So finally I have resolved this issue.

In built web browser for native iPhone app

May 6th, 2011 No comments

Hello Friends,

Today I am going to provide you with steps on how to create in built web browser for iPhone apps. Easy 6 step procedure.

Step 1: Create new project from xCode File->New Project. Choose “View-based Application” and give a name as “InAppBrowser”.

New Project

 

Step 2: Now xCode will create all minimum required files for you. Open “InAppBrowserViewController.xib” file from left panel and add one textfield to enter url. Add one button next to added text field and give it title as “Go”. So we will code on tap of this button to load url in browser. Now add UIWebView to this view as shown in below image.

Browser ViewStep 3: Now open “InAppBrowserViewController.h” and add below code to it.


@interface InAppBrowserViewController : UIViewController
{
IBOutlet UITextField *txtUrl;
IBOutlet UIWebView *webView;
}
- (IBAction)onGo:(id)sender;
@end

Step 4: Now assign this newly created outlets to relevant textfield and webview and action to UIButton(Go) Touch Up Inside Event in Interface builder.

Step 5: Now add method implementation of onGo in “InAppBrowserViewController.m” file. Use below code for that.


- (IBAction)onGo:(id)sender
{
NSURL *url = [NSURL URLWithString:txtUrl.text];
[webView loadRequest:[NSURLRequest requestWithURL:url]];
[txtUrl resignFirstResponder];
}

Step 6: Now build and run your app. Enter http://google.com in url textfield and tap on “Go” button. This will open Google in webview. See below screenshot for final output.

That’s it! We are done now. If you want to download code then click here.