Create a service

Updated at:

In the mPaaS iOS framework, implement UI-less common features as services (such as logon) so other micro-apps or services can access them at runtime. To add a service, add the template code and register it.

Code sample

Download and view the iOS framework demo in Get code sample.

Procedure

  1. Add the service template code.

    1. Define the service protocol and expose the public interface methods.1111

    2. Define the class that implements the service interface methods.22222

  2. Register the service.

    Like micro-apps, register the service in MobileRuntime.plist for the framework to manage it.33333

    Field

    Description

    name

    The unique identifier for the service.

    class

    The service implementation class. The framework instantiates this class through runtime reflection.

    lazyLoading

    Whether to lazy-load the service. If enabled, the service starts only on first use instead of at framework startup. Default: NO.