Getting Started¶
The Getting Started guide shows you how to setup and launch Referral Campaign as quickly as possible with Talkable iOS SDK.
Requirements¶
Talkable SDK supports iOS 9.0 and later
Add the -ObjC option to Other Linker Flags in the Build Settings tab
Step 1: Installation¶
Talkable SDK could be integrated using Swift Package Manager, CocoaPods or manually as a Binary Framework.
Swift Package Manager¶
Installing from Xcode:
Add a package by selecting File → Add Packages… in Xcode’s menu bar.
Search for the Talkable SDK using the repo’s URL:
https://github.com/talkable/ios-sdk.git
Set the Dependency Rule to be Up to Next Major Version and specify 1.5.1 as the lower bound (default option).
Select Add Package and choose TakableSDK package.
Alternatively, you can add Talkable SDK directly to a Package.swift manifest:
dependencies: [ .package(url: "https://github.com/talkable/ios-sdk.git", .upToNextMajor(from: "1.5.1")) ]
CocoaPods¶
To integrate Talkable SDK into your Xcode project using CocoaPods, specify it in your Podfile:
pod 'TalkableSDK', '~> 1.5.1'
Binary Framework¶
To integrate the SDK manually as a Binary Framework, please follow next intructions:
Download the latest version of Talkable SDK.
Navigate to your project settings by clicking on it in the project navigator.
Make sure that your target is selected and General tab is open.
Go to Frameworks, Libraries, and Embedded Content section and add the SDK by clicking “+” button → Add Other… → Add Files… and locate the downloaded SDK.
For Embed setting of the added framework select Do Not Embed option.
Make sure that Talkable SDK is linked with your project in Link Binary With Libraries section under Build Phases tab with Required Status. It should already be included by default after following the steps above, however in case it’s not – click on the “+” button and add it.
Step 2: Configuration¶
Initialize Talkable SDK in your application:didFinishLaunchingWithOptions: method, like so:
#import <TalkableSDK/Talkable.h> // ... [[Talkable manager] setApiKey:@"YOUR_TALKABLE_PUBLIC_API_KEY" andSiteId:@"YOUR_SITE_ID"];Note
You can locate your credentials inside Talkable site:
Select site and go to Dashboard → Settings → Site Settings → Integrations. Find API integration section and there you will see your API Keys and Site ID. Use only the Public API Key in your application submitted to the App Store.
Register URL scheme for Talkable:
Defines tkbl-YOUR-SITE-ID as URL Scheme in your Info.plist file:
<key>CFBundleURLTypes</key> <array> <dict> <key>CFBundleURLSchemes</key> <array> <string>tkbl-YOUR-SITE-ID</string> </array> </dict> </array>Add tkbl-YOUR-SITE-ID scheme to the list of schemes that are queried within application. Also add fb-messenger, fbauth2, whatsapp schemes if you are going to utilize these sharing channels:
<key>LSApplicationQueriesSchemes</key> <array> <string>tkbl-YOUR-SITE-ID</string> <string>fb-messenger</string> <string>fbauth2</string> <string>whatsapp</string> </array>Note
Please replace YOUR-SITE-ID with your actual Site ID. Make sure to keep tkbl- prefix in the <string> value. For example, if your site ID is my-store, the correct <string> value is tkbl-my-store.
Add following lines to application:openURL:options:
#import <TalkableSDK/Talkable.h> // ... [[Talkable manager] handleOpenURL:url];
Your environment is all set up! Now you can integrate the Talkable campaign piece.