Skip to content

LCMCoreIOS

LCM Core iOS

LCMSDK

@interface LCMSDK : NSObject

Interface / Method
Parameters details
Note

+ (void) init:

 (NSObject<LCMEventHandler> *)
eventHandler  withOption:

 (NSDictionary *) launchOptions

eventHandler
Sets the instance that implement EventHandler interface.
If SDK need to inform SDK's events, SDK call methods of the interface.
About "EventHandler" detail, please see here.

 launchOptions
Sets launchOptions parameter of "application:didFinishLaunchingWithOptions" method.
Game developer has to call the method in "application:didFinishLaunchingWithOptions"method of the UIApplicationDelegate.
 SDK keeps LCMEventHandler instance into LCMSDK instance for sending SDK event notification any time.
 And, SDK Registers remote notification (APN) to enable remote notification.
 Also, SDK gets and parses remote notification data from launchOptions parameter. If there is remote notification, SDK calls "onRemoteMessage" method of LCMEventHandler.
+ (void) resume Game developer has to call the method in "applicationDidBecomeActive" method of the UIApplicationDelegate.
 
 In the method, SDK tries to get/update access token from LCM server. 
And, SDK do the following things in the first call of this method.
  • Checking the app configuration. (plist file)
  • Getting some device identifier (Advertising id and others.)
  • Getting In-App-Purchase products, and populating it on memory for quick loading in purchase process.

 About detail flow to get/update token, please see here.

 And, SDK starts the timer of a task to update access token.
+ (void) pause Game developer has to call the method in "applicationWillResignActive" method of the UIApplicationDelegate.

 In the method, SDK tries to update access token if the token is in the app.
 About detail flow to update token, please see here.

 And, SDK stops the timer of a task to update access token.

+ (void) registerDeviceToken:

 (NSData *) deviceToken

deviceToken
Sets deviceToken parameter of "didRegisterForRemoteNotificationsWithDeviceToken" method.
Game developer has to call the method in "didRegisterForRemoteNotificationsWithDeviceToken"
method of the UIApplicationDelegate.

 In the method, SDK registers the device token into the app preference.
 SDK tries to send the device token to server while getting/updating access token.

(void) receiveRemoteNotification:

 (NSDictionary *) data

data
Sets userInfo parameter of "didReceiveRemoteNotification" method
Game developer has to call the method in "didReceiveRemoteNotification" method of the UIApplicationDelegate.

 In the method, SDK parses remote notification (APN) data, and SDK calls "onRemoteMessage" method of EventHandler.

+ (LCMUser *) getCurrentUser

 

Gets the User object of the current session.

The current user's LCM data

(void) getAllUserIds:

(void (^)(NSArray *idBeanArray,LCMError *error))callback


 callback
Callback of the getAllUserIds.
userBeanArray
long long userId
int status
error
Errors.

Get all userIds on the device.

status

0 for unactive

1 for active

2 for disable

+ (NSString *) getAccessToken

 

Gets the access token of the current session.

Access The user's LCM access token, or null if the current session is invalid

+ (NSString *) getSDKVersion

 

Gets the current version of the installed LCM SDK

The version number as String

+ (BOOLisSandbox

 

Determines if your application is connecting to LCM's "sandbox" or "production" environment

Your application can specify which environment to use through the "conf/appinfo.json" settings file.

+ (BOOL) shouldBlockResume Developer must call this function in Upgrade|Announcement callback to ensure the case that user switch the app to the background and front,the upgrade function behave right.

(void) resetUser:

(void (^)(
LCMUser *userBefore, 
LCMUser *userAfter, 
NSString *accessToken,
LCMError *error)
)callback
callback
Callback of the resetUser.
userBefore
User before reset.
userAfter
User after reset.
accessToken
Current accessToken.
error
Errors.
 Reset user and get a new user.

(void) switchUser:

(NSString *) userId withCallback:

(void (^)(
LCMUser *userBefore, 
LCMUser *userAfter, 
NSString *accessToken,
LCMError *error)
)callback

userId

The userId to be switched.

callback

Callback of the switchUser.
userBefore
User before switch.
userIdAfter
User after switch.
accessToken
Current accessToken.
error
Errors.
 Switch the current user.
+ (NSString) authCode Developer should set authCode in EventHandler onActivation.
+ (BOOL) isFirstToLinkOrLoad Use this flag to decide whether link or load function should be done first.
+ (void) logout If logout complete, onLogoutComplete will be called in event handler.
+ (void) checkAnnouncement 

Check whether announcement is exist.

if exist, onAnnouncement will be called in event handler.

+ (void) setExtra:

(NSString *) event withDetail:

(NSString *) detail

event

Such as createRole.

detail

Detail information of the event in json.

Upload extra event to server.

Event ex: @"createRole"

Detail ex: {"roleId":"123","roleName":"Eleric","server":"Booty Bay"}

+ (void) recover:

 (NSData *) userId

userId

Lid.

This will recover the L balance while user have transactions that do not get L coin.

If any transaction is recovered,

the next time Wallet getBalance is called, L coin will be added.

+ (void) showMenubar: Show menubar at default position.

+ (void) showMenubarWithPosition:

(int) position

position

MENUBAR_POSITION_LEFT_TOP
MENUBAR_POSITION_RIGHT_TOP
MENUBAR_POSITION_LEFT_BOTTOM
MENUBAR_POSITION_RIGHT_BOTTOM
Show menubar at the position you set.
+ (void) hideMenubar: Hide the menubar
+ (void) login: Do login function. onLoginComplete in EventHandler will be the callback.
+ (void) getAffcode: Get affcode from appconf.json

+ (void) additionalFunction:

(LCMADDITIONALFUNCTION) funcType;

funcType

STORE_ACCOUNT_MANAGER

通过funcType来调用SDK内第三方功能:

STORE_ACCOUNT_MANAGER:用户账户管理,目前仅支持嫁接大陆台湾商店

+ (BOOL)isUserNeedRealNameRegister

 

Return result whether current user need to do real-name register

+ (void)doRealNameAuth:(void (^)(NSString *realnameInfo, LCMError *error))authcallback

 callback
Callback of the realname register.
realnameInfo
realname register info
error
Errors.
real-name register

+ (void)hideSplash

 

hide splash

LCMEventHandler

@protocol LCMEventHandler

Interface / Method
Parameters details

- (void) onSessionUpdate:

 (NSString *) accessToken  withUser:

 (LCMUser *) user

accessToken
Sets access token. 
About the detail of access token, please see here.

 launchOptions
Sets user object.
About the detail of user object, please see here.

+ (void) onSessionError

 (LCMError *) error

error
Sets LCM error object.
About the detail of LCM error object, please see here.

+ (void) onRemoteMessage

 (NSString *) message  withExtras:

 (NSString *) extras

message
Sets the message value of remote notification API.

 extras
Sets the extras value of remote notification API.

+ (void) onUpdate

(LCMUpdater *) updater

updater
Help user to update App.

+ (void) onAnnouncement

(LCMAnnouncement *) announcement

announcement
Help user to show announcement.

+ (void) onActivation

(LCMActivation *) activation

activation
If the user need a code to auth , this will be called.

+ (void) onLogoutComplete

(NSString *) extra

extra
Extra info.

+ (void) onInitComplete

(LCMInitializer *) initializer

initializer
if init has error, initializer.error = null, it will return LCMError.
Use initializer.continueProcessing to continue.

LCMError

@interface LCMError : NSObject

Interface / Method
Parameters details
Note
+ (int) getErrorCode
  
+ (NSString) getErrorMessage
  
+ (ErrorType) getErrorType
 

typedef enum{

LCM_ERROR,  

NETWORK_ERROR, 

USER_CANCEL,

STORE_CREDENTIAL_ERROR 

}

ErrorType;


Back to top