Initialize SDK basic data
If the previous steps are completed, then we can call the SDK method happily. However, before using the functions of the SDK, we must call the SDK initialization method. Detailed steps are as follows:
Initialize SDK basic data tutorial
A、Use SDK
- 1、Find the AppDelegate.m file in the project(Note: Due to the different game engines developed, the generated Xcode project will not find the file, for example, if Unity generates an Xcode project, the corresponding file is called `UnityAppController.mm`,faced with such diversified file names, we can globally find the `didFinishLaunchingWithOptions:
method in our project,吧、because the method name is fixed),After that, I usedAppDelegate.m` to tell the steps; - 2、Write
#import <Gamedreamer/Gamedreamer.h>inAppDelegate.mfile
B、 Initial SDK basic data
- Find
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptionsmethod inAppDelegate.m,then call the SDK'sProxy AttributesandInitialize methodswithin the method. - Proxy Attributes:
@property (nonatomic,assign) id<GamedreamerDelegate> delegate; - Initialize methods:1、
- (void)gamedreamerStartWithSuperView:(UIView *)superView andCompletion:(void (^)(NSDictionary *result, NSError *error))loadCallback; - 2、
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; - Note: The second method needs to be called after the callback callback.
- Sample code:
objective-c
[[GamedreamerManager shareInstance] application:application didFinishLaunchingWithOptions:launchOptions];
[[GamedreamerManager shareInstance] gamedreamerStartWithSuperView:nil andCompletion:^(NSDictionary *result, NSError *error){
}];
[GamedreamerManager shareInstance].delegate = self;