Latest 1.0.9
Homepage https://github.com/gramercyio/ios-sdk
License Proprietary Proprietary
Platforms ios 8.0
Dependencies FBSDKCoreKit, FBSDKShareKit, FBSDKMessengerShareKit, Branch, Alamofire, Kingfisher, Locksmith, SwiftyJSON, SwiftHEXColors, ReachabilitySwift
Authors

Installation

Cocoapods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate GramercySDK into your Xcode project using Cocoapods, specify it to a target in your Podfile:

platform :ios, '9.0'

target 'testapp' do

  use_frameworks!
  pod 'GramercySDK', '1.0.10'

end

Then, run the following command:

$ pod install

You should then open the {Project}.xcworkspace instead of the {Project}.xcodeproj after you installed anything from CocoaPods.

Configuration

  1. Create a new Facebook App ID here: https://developers.facebook.com/
  2. In Xcode, secondary-click your project’s .plist file and select Open As -> Source Code.
  3. Insert the following XML snippet into the body of your file just before the final </dict> element.
<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>fb{{ YOUR FACEBOOK APP ID }}</string>
            </array>
        </dict>
    </array>
    <key>FacebookAppID</key>
    <string>{{ YOUR FACEBOOK APP ID }}</string>
    <key>FacebookDisplayName</key>
    <string>{{ YOUR APP NAME }}</string>
    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fb-messenger</string>
        <string>whatsapp</string>
        <string>fbapi</string>
        <string>fb-messenger-api</string>
        <string>fbauth2</string>
        <string>fbshareextension</string>
    </array>

NOTE: make sure to include your facebook app id in the .plist!

Usage

basics

Import the SDK with

Swift

import GramercySDK

Objective-C

@import GramercySDK;

Tracking application installs

After importing, include this in your AppDelegate.swift

Swift:


    let gramercyCampaign:String = "YOUR_CAMPAIGN_ID"
    let gramercyKey:String = "YOUR_API_KEY"

    func application(_ application: UIApplication,
                     didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

        Gramercy.start(withLaunchOptions: launchOptions,
                       key: gramercyKey,
                       campaign: gramercyCampaign) { (success, error) in
          // do something after a user is attributed a referral
        }

        return true
    }

Objective-C

    NSString *key = @"YOUR_CAMPAIGN_ID";
    NSString *campaign = @"YOUR_API_KEY";

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [Gramercy startWithLaunchOptions:launchOptions
                                 key:key
                            campaign:campaign
                            callback:^(BOOL success, NSError * _Nullable error) {
                                // do something after a user is attributed a referral
                            }];

    return YES;
}

Identifying users

After initializing and starting the SDK, you can identify your users for referral attribution.

Swift

        let visitor: GRVisitor = GRVisitor(id:"referred_ios_user")
        visitor.email = "[email protected]"
        visitor.firstName = "John"
        visitor.lastName = "Doe"
        visitor.phone = "17778889999"

        Gramercy.identifyVisitor(visitor:visitor) { (success, error) in
           // do something after the user is identified
        }

Summoning the referral modal

After identifying your users, you can instantiate and present the referral view controller from any other view controller

Swift


Gramercy.presentReferralsViewController()

// Or alternatively
let controller = Gramercy.instantiateReferralsViewController()
self.present(controller!, animated: true, completion: nil)

Objective-C


[Gramercy presentReferralsViewController];

// Or alternatively
ReferralsViewController *viewController = [Gramercy instantiateReferralsViewController];
[self showViewController:viewController sender:self];

Latest podspec

{
    "name": "GramercySDK",
    "version": "1.0.9",
    "summary": "Gramercy.io iOS SDK",
    "homepage": "https://github.com/gramercyio/ios-sdk",
    "authors": {
        "Gramercy.io": "[email protected]"
    },
    "license": {
        "type": "Proprietary",
        "text": "                            Proprietaryn"
    },
    "social_media_url": "http://twitter.com/gramercyio",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/gramercyio/ios-sdk.git",
        "tag": "1.0.9"
    },
    "dependencies": {
        "FBSDKCoreKit": [
            "~> 4.23"
        ],
        "FBSDKShareKit": [
            "~> 4.24"
        ],
        "FBSDKMessengerShareKit": [
            "~> 1.3"
        ],
        "Branch": [
            "0.15.3"
        ],
        "Alamofire": [
            "4.5.0"
        ],
        "Kingfisher": [
            "3.10.3"
        ],
        "Locksmith": [
            "3.0.0"
        ],
        "SwiftyJSON": [
            "3.1.4"
        ],
        "SwiftHEXColors": [
            "1.1.0"
        ],
        "ReachabilitySwift": [
            "3"
        ]
    },
    "ios": {
        "vendored_frameworks": "*GramercySDK.framework"
    },
    "pushed_with_swift_version": "3.1"
}

Pin It on Pinterest

Share This