Skip to content

Shutdown the SDK

For the application, if you want to use DriveMotion again after the program restarts, you need to terminate it reasonably and reinitialize it.

Shutdown DriveMotion in synchronous [Deprecated]

Note

Shutdown in synchronous is deprecated in release 1.2.1 and will be removed in few releases, please use asynchronous shutdown instead.

1
2
3
4
5
    do {
        try TNDriveMotionService.shutdown()
    } catch {
        // SDK shutdown error or SDK has not been initialized
    }
1
2
3
4
5
    NSError *error;
    [TNDriveMotionService shutdownWithError:&error];
    if (error) {
        // SDK shutdown error or SDK has not been initialized
    }

Shutdown DriveMotion in asynchronous

1
2
3
4
5
6
7
    TNDriveMotionService.shutdown { success, error in
        if success {
            // SDK shutdown success
        } else {
           // SDK shutdown error or SDK has not been initialized. 
        }
    }
1
2
3
4
5
6
7
    [TNDriveMotionService shutdownWithHandler:^(BOOL result, TNDriveMotionException * _Nullable error) {
        if (result) {
            // SDK shutdown success
        } else {
            // SDK shutdown error or SDK has not been initialized.
        }
    }];