Friday, July 29, 2011

ICloud APIs



iCloud storage APIs allow IOS application developers to store documents and other data to a central location so users can view or edit from any device without having to sync or transfer files.

There are two ways that applications can take advantage of iCloud storage:
  • Document Storage – Enabling storage and sharing of information in document form.
  • Key-Value Data Storage – Enabling storage and sharing small amounts of data.
Most applications will use iCloud document storage to share documents, which is a feature that users think of when they think of cloud storage. Users care about whether photos, videos, and documents are accessible across devices while the key-value data store is not something a user would never see.
Key-value storage will be used for small amounts of data such as storing application state, settings, and other important information that delivers a better user experience. Although not as apparent to the end-user, key-value storage will be just as important as document storage.
All iCloud storage is managed centrally by the iCloud service, which handles coordination of documents and key-value stores. The iCloud service handles storage searches, change notifications, version control, conflicts, and security for applications that integrate with a user’s iCloud storage account.
Neither document storage or key-value storage in the cloud are anything new. But when it is implemented as part of the IOS platform, it becomes much bigger. Apple is solving everyday problems users face when using their smart phones, by storing data centrally in the cloud.
ICloud APIs will enable developers to build rich applications on the IOS platform, and continue to grow IOS market share.

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