Cosmose iOS SDK allows app partners to easily integrate core Cosmose functionality into iOS apps.
Add CosmoseSDK
dependency to your Podfile
:
Here's an example:
pod 'CosmoseSDK/Core', :git => 'https://github.com/Cosmose/cosmose-ios-sdk.git'
Cosmose SDK require few lines of configuration in your app's main Info.plist
file. Follow steps below to complete integration:
- Create
CosmoseAppID
key and assign a unique Cosmose App Partner ID received from Cosmose Team
After all these operations your app's main Info.plist
file should look like the one below.
In each file you refer to Cosmose SDK methods add header import directive:
#import <CosmoseSDK/CosmoseSDK.h>
Alternatively you may add this line to your app's prefix header file -Prefix.pch
There are a few entry points in which Cosmose SDK methods should be invoked. Please follow the instruction below to complete the integration process. In terms of the meaning of individual SDK calls, please refer to appledoc
documentation in CosmoseSDK.h
main header file:
- In app's
UIApplicationDelegate
methodapplication:didFinishLaunchingWithOptions:
call[CosmoseSDK start]
- There is no step 2, you're all set!
We assume here, that your app integrating Facebook Login is based on a official Facebook iOS SDK.
- After the successfull login or once the app detect that user is already logged in call:
[CosmoseSDK updateFbSession:]
, and pass an instance ofFBSession
that represents the active session (e.g.,[FBSession activeSession]
).
Please refer to [CosmoseSDK updateFbDataWithToken:userInfo:]
method (more info in the appledoc
) if your app is based on incompatible version of Facebook SDK or your app is not based on Facebook SDK at all but still supports Facebook Sign In.
If your app supports Google SignIn, you may use [CosmoseSDK updateGoogleSignIn:]
method to provide basic user data to Cosmose SDK. If ths sign-in process is compatible with the instructions from here: https://developers.google.com/+/mobile/ios/sign-in then you may add a call to [CosmoseSDK updateGoogleSignIn:]
directly to your apps' GPPSignInDelegate
. Otherwise please refer to Cosmose SDK appledoc
and method [CosmoseSDK updateGoogleSignInDataWithEmail:userID]
in order to pass basic user info to Cosmose SDK.
If your app does not incorporate Facebook or Google Sign In but still requires user to type in his or her email address (for alternative sign in process or regardless of the reason) you may provide that information to Cosmose SDK. Once user type in an email address within your app you should call [CosmoseSDK updateUserEmail:]
passing that email address. Please refer to the appledoc
for more information about this method.
If you're using CosmoseSDK/NoIDFA
version of SDK (see section IDFA for the list of options) you may still pass dvertising identifier to be used across different apps for ad targeting. In that case call [CosmoseSDK updateIDFA:]
in order to pass users' ad identifier to Cosmose SDK. Please use following line of code after initializing Cosmose SDK:
[CosmoseSDK updateIDFA:[[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString]]
Since there is a lot happening regarding usage if Apple's IDFA lately (see posts about app store rejections here: http://tcrn.ch/1bVH1Kz and more recent posts about changes that allow IDFA usage even when your app doesn't display ads: http://tcrn.ch/P03XTG), we've decided to provide two version: one that utilize IDFA and one that does not.
During the app submission process under IDFA section (This app uses the Advertising Identifier to (select all that apply)) select option Attribute an action taken within this app to a previously served advertisment.
In case you encounter any problems with app submission, it is enough to change CosmoseSDK/Core
Pod version in your Podfile
to: CosmoseSDK/NoIDFA
and thus your app will no longer
Under CosmoseSDKDemo dir you will find a source code of a sample app utilizing Cosmose SDK. CosmoseSDKDemo app consist of a single view with Facebook Login button. Please refer to this project to see how to integrate Cosmose SDK with an iOS app with Facebook Login. This sample application is based on Facebook Login app tutorial that can be found here: https://developers.facebook.com/docs/ios/login-tutorial/