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 11 or higher.
  • 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

  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-sdk7.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-sdk7.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. 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 ~ 60 MB, and it adds ~ 1.5 MB to the app downloadable size.

The SDK binary includes slices for x86_64, 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 slice (x86_64) 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:

let wasShown: Bool = GetSocialUIInvitesView().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:

Invites.send(nil, onChannel: InviteChannelIds.email, success: {
    print("Invitation via email was sent")
}, cancel: {
    print("Invitation via email was cancelled")
}, failure: { error in
    print("Failed to send invitation via email failed, error: \(error)")
})

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.

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:

GetSocial.addOnInitializedListener {
    // GetSocial is ready to be used
}

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?

😀 🙁