Skip to content

Getting Started with GetSocial iOS SDK

Welcome to the Getting Started section of the GetSocial documentation. Here you will 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 the following requirements:

  • Xcode 10.2 or above (if you need to use older Xcode version, please use SDK version v6.28.x)
  • iOS 8 or higher

Not sure if GetSocial is going to work in your specific configuration? Feel free to reach us via Intercom or email.

Adding GetSocial to Your App

Create App on the Dashboard

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 and upload App icon image.
  4. Select iOS platform and Finish the wizard.

Configure GetSocial Installer Script

To start using GetSocial, you have to add and configure GetSocial installer script to your Xcode project. The script adds GetSocial frameworks to the project and configures app entitlements, plist files, and Xcode project settings.

Alternatively, you can add frameworks and modify all settings manually. Please follow the iOS manual integration guide for details.

To add GetSocial installer script:

  1. Download and unzip GetSocial iOS installer script.
  2. Open your Xcode project folder in Finder.
  3. Copy the unzipped getsocial.sh script to the Xcode project root folder, so you can add it to source control.
  4. In your Xcode project go to Project Settings → select target you want to modify → Build Phases tab.
  5. Create new Run Script phase with the content:

    "$PROJECT_DIR/getsocial.sh" --app-id="your-getsocial-app-id"
    

    Curious about what the script is doing?

    Check the GetSocial installer script reference to learn what exactly script is doing and how to configure behavior.

    You can find GetSocial App id in the App settings section on the GetSocial Dashboard:

    GetSocial App Id

  6. Move Run Script phase before the Compile Sources phase.

  7. If you are using CocoaPods, please add GetSocial SDK pods to your Podfile manually:

    pod "GetSocial/Core"
    pod "GetSocial/UI" # add this pod only if you plan to use GetSocial UI
    

    And run pod install to update dependencies.

    CocoaPods with Dynamic Frameworks

    GetSocial SDK shipped as dynamic frameworks. To make sure it properly works, add use_frameworks! to Podfile

  8. Resulting Xcode configuration should look like this:

    Xcode Script configuration

  9. If you are using Xcode 12.3, change Validate Workspace setting in Build Settings to YES.

  10. Build your project.

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

Project Backups

GetSocial installer 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.

Source Control Configuration

We suggest adding .backup files under .xcodeproj to ignore list to keep your version control history clean.

Enable Apple App Store on the Dashboard

Next step is to enable Apple App Store on the GetSocial Dashboard:

  1. On the App settings section → App information tab → enable Apple App Store.
  2. Fill in Bundle ID, Team ID and optionally App Store ID fields:

    Create new app on GetSocial Dashboard

    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.

Troubleshooting

Issue Solution
Build stops with Build canceled message Check if Run Script phase is before the Compile Sources build phase.

Got another problem? Our support team is here to help, just shoot us a message via the Intercom or email.

GetSocial SDK Size

GetSocial.framework size is ~ 36 MB, and it adds ~ 1.5 MB to the app downloadable size.

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%.

Start Using GetSocial

At this point, you should be able to start using GetSocial. Let’s try to send our first Smart Invite with and without GetSocial UI.

GetSocial UI

GetSocial UI library contains easy to customize views for all GetSocial features, e.g. code below will create and show GetSocial Smart Invites view:

```objc tab=”Objective-C”
BOOL wasShown = [[GetSocialUI createInvitesView] show];
NSLog(@”GetSocial Smart Invites UI was shown %d”, wasShown);

```swift tab="Swift"
let wasShown: Bool = GetSocialUI.createInvitesView().show()
print("GetSocial Smart Invites UI was shown \(wasShown)")

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

GetSocial Smart Invites View

Why there are only few apps?

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

GetSocial without UI

If you plan to build your own UI, you can remove GetSocial UI library from dependencies and use only GetSocial data layer. To run the test, add the code below to any button callback:

```objc tab=”Objective-C”
[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);
}];

```swift tab="Swift"
GetSocial.sendInvite(withChannelId: GetSocial_InviteChannelPluginId_Email, success: {
    print("Invitation via EMAIL was sent")
}, cancel: {
    print("Invitation via EMAIL was cancelled")
}, failure: { error in
    print("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 the 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 the SDK to be initialized. You can check the SDK initialization state synchronously or asynchronously.

```objc tab=”Objective-C”
if ([GetSocial isInitialized]) {
// use GetSocial
}

```swift tab="Swift"
if GetSocial.isInitialized() {
    // use GetSocial
}

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

```objc tab=”Objective-C”
[GetSocial executeWhenInitialized:^() {
// GetSocial is ready to be used
}];

```swift tab="Swift"
GetSocial.execute(whenInitialized: {
    // GetSocial is ready to be used
})

For instance, you can use executeWhenInitialized to ensure GetSocial SDK is initialized to get referral data on the application start:

```objc tab=”Objective-C”
@implementation MainViewController

- (void)viewDidLoad {
[super viewDidLoad];

[GetSocial executeWhenInitialized:^() {
[GetSocial referralDataWithSuccess:… failure:…];
}];

}

@end

```swift tab="Swift"
class ViewController: UIViewController {
    ...
    func viewDidLoad() {
        super.viewDidLoad()
        ...
        GetSocial.execute(whenInitialized: {
            GetSocial.referralData(success: {
                ...
            }, failure: { error in
                ...
            })
        })
        ...
    }
}

Using GetSocial in Swift

GetSocial iOS SDK is written in Objective-C, so to be able to use it in your Swift project you have to create a bridging header as described here: Using Swift with Cocoa and Objective-C.

Demo Application

To showcase all GetSocial SDK features, we have created a simple demo application. Explore it on the GitHub.

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?

😀 🙁