CocoaPods trunk is moving to be read-only. Read more on the blog, there are 17 months to go.
TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | Custom |
ReleasedLast Release | Nov 2017 |
SwiftSwift Version | 3.2 |
Maintained by Gramercy.
Depends on: | |
FBSDKCoreKit | = 4.26 |
FBSDKShareKit | = 4.26 |
FBSDKMessengerShareKit | = 1.3.2 |
Branch | = 0.18.8 |
Alamofire | = 4.5 |
Kingfisher | = 4.3.1 |
Locksmith | = 3.0.0 |
SwiftyJSON | = 4.0.0-alpha.1 |
ReachabilitySwift | = 3 |
SwiftHEXColors | = 1.1.0 |
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.15'
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.
.plist
file and select Open As -> Source Code.</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>
Import the SDK with
import GramercySDK
@import GramercySDK;
After importing, include this in your AppDelegate.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
}
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;
}
After initializing and starting the SDK, you can identify your users for referral attribution. Our recommendation for when and how often you should call identify is as follows:
let visitor: GRVisitor = GRVisitor(id:"REFERRED_USER_ID")
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
}
After identifying your users, you can instantiate and present the referral view controller from any other view controller
Gramercy.presentReferralsViewController()
// Or alternatively
let controller = Gramercy.instantiateReferralsViewController()
self.present(controller!, animated: true, completion: nil)
[Gramercy presentReferralsViewController];
Or alternatively
ReferralsViewController *viewController = [Gramercy instantiateReferralsViewController];
[self showViewController:viewController sender:self];