closeApp

The closeApp interface is called by the super app to close mini programs.

Method signature

copy
- (BOOL)closeAppForController: (UIViewController *)controller error:(NSError **)error;

Parameters

Field

Data type

Required

Description

controller

UIViewController

Yes

Indicates the container for an H5 app or a mini program.

Note: The controller is returned by [GRVAppContainerLaunch openAppWithUrl:extraParams:] or [GRVAppContainerLaunch openAppWithApppId:extraParams:].

error

NSError

No

Indicates the error code and error message that are returned when the close operation fails.

For details, see the following Error codes section.

Sample

copy
// open the app
let viewController = try GRVAppContainerLaunch.sharedInstance().openApp(withAppId: "xxx", startupParams: params)


// close the app
do {
    try GRVAppContainerLaunch.sharedInstance().closeApp(for: viewController, error: ())
} catch let error {
    print(error)
}

Error codes

Error code

Error message

Further action

90002

GRV_CONTAINER_API_ERROR_PARAM

Indicates the controller parameter is empty. Refer to the Parameters table and check whether all parameter types are correct and whether all required parameters are specified.

90003

GRV_CONTAINER_NOT_INITIALIZED

IAPMiniProgram SDK is not initialized. Need to initialize the SDK.