How to Develop in Xcode

This chapter explains how to create a new application by using the Mobage Native SDK. The application launch sequence of the Mobage Native SDK is as follows.

1.“[MBGPlatform initialize]” performs the initialization process.
2.“[[MBGPlatform sharedPlatform] checkLoginStatus]” checks the login status.
3.If the callback onLoginRequired is called, then call [MBGPlatform showLoginDialog] to display the login dialog.

Edit ${PJ_NAME}

To develop a new application, you need to edit the main source code ${PJ_NAME}
The following code is a sample implementation of didFinishLaunchingWithOptions. Note that the method is called just after launching the application.

Login process

The following code performs the application initialization process. You need to specify consumerKey and consumerSecret as the arguments of MBGPlatform#initialize.
Note that consumerKey and consumerSecret are issued when you register your application at the Mobage developer site. Please specify “SDK Consumer Key (for development)” and “SDK Consumer Secret (for development)”, issued in your application page on the developer site, as the arguments of the initialization method.

(About region code)

In the above sample code, it is assumed that MBGPlatform.h is imported. In the include file, “enum MBG_REGION” defines the region code MBG_REGION_JP. For details,
please refer to the API reference in the SDK.

(Change file extension)

Since the login process uses Objective-C++ implementations, please change the file extension .m to .mm.

Processing asynchronous events

The Mobage Native SDK handles events asynchronously. A thread, which invoked the listener registration method, receives the results of the event handlings.
Thus, you need to call the following method to register the tick() method into Timer.

If you want to handle events in your implementations without invoking registerTick, please invoke tick in your loop implementation.

(Implementation of an event handler)

Please implement the following methods in ${PJ_NAME} to receive the result of the login process.

In addition, you need to implement the methods to handle events, such as application launch and termination, and to notify launch URL to other applications.
Please add the following code into ${PJ_NAME}

A sample to call Mobage Social API

A method which call MBGSocialPeople#getCurrentUser can be implemented as follows. If you succeed to call getCurrentUser, it will display an alert dialog.


Edit ${PJ_NAME}AppDelegate.h

(Inheritance from MBGPlatformDelegate protocol)
Please inherit from MBGPlatformDelegate protocol in ${PJ_NAME}AppDelegate.h.

Revision History

  • 11/26/2012
    • Add the code for Easy-Login.
  • 08/08/2012
    • Initial Release.


How to build in Xcode7