Interface Description
1.Before you begin
1.1 Software Version
It is recommended to use Xcode15 Target iOS 15.0 or later
1.2 SDK Installation
Get the SDK installation package provided by the operator
On the Target's General tab, select the plus sign under Embedded Binaries ➕ ->Add Other ->Select the framework file and click Import
Select Embed & Sign as the Embed method.
Introduce it in the file that needs to call the SDK interface: for example
OC:
#import <uluGameSDK/uluGameSDK.h>
swift:
import uluGameSDK
Added Push Notifications and Sign in with Apple to Signing & Capabilities
1.3 Packet out precautions
1、When using Xcode to build a package, do not check Manage Version and Build Number.
1.4 info.plist configuration
Tips: Some important parameters are the basis for the normal operation of the SDK, please configure them in advance. If the application needs to support multiple languages, the permission description text and app name need to be internationalized.
Fields | value |
---|---|
AppleAppID | Store ID, see the parameter table provided by the operation for details |
AppsFlyerDebugEnabled | 0 |
AppsFlyerDevKey | See the parameter table provided by the operator for details. |
NSAdvertisingAttributionReportEndpoint | https://appsflyer-skadnetwork.com/ |
Localized resources can be mixed | YES |
FacebookAppID | See the parameter table provided by the operator for details. |
FacebookClientToken | See the parameter table provided by the operator for details. |
FacebookDisplayName | See the parameter table provided by the operator for details. |
GoogleClientID | For details, see the parameter table provided by the operator (use the value of the CLIENT_ID field in the GoogleService-Info.plist file) |
Sandbox | NO-formal environment, YES-sandbox environment |
ULUGameID | Game ID provided by ULU, see the parameter table provided by the operator for details |
Privacy - Tracking Usage Description | Your data is used to personalize and provide better service. |
Privacy - Camera Usage Description | Please allow photo permissions to use game video and photo sharing features. |
Privacy - Photo Library Usage Description | Please allow photo permissions to use game video and photo sharing features. |
Some configuration fields in URL Types:
facebook:
identifier:Use com.ulugame.xxxxx.facebook, replace xxxxx with the English abbreviation of the game name
URL Schemes:The format is fb+FacebookAppID (example: fb1591466175xxxxxxx)
google:
identifier:Use com.ulugame.xxxxx.google, replace xxxxx with the English abbreviation of the game name
URL Schemes:Use the value of the REVERSED_CLIENT_ID field in the GoogleService-Info.plist file
Note:
1、The GoogleService-Info.plist file provided by the operator needs to be imported into the root directory of the project
2、uluGameSDK.framework and uluEventSDK.framework must be imported, and other SDK modules are based on your own business and needs.
2.Initialize SDK (required)
You need to start initialization in the - (BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions method in the AppDelegate file
2.1 Interface Definition
+ (ULManager * _Nullable) initWithGameID:(NSString *)gameID gameVersion:(NSString *)version
parameter | describe |
---|---|
gameID | GameId, please refer to the parameter table |
version | Game version number, you can fill in 1.0.0 |
2.2 Sample Code
#import <uluGameSDK/uluGameSDK.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ULManager initWithGameID:@"" gameVersion:@"1.0.0"];
BOOL success = [[ULManager shared] application:application didFinishLaunchingWithOptions:launchOptions];
BOOL other = ... (Other program startup parameters)
return success & other ;
}
Call SDK initialization
[ULManager shared].delegate = ...; // Set callback listener object
[ULManager initWithGameID:@"" gameVersion:@"1.0.0"];
3.Add life cycle interface (required)
Please call the lifecycle interface required by ULUSDK in the lifecycle interface in the AppDelegate file.
3.1 Sample Code
@implementation AppDelegate
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[ULManager shared] application:app openURL:url options:options];
BOOL other = ... (Other program logic)
return handled | other ;
}
- (void)applicationDidBecomeActive:(UIApplication *)application {
[[ULManager shared] applicationDidBecomeActive:application];
}
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray<id> * _Nullable))restorationHandler {
return [[ULManager shared] application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[ULManager shared] application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
}
Notification Registration Method
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[[ULManager shared] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
4.Login interface (required)
Call this interface to log in (for example, when you click the login button). If you are not logged in, the login window will be displayed. If you already have login information, you will be logged in automatically.
4.1 Interface Definition
- (void)loginInViewController:(UIViewController *)viewController;
parameter | describe |
---|---|
viewController | Current ViewController |
4.2 Sample Code
@implementation GameViewController
- (void)viewDidLoad {
[ULManager shared].delegate = self;
}
- (void)touchButton {
[[ULManager shared] loginInViewController:self];
}
5.Login success callback (required)
Login successful callback, return user object. Set the ULManger's delegate property to listen for login callback. This method returns that login is successful.
5.1 Interface Definition
- (void)loginDidSuccess:(ULGameUser * _Nullable)user;
parameter | describe |
---|---|
user | User Class |
5.2 Sample Code
@implementation GameViewController
- (void)loginDidSuccess:(ULGameUser *)user {
// User defined logic
}
6.Login failure callback (required)
Login failure callback, will return if automatic login or normal login fails
6.1 Interface Definition
- (void)loginDidFail:(ULCode)code;
parameter | describe |
---|---|
code | Error Code |
6.2 Sample Code
@implementation GameViewController
- (void)loginDidFail:(ULCode)code {
// User defined logic
}
7.Logout interface (required)
When the user clicks to switch accounts in the user center, the logout logic will be triggered. When the logout succeeds or fails, the proxy object will be notified through the corresponding method.
7.1 Interface Definition
- (void)logoutDidSuccess;
- (void)logoutDidFail:(ULCode)code;
7.2 Sample Code
@implementation GameViewController
// Logout success callback
- (void)logoutDidSuccess {
// User defined logic
}
// Logout failed callback
- (void)logoutDidFail:(ULCode)code {
// User defined logic
}
8.Payment interface (required)
When calling the in-app purchase interface, the callback method will be sent to the delegate object passed in during initialization (for example, GameViewController in the example above). It is recommended to initiate the next payment after receiving the payment callback.
8.1 Interface Definition
- (void)payWithULUOrder:(ULUOrder *)order andRole:(ULURole *)roleInfo;
parameter | describe |
---|---|
order | Order Object |
roleInfo | Role Object |
8.2 Sample Code
@implementation GameViewController
//After the user clicks on Pay
//Configuring role information
ULURole *role = [[ULURole alloc] init];
role.roleId = @"q123ios";
role.playername = @"ext";
role.serverid = @"westunion";
role.servername = @"name";
role.roleLevel = @"1300";
role.vipLevel = 5;
//Configure order information
ULUOrder *order = [[ULUOrder alloc] init];
order.productid = @"ulu_xxxxx_100"; // ulu in-app purchase technical ID, see the in-app purchase parameter table for details
order.quantity = 1;
order.extraData = @"sank";
[[ULManager shared] payWithULUOrder:order andRole:role];
8.3 Payment success callback
- (void)payDidSuccess:(NSString *)orderId extraData:(NSString *)extraData{
NSLog(@"Order payment successful");
}
8.4 Payment failed callback
- (void)payDidFailwithOrderId:(NSString *)orderId code:(ULCode)code extraData:(NSString *)extraData {
NSLog(@"Order payment failed, error code: %ld", (long)code );
}
9. Enter the User Center (required)
You need to add a user center button in the game and call this interface.
9.1 Interface Definition
- (BOOL)openUserCenterfromViewController:(UIViewController *)viewController;
9.2 Sample Code
@implementation GameViewController
[[ULManager shared] openUserCenterfromViewController:self];
10. Customer Service Center Interface (Required)
You need to add a customer service center button in the game and call this interface
10.1 Interface Definition
- (void)openCustomerServiceInViewController:(UIViewController *)viewController withRoleInfo:(ULURole *)roleInfo;
10.2 Sample Code
@implementation GameViewController
ULURole *role = [[ULURole alloc] init];
role.roleId = @"q123ios";
role.playername = @"ext";
role.serverid = @"westunion";
role.servername = @"name";
role.roleLevel = @"1300";
role.vipLevel = 5;
[[ULManager shared] openCustomerServiceInViewController:self withRoleInfo:role];
11. Buried point interface (required)
Please call the embedding interface at the required location in the game 1、Drag uluEventSDK.framework into the project 2、Import files into files that need to use the embedding interface
11.1 Interface Definition
The following two methods need to be called at the same time to embed the points. The parameters of the two methods can be the same.
<!-- Methods in the ULEventManager class -->
- (void)trackEvent:(NSString *)name withValues:(nullable NSDictionary *)values;
<!-- Methods in the ULManager class -->
- (void)logEventWithNameByChannelType:(NSString *)eventName andValues:(NSDictionary * _Nullable)extraData channelType:(UL_Event_Channel)channelType;
parameter | describe |
---|---|
name | Event name, specified by the tour operator or the market |
values | Event parameter, if no parameter is passed, nil is passed |
eventName | Event name, specified by the tour operator or the market |
extraData | Event parameter, if no parameter is passed, nil is passed |
channelType | Channel parameter, pass UL_Event_Channel_FacebookAndFirebase |
11.2 Sample Code
@implementation GameViewController
<!-- ULEventManager Example 1 -->
[[ULEventManager shared] trackEvent: @"enterinstance" withValues:nil];
<!-- ULEventManager Example 2 -->
[[ULEventManager shared] trackEvent: @"level_up" withValues: @{
@"uid" : @"12345678",
@"role_id" : @"22345678",
@"role_name" : @"Xiao Ming",
@"server_id" : @"123",
@"server_name" : @"server",
@"level" : @(20)
}]
<!-- ULManager Example 1 -->
[[ULManager shared] logEventWithNameByChannelType:@"level_up" andValues:nil channelType:UL_Event_Channel_FacebookAndFirebase];
<!-- ULManager Example 2 -->
[[ULManager shared] logEventWithNameByChannelType:@"level_up" andValues:@@{
@"uid" : @"12345678",
@"role_id" : @"22345678",
@"role_name" : @"Xiao Ming",
@"server_id" : @"123",
@"server_name" : @"server",
@"level" : @(20)
} channelType:UL_Event_Channel_FacebookAndFirebase];
12. Gift package redemption function (optional)
Call the interface where gift packs need to be exchanged in the game
12.1 Interface Definition
- (void)showGiftReceiveWithRole:(ULURole *)role;
parameter | describe |
---|---|
role | Role-related information |
12.2 Sample Code
@implementation GameViewController
ULURole *role = [[ULURole alloc] init];
role.roleId = @"q123ios";
role.playername = @"ext";
role.serverid = @"westunion";
role.servername = @"name";
[[ULManager shared] showGiftReceiveWithRole:role];
13. Questionnaire function (optional)
When accessing the questionnaire survey, you must also access the server's gift package distribution interface, otherwise the questionnaire survey function will not be available.
13.1 Interface Definition
- (void)openSurveyServiceInViewController:(nullable UIViewController *)viewController withRoleInfo:(ULURole *)roleInfo;
parameter | describe |
---|---|
viewController | Current ViewController |
roleInfo | Character Information |
13.2 Sample Code
@implementation GameViewController
ULURole *role = [[ULURole alloc] init];
role.roleId = @"q123ios";
role.playername = @"ext";
role.serverid = @"westunion";
role.servername = @"name";
[[ULManager shared] openSurveyServiceInViewController:self withRoleInfo:role];
14. Share (optional)
After the user clicks Share and selects a picture, create a ULShareContent object and set the picture and text.
Class ULShareContent
Fields | type | Read-only | default | Notes |
---|---|---|---|---|
image | UIImage | no | null | picture |
text | NSString | no | null | Word |
tag | NSString | yes | null | Identifier |
method: Open the share card
- (void)openShareDialogwithCallback:(void (^)(ULShareStatus status,NSError *_Nullable error))shareCallback;
Example:
ULShareContent *content = [[ULShareContent alloc] initWithTag:@"share001"];
content.image = [[UIImage alloc] initWithContentsOfFile:self.image.contentURL.path];
content.text = @"hahahahah";
[content openShareDialogwithCallback:^(ULShareStatus status, NSError * _Nullable error) {
NSLog(@"status %ld", (long)status);
}];
In the callback, check the status field to get the sharing status.
ULShareStatus Type:
definition | type | null | value | Notes |
---|---|---|---|---|
ULShareStatussuccess | NSInteger | no | 0 | success |
ULShareStatusFailed | NSInteger | no | 1 | fail |
ULShareStatusCancel | NSInteger | no | 2 | Cancel |
15. Rating function (optional)
This method can directly call the system rating interface to guide players to rate the game
15.1 Interface Definition
+ (void)requestReview:(NSString *)storeID;
parameter | describe |
---|---|
storeID | Store ID |
15.2 Sample Code
@implementation GameViewController
- (void)userTapReview {
[ULManager requestReview:@"1554607991"];
}
16. Rewarded advertising feature (optional)
The rewarded advertising module integrates the Admob channel and the Topon channel. According to the operation requirements, select a channel for parameter configuration.
16.1 Configuration parameters
1、Admob Channel Add the GADApplicationIdentifier field to the game's Info.plist file and fill in the Admob app ID
Fields | describe |
---|---|
GADApplicationIdentifier | See the parameter table provided by the operator for details. |
GADIsAdManagerApp | 1 |
2、Topon Channel Add the following fields to the game's Info.plist file
Fields | describe |
---|---|
AnyThinkerAppID | See the parameter table provided by the operator for details. |
AnyThinkerAppKey | See the parameter table provided by the operator for details. |
AppLovinSdkKey | See the parameter table provided by the operator for details. |
AppLovinVerboseLoggingOn | 1 |
3、Add SKAdNetworkItems in info.plist
<key>SKAdNetworkItems</key>
<array>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>cstr6suwn9.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>22mmun2rn5.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>uw77j35x4d.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>7ug5zh24hu.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>9t245vhmpl.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>kbd757ywx3.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>a8cz6cu7e5.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>578prtvx9j.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>5tjdwbrq8w.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>hs6bdukanm.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>k674qkevps.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>dbu4b84rxf.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>v9wttpbfk9.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>n38lu8286q.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>4dzt52r2t5.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>su67r6k2v3.skadnetwork</string>
</dict>
<dict>
<key>SKAdNetworkIdentifier</key>
<string>gta9lk7p23.skadnetwork</string>
</dict>
</array>
16.2 Code Sample
The project introduces uluLTV.framework and imports uluLTV in the used files (@import uluLTV)
1、Initialize and set callback object
@import uluLTV;
@interface GameViewController () <ULADRewardedAdDelegate>
@property (strong, nonatomic) ULADRewardedAd *rewardedAd;
@end
@implementation GameViewController
- (void)viewDidLoad {
self.rewardedAd = [[ULADRewardedAd alloc] init:@"1002922xxxx"];
self.rewardedAd.delegate = self;
[self.rewardedAd loadNextAd];
}
@end
2、Start Advertising
@import uluLTV;
@interface GameViewController () <ULADRewardedAdDelegate>
@property (strong, nonatomic) ULADRewardedAd *rewardedAd;
@end
@implementation GameViewController
<!-- Click the watch ad button to call this method -->
- (void)loadUluAd {
if (self.rewardedAd) {
if ([self.rewardedAd isReady]) {
[self.rewardedAd presentFromRootViewController:self];
}
} else {
[self.rewardedAd presentFromRootViewController:self];
}
}
@end
3、Receive advertising callback
- (void)rewardedAdDidLoadFail:(ULADRewardedAd *)rewardedAd withError:(NSError *)error {
<!-- You can get the channel error code through error.userInfo[NSUnderlyingErrorKey] -->
NSLog(@"rewardedAd load error");
}
- (void)rewardedAdDidLoadSuccess:(ULADRewardedAd *)rewardedAd {
NSLog(@"rewardedAd load success");
}
- (void)rewardedAd:(nonnull ULADRewardedAd *)rewardedAd didFailToPresentWithError:(nonnull NSError *)error {
NSLog(@"rewardedAd:didFailToPresentWithError");
}
<!-- According to operational needs, when this callback is received, logAdRevenue is called internally and the corresponding parameters are passed.-->
- (void)rewardedAd:(ULADRewardedAd *)rewardedAd userDidEarnReward:(ULAdReward *)reward monetizationNetwork:(NSString *)monetizationNetwork mediationNetwork:(NSInteger)mediationNetwork revenueCurrency:(NSString *)revenueCurrency eventRevenue:(NSNumber *)eventRevenue additionalParameters:(nullable NSDictionary *)additionalParameters {
NSLog(@"rewardedAd:userDidEarnReward:");
[[ULEventManager shared] logAdRevenue: ……];
}
- (void)rewardedAdDidDismiss:(nonnull ULADRewardedAd *)rewardedAd {
NSLog(@"rewardedAdDidDismiss:");
}
- (void)rewardedAdDidPresent:(nonnull ULADRewardedAd *)rewardedAd {
NSLog(@"rewardedAdDidPresent:");
}
4、Error Code
In the callback method with error parameter, error.code represents the error code. The specific value is as follows:
typedef NS_ENUM(NSUInteger, ULADRewardedAdError) {
ULADRewardedAdErrorNotReady = 1,
ULADRewardedAdErrorFailToDisplay = 2,
ULADRewardedAdErrorNoChannelOpen = 3,
ULADRewardedAdErrorNotInitialized = 4,
ULADRewardedAdErrorFailToLoad = 5
};
Error Code | describe |
---|---|
1 | Ad has not yet loaded (no fill) |
2 | Ad display failed |
3 | Advertising channel closed |
4 | Advertising module initialization |
5 | Ad module loading failed |