SDK初始化与配置
1. 在AppDelegate文件中配置初始化代码
导入头文件 #import <NGALoginSDK/NGALoginSDK.h> , 在项目中添加GoogleService-Info.plist文件
在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 方法中配置如下代码:
//启动FB, 在集成登录SDK的情况下, 此行代码跳过
//[[NGAAppEvents sharedInstance] fbApplication:application didFinishLaunchingWithOptions:launchOptions];
//配置Google Firebase, 需要在项目中添加GoogleService-Info.plist文件
[[NGAAppEvents sharedInstance] gaConfigure];
//配置启动配置的相关参数
NGAConfig* config = NGAConfig.new;
config.appsFlyerDevKey = @"bLmWavMFiwAywrxcewWnfQ8g"; //AppsFlyer的key
config.appleAppID = @"1268557479"; //Apple的Appid
config.appKey = @"gs-99"; //游戏id
config.enableAddIDFA = YES; //开启IDFA追踪
[[NGAAppEvents sharedInstance] startWithConfig:config];配置如下代码:
-(void)applicationDidBecomeActive:(UIApplication *)application{
[[NGAAppEvents sharedInstance] afTrackAppLaunch];
[[NGAAppEvents sharedInstance] fbActivateApp];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *_Nullable))restorationHandler{
[[NGAAppEvents sharedInstance] afContinueUserActivity:userActivity restorationHandler:restorationHandler];
return YES;
}实现openURL方法
2. Info.plist文件配置
配置登录SDK后, 此步骤跳过
SourceCode下为:
至此, SDK初始化完成.
Last updated