Implementation of the AppDelegate Class
First, we will look into the
This class contains only initialization of the Kii Cloud SDK in addition to the code generated by Xcode at the project generation.
application(_:didFinishLaunchingWithOptions:) method that is called at launch of the mobile app, initializes the Kii Cloud SDK as below:
Kii.begin(withID:andKey:andSite:) method initializes the SDK. It has three parameters: AppID, AppKey (an arbitrary value), and the server location of the application in order.
There are many applications created by numerous developers on Kii Cloud. To distinguish the applications, Kii Cloud uses the AppID. This value is generated when you create your application on the developer portal.
As illustrated in the figure below, the AppID is to be set in the initialization process of the mobile app. By setting the same AppID, application data and users can be shared across multiple platforms; in the figure, the Android and iOS applications are sharing the same application data and users by using the same AppID 1111.
When you download Hello Kii application from the developer portal, the unique AppID and AppKey for you are assigned and embedded in the zip file automatically. When you open the project, you will find the initialization code, like the one shown at the top of this page, is already embedded.
If you are creating a new project, you need to embed the AppID and AppKey by yourself. To check the AppID, click the gear icon at the upper-right corner of the developer portal to expand the menu icons and click the key icon. The AppID will pop up as follows:
It is not possible to attack your application by knowing its AppID. If a malicious user obtains your application's ClientID and ClientSecret, however, they will be able to access all of your application data as the app administrator. The ClientID and ClientSecret, therefore, need to be secured just like the login password of the developer portal.
Be careful when you paste your codes in your posts in places like support communities. Make sure to hide the ClientID and ClientSecret. When you are sending a question to Kii support team, you only need to provide the AppID and server location.
Let's check how the login screen is implemented. We will explain how the APIs are used.
Go to Login Screen Implementation.