Thursday, 22 November 2012

Integrating Facebook and Twitter using Social Framework iOS 6

Lets checkout how to integrate and start sharing using Facebook and Twitter using Social Framework provided in iOS 6



























































































































































































































































Source code: Download


Launch iOS Application From Safari Using CustomURLScheme


If you want to take user back from Safari to your iOS Application, you can achieve it using custom url scheme.
Follow the steps:

1. Open -info.plist file and add

<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>myapplicationurl</string>
</array>
</dict>
</array>

2. Above code will register a custom url for your application.
3. You can also pass parameters (query string) to it:
myapplicationurl://
myapplicationurl://?key1=value1&amp;key2=value2
4. When this url is called from Safari iPhone SDK sends message to UIApplicationDelegate

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
 // You are back to your application.
 NSLog(@"Yeah!!! We are back to Application from Safari");
 return YES;
}

5. Above method in UIApplicationDelegate will be called and we are navigated to our Native iOS app from Safari.

This same technique is used by Facebook iOS sdk.
Special thanks to :
http://mobiledevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

First download source code from here: Download

After downloading run application and hit 'Open Safari' button it will take you to safari and will show you this page, now on this page hit below link 'Open Application from SAFARI' you are navigated back to application.

Open Application from SAFARI

Friday, 2 November 2012

Integrating Pinterest in iOS Application


Pinterest do not provide api's for integration yet.
So in order to achieve it we need to use UIWebView in iOS App.

Follow below steps:
1. Take a UIViewController containing two buttons, one UIWebView.
2. Generate HTML programatically and pass it to loadHTMLString in UIWebView.
3. On touchup-inside of first button, load html string which will open Pinterest in UIWebView.
4. Here pass your custom description and image url which you want to pin.
5. On touchup-inside of second button, close/hide the UIWebView.
















Download Code from here: PinterestiOSIntegration

Above link helped me out.