AddThis for iOS Quick Start Guide
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
and ATResources.bundle
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.
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
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"];
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
We will be releasing new iOS analytics reports soon, and highly recommend configuring your apps to collect data in preparation for these new reports. 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
[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!