Support

AddThis for iOS Quick Start Guide

Quickstart Guide | Documentation

This guide will help you get up and running quickly with the iOS SDK. Check out the full documentation for all the details.

Step 1: Download


Step 2: Check out the Demo

The SDK includes a basic demo application, AddThisDemo, which illustrates the various common ways the library can be used to add sharing to an application. Take a look, this will give you the basic idea of how the library works. When you've got the concept, continue on to add sharing to your own application.

 

Step 3: Install AddThis into your Project

Drag AddThis.h, libAddThis.a, ATResources.bundle and ThirdPartyLibs folder into your new iOS project. Make sure that the "Copy items into destination group's folder (if needed)" is checked; this will add the library into your project. Also add Resources/FacebookSDKResources.bundle and Versions/A/DeprecatedHeaders/ to the project from ThirdPartyLibs/FBConnect/FacebookSDK/FacebookSDK.framework/.

The iOS library also needs a few frameworks to function properly. Make sure your project includes them, you can add any that are needed by right-clicking the 'Frameworks' group inside the project, and selecting 'Add -> Existing Frameworks'. You will need to make sure the following frameworks are available:

• Security.framework
• CoreData.framework
• SystemConfiguration.framework
• MessageUI.framework
• Twitter.framework (for iOS SDK 5.0 or above, give this as 'optional')
• Social.framework (for iOS SDK 6.0 or above)

 

Step 4: Optionally Configure Facebook and Twitter API Keys

If you want to use Facebook and Twitter native sharing integrations, configure the library to do so, and specify the API keys it should use. If you just want to use the plain browser-based sharing to these services, you don't need to take this step.

[AddThisSDK setFacebookAuthentication:ATFacebookAuthenticationTypeFBConnect];
[AddThisSDKsetFacebookAPIKey:@"yourkey"];

[AddThisSDK setTwitterAuthentication:ATTwitterAuthenticationTypeOAuth];
[AddThisSDK setTwitterConsumerKey:@"yourconsumerkey"];
[AddThisSDK setTwitterConsumerSecret:@"yourconsumersecret"];
[AddThisSDK setTwitterCallBackURL:@"yourcallbackurl"];

Add your facebook key as a new entry in the application plist with key "FacebookAppID" and also enter a new URL scheme in the plist as "fb"

Now edit your appdelegate class and add the following method :

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {

    return [FBSession.activeSession handleOpenURL:url]; 

}

For more information on this process, see the full documentation.

 

Step 5: Add a Sharing Button or Menu

There are quite a few different ways to add basic sharing features into your application, all outlined in the documentation. To get started, the simplest method is just to add an AddThis button to your app, or to render the AddThis sharing menu from your own UI trigger.

Place an AddThis button in your app

Include the header file AddThisSDK.h in the view controller class where you need to place the button. To place the button in a view:

[AddThisSDK showAddThisButtonInView:self.view
    withFrame:CGRectMake(75, 50, 150, 50)
    forURL:@"http://www.example.com"
    withTitle:@"Check this out"
    description:@"Lorem ipsum dolor sit amet, consectetuer adipisci"];

Show the sharing menu from your own UI callback

[AddThisSDK 
    showAddThisMenuForURL:@"http://www.example.com"
    withTitle:@"Check this out"
    description:@"Lorem ipsum dolor sit amet, consectetuer adipisci"];
 

Step 6: Set Up Analytics

AddThis provides real time analytics on how your content is being shared on the social web. The SDK measures your content's impact across social networks and information about your audience. For more details please check our analytics features page.

To set up analytics for your app, just follow these steps:

  • If you haven't already, Register a new account. Already a member? Sign In
  • At the end of the registration process, when asked about getting analytics for a 3rd party app, select Get One Now
  • You'll receive a Profile ID that you will use to configure your app; make a note of it
  • Click Continue, then go to Settings and select Profiles
  • Select My Profile, or the profile to which you'd like to associate your app, and scroll down to Applications
  • Select Register a New Application, give your app a name to identify it in analytics reports, and click Register
Your app is now registered and has been assigned an Application ID. You can configure your app with your Profile ID and Application ID to enable analytics:
  • [AddThisSDK setAddThisPubId:@"YOUR-PROFILE-ID"];
  • [AddThisSDK setAddThisApplicationId:@"YOUR-APPLICATION-ID"];

 

 

Step 7: Explore and Let Us Know

The API is highly configurable -- take a look at everything it can do, and let us know what you think!

Last Updated: Oct 18, 2013 03:31PM EDT
help@addthis.com
http://assets02.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete