MAKE YOUR APP SOCIAL
Engage users with our turnkey social layer
Before start using AppFriends, you need to create an application on the dashboard Users in the same application can talk to each other and you only need one application for all the platforms you want to support.
To integrate AppFriends iOS SDK to your Xcode iOS project, add this line in your Podfile
pod 'AppFriendsUI', '~> 2.0.4'
pod 'AppFriendsCore', '~> 2.0.2'
Also, add use_frameworks!
to the top of file. eg.
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/Hacknocraft/hacknocraft-cocoapods-spec.git'
use_frameworks!
...
You might need to run pod repo update
after this step before calling pod install
To see an sample app of how to use AppFriendsUI, please checkout our repo:
If you don't want any of the UI components we provide, you can directly interact with the platform API, and we have a core framework to use for that purpose:
pod 'AppFriendsCore', '~> 2.0.1'
The next step is import the headers.
#import AppFriendsCore
#import AppFriendsUI
#import <AppFriendsCore/AppFriendsCore-Swift.h>
#import <AppFriendsUI/AppFriendsUI-Swift.h>
Now, we can use the AppFriends key and secret to initialize the SDK. Key and secret can be found in your AppFriends dashboard. If you are using the AppFriendsUI
SDK, you can initialize by:
AppFriendsUI.sharedInstance.initialize("[appfriends key]", secret: "[appfriends secret]") { (success, error) in
if !success {
NSLog("AppFriends initialization error:\(error?.localizedDescription)")
}else {
// initialization is successful
}
}
import AppFriendsCore
import AppFriendsUI
Skip this step if you are using the AppFriendsUI
SDK. If you are using AppFriendsCore
SDK, you can initialize by:
HCSDKCore.sharedInstance.initialize(key: "[appfriends key]", secret: "[appfriends secret]") { (success, error) in
if !success {
NSLog("AppFriends initialization error:\(error?.localizedDescription)")
}else {
// initialization is successful
}
}
import AppFriendsCore
import AppFriendsUI
After initialization, you want to login your user to AppFriends, so he can start chatting with other users. Please see sessions for detail