Thursday, July 28, 2011

How to renew iPhone development certificate

First, in the iPhone provisioning Portal, you'll see that your certificate is expired:


The only available option is to request for a new certificate. You hit Request certificate.


The next thing is to create a Certificate Signing Request (CSR). Two options are possible: if you kept the original CSR or create a new one from scratch. In my case, I kept the original CSR file from last year certificate request so I can upload it (and save time!).

Then you hit Submit at the bottom right of the form. After that, the request for the new certificate is pending:
Then an email comes from Apple asking you to approve the request:

Back to the iPhone Provisioning Portal, the request has to be approved:
After a few minutes, hit refresh on the browser to see the new status:

The new certificate needs to be downloaded and imported in your keychain. Simply double-click the downloaded certificate. It will import in the Keychain:


The last part which I'll summarize here is to update all the provisioning profiles that were associated (or signed with the old (and expired) certificate. This is done the the Provisioning portion of the iPhone Provisioning Portal, clicking Edit then Modify. After, you make sure the certificate is selected then you click Submit. This has to be done for every associated profiles. Once you get the new profiles, download them and import them in Xcode Organizer then sync with the development devices.

Monday, July 25, 2011

Implement UIWebView With a Transparent background in iPhone


Step 1: Create a Window base application using template. Give the name of the application “WebView”.
Step 2: Xcode automatically creates the directory structure and adds essential frameworks to it. You can explore the directory structure to check out the content of the directory.

Step 3: We need to add the resource file called as “Background.png” into the resource folder. Select resources and add files existing sources and select theBackground.png.
Step 4: Now we’ll add view controller class to the project. Choose New file -> Select cocoa touch classes group and then select UIViewController subclass. Give the name WebViewController.
Step 5: We create a WebView.html from where the data will be display.

Step 6: In the AppDelegate.h file, we define UINavigationController. Make the following changes in the AppDelegate.h file .
@interface WebViewAppDelegate : NSObject  {
UIWindow *window;
UINavigationController *myNavController;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *myNavController;
Step 7: In the AppDelegate.m file , make the following changes :
- (void)applicationDidFinishLaunching:(UIApplication *)application {
[window addSubview:myNavController.view];
[window makeKeyAndVisible];
}
Step 8: We added UIWebView in the WebViewController.h file, so make the following changes:
@interface WebViewController : UIViewController {
UIWebView *webView;
}
@property (nonatomic, retain) IBOutlet UIWebView *webView;
Step 9: Double click the MainWindow.xib file and open it to the Interface Builder. Drag Navigation Controller from the library and place it in the MainWindow. Once again open library, and drag view, place it on the window. Drag ImageView from the library and place in to the View window.Single click View window and bring up attribute inspector select “Backgroung.png”. Now drag WebView from the library and place it to the  View Window , drag Navigation Item from the library and place it top of the View Window. Double click it and change the name into WebView. Now select Navigation Controller and bring up connection inspector ViewController to the View window and select  ”Web View”.
Step 10: Now make the following changes in the WebViewController.m file.
- (void)viewDidLoad
{
NSString *path = [[NSBundle mainBundle]  pathForResource:@"WebView"ofType:@"html"];
NSFileHandle *readHandle = [NSFileHandle   fileHandleForReadingAtPath:path];
NSString *htmlString = [[NSString alloc] initWithData:
[readHandle readDataToEndOfFile]   encoding:NSUTF8StringEncoding];
webView.opaque = NO;
webView.backgroundColor = [UIColor clearColor];
[self.webView loadHTMLString:htmlString baseURL:nil];
[htmlString release];
}
Step 11: Compile and run the application in the Simulator.
You can Download SourceCode from here WebView