MBService Protocol Reference

Conforms to MBSingleton
Declared in MBService.h

Overview

The MBService protocol is implemented by classes that provide runtime services that might not need to be running during the entire lifetime of the application.

For example, an application might not want to start the MBGeolocationService until the user takes an action that requires location information. This will ensure that the user isn’t prompted by iOS for Location Services permission until absolutely necessary.

Also, because the use of Location Services can increase battery drain, by being implemented as a service, MBGeolocationService can be turned off when not in need.

This is more respectful of the user’s resources.

Warning: This protocol declares methods that are intended to be called only by the MBServiceManager. Do not call these methods directly. To make use of a service, you should use methods provided by the MBServiceManager singleton.

– startService required method

Requests that the service start running.

- (void)startService

Discussion

Warning: This method is called as needed by the MBServiceManager and must not be called directly.

Declared In

MBService.h

– stopService

Requests that the service stop running.

- (void)stopService

Discussion

This method is optional; services that do not support stopping do not need to implement.

Warning: This method is called as needed by the MBServiceManager and must not be called directly.

Declared In

MBService.h

– configureService:

Configures the service according to the keys and values contained in the specified dictionary.

- (void)configureService:(NSDictionary *)params

Parameters

params

The configuration parameters for the service. Acceptable configuration values are service-specific.

Discussion

This method is optional; services that do not support configuration do not need to implement.

Note: Services should log a console error but otherwise ignore any unrecognized keys or unsupported values passed to this method.

Declared In

MBService.h