LCMCoreIOS
LCM Core iOS
LCMSDK
@interface LCMSDK : NSObject
Interface / Method | Parameters details | Note |
---|---|---|
+ (void) init: (NSObject<LCMEventHandler> *) (NSDictionary *) launchOptions | eventHandlerSets the instance that implement EventHandler interface.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.
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 | deviceTokenSets 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 | dataSets 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 | callbackCallback of the getAllUserIds. userBeanArraylong long userIdint 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 | |
+ (BOOL) isSandbox | 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 | callbackCallback of the resetUser. userBeforeUser before reset. userAfterUser after reset. accessTokenCurrent 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. userBeforeUser before switch. userIdAfterUser after switch. accessTokenCurrent 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
| 通过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 | callbackCallback of the realname register. realnameInforealname 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 | accessTokenSets access token.launchOptions Sets user object. |
+ (void) onSessionError (LCMError *) error | errorSets LCM error object. |
+ (void) onRemoteMessage (NSString *) message withExtras: (NSString *) extras | messageSets the message value of remote notification API.extras Sets the extras value of remote notification API. |
+ (void) onUpdate (LCMUpdater *) updater | updaterHelp user to update App. |
+ (void) onAnnouncement (LCMAnnouncement *) announcement | announcementHelp user to show announcement. |
+ (void) onActivation (LCMActivation *) activation | activationIf the user need a code to auth , this will be called. |
+ (void) onLogoutComplete (NSString *) extra | extraExtra info. |
+ (void) onInitComplete (LCMInitializer *) initializer | initializerif 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{ USER_CANCEL, STORE_CREDENTIAL_ERROR } ErrorType; |