Getting Started with GetSocial iOS SDK

Welcome to Getting Started section of GetSocial documentation. Here you’ll find guides that describe how to accomplish a specific task with code samples you can re-use in your app.

System Requirements

To use GetSocial SDK your execution and development environment should match following requirements:

  • Xcode 8 or above
  • iOS 8 or higher

Creating a GetSocial Account

To start using GetSocial, you have to create a free account and login to GetSocial Dashboard. Dashboard provides a web interface to manage all GetSocial services.

  1. Login to GetSocial Dashboard.
  2. Open “Add new app” wizard.
  3. Fill in App name on “Step 1”, copy GetSocial App Id if needed on “Step 2”.
  4. Enable iOS platform on the “Step 3”.

    Create new app on GetSocial Dashboard

  5. Fill in Bundle ID and Team ID and optionally App Store ID fields:

    Bundle ID is a part of the iOS App ID. You can find bundle identifier in the Xcode project → General Settings → Identity → Bundle Identifier.

    Team ID is a unique 10-character string generated by Apple that’s assigned to your team. You can find your Team ID using your Apple developer account → Membership.

    App Store ID number can be found in the iTunes store URL as the string of numbers directly after id. For Example, in https://itunes.apple.com/us/app/yourapp/id284709449 the ID is: 284709449.

Enable Platforms from the App Settings

After closing wizard, you can always enable more platforms or edit settings in the “App settings” section of the Dashboard.

Adding GetSocial to Your App

The easiest and recommended way to integrate GetSocial into your iOS app is to use GetSocial iOS Installer Script. The script automatically fetches configuration from GetSocial Dashboard and do the changes on your Xcode project.

To add the script to your iOS project:

  1. Download and unzip GetSocial iOS Installer.
  2. Copy the unzipped getsocial.sh script to the Xcode project root folder, so you can add it to source control.
  3. In your Xcode project go to Project Settings → select target you want to modify → Build Phases tab.
  4. Create new or use existing Run Script phase → move it before Compile Sources phase.
  5. Add getsocial.sh script to the Run Script build phase:

    1
    ./getsocial.sh --app-id="your-getsocial-app-id"
    
  6. Resulting Xcode configuration should look like this:

    Xcode Script configuration

  7. Build your project.

GetSocial Installer script supports multiple configuration parameters, check the iOS Installer Script Reference for the full list of supported parameters.

Installer Script is Safe to Use

The script creates a backup of your project.pbxproj file every time it is executed. If something goes wrong, you can always roll back to the previous version.
We suggest adding .backup files under .xcodeproj to ignore list to keep your version control history clean.

Manual Integration Guide

If you prefer doing all modifications to the project manually, check the iOS Manual Integration Guide.

GetSocial SDK Size

You might be wondering why the GetSocial.framework folder is over 150 MB large. This can be irritating at first, especially considering that Apple only allows downloading apps over cellular data if they are smaller than 150 MB. However, this is not the size that your users will get.

The SDK binary includes slices for i386, x64, armv7, and arm64. For armv7 and arm64, Bitcode is included as well, which results in six different slices. Each slice is a complete copy of the SDK, and only one slice is required for your users. Also, during integration a script runs that ensures that the Simulator slices (i386, x64) are stripped away from our SDK, resulting in a size reduction of about 30%.

In the end, GetSocial SDK adds around 6 MB to the application downloadable size.

Start Using GetSocial

If the previous steps were executed properly at this point, you have to be able to start using GetSocial. Let’s try to send a GetSocial Smart Invite via Email.

To run the test, add the code below to any button callback:

1
2
3
4
5
6
7
[GetSocial sendInviteWithChannelId:GetSocial_InviteChannelPluginId_Email success:^{
    NSLog(@"Invitation via EMAIL was sent");
} cancel:^{
    NSLog(@"Invitation via EMAIL was cancelled");
} failure:^(NSError * _Nonnull error) {
    NSLog(@"Invitation via EMAIL failed, error: %@", error.localizedDescription);
}];

After calling this method email client will be opened:

GetSocial Smart Invite over Email

Note about Simulator

Try this example on the device. On the simulator failure block will be invoked, as email client is not configured.

SDK Initialization

GetSocial SDK is auto-initialized, just provide a GetSocial App Id as a parameter to the iOS Installer Script and we will do the magic.

Manual Initialization

If you want to initialize GetSocial SDK manually, check the Manual Initialization Guide.

Most of GetSocial APIs require initialized SDK. You can check SDK initialization state in sync or async way.

1
2
3
if ([GetSocial isInitialized]) {
    // use GetSocial
}

If you want to be notified about initialization complete, you can set an action, that will be invoked when SDK gets initialized or invoked immediately if it is already initialized:

1
2
3
[GetSocial executeWhenInitialized:^() {
    // GetSocial is ready to be used
}];

It can be useful when you want to use GetSocial on application start, but you can not be sure is it ready for use, for example, you want to retrieve referral data on application start:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
@implementation MainViewController
...
- (void)viewDidLoad {
    [super viewDidLoad];
    ...
    [GetSocial executeWhenInitialized:^() {
        [GetSocial referralDataWithSuccess:... failure:...];
    }];
    ...
}
...
@end

GetSocial UI

GetSocial UI library contains easy to customize views for all GetSocial features.

To start using GetSocial UI, create and show any of provided views, e.g. code below will create and show GetSocial Smart Invites view:

1
2
bool wasShown = [[GetSocialUI createInvitesView] show];
NSLog(@"GetSocial Smart Invites UI was shown %d", wasShown);

After invoking code above, GetSocial Smart Invites view will be shown:

GetSocial Smart Invites View

Note

The list of Smart Invites Channels in the view above will contain all social apps that are enabled on the GetSocial Dashboard and installed on the device.

Next Steps

Well-done! GetSocial SDK is now set up and ready to rock, check what you can do next:

Give us your feedback! Was this article helpful?

πŸ˜€ πŸ™