All Products
Search
Document Center

Create a service

Last Updated: Mar 10, 2021

In the process of developing application based on mPaas iOS framework, you can set the general functions without UI as a service (e.g. login) which can be easily obtained by other micro applications or services through the whole App running period. To add a service, you must add service template codes, and register a service.

Procedure

1. Add service template codes

Download the service’s Template Codes, which mainly:

  • Define the service’s protocol and expose the external interface method.

    image

  • Define the class to implement service interface method.

    image

2. Register a service

Similar to the micro application, the newly created services can be managed in a unified way via the framework only when they are registered in MobileRuntime.plist.

service

Field Description
Name The unique identifier of a service
Class The implementation class of a service. When creating a service, the framework utilizes runtime reflection mechanism to create the instances of the service implementation class.
lazyLoading Whether to delay loading. If Yes, the service will not be instantiated when the framework starts. Only when being used can the service be instantiated and launched. If No, the service will be instantiated and launched when the framework starts. It defaults to No.