During app development, the app environment (namely, workspace) may occasionally change, and the app may be developed in multiple workspaces in parallel. mPaaS provides a tool for you to conveniently switch among environments (workspaces) during development. There are two types of workspace switching modes:
- Static workspace switching
- Dynamic workspace switching
In static workspace switching, the default
meta.config configuration file in the project is manually replaced on the client and then repackaged for access in a new workspace.
- 1. Replace the
meta.configfile of the current project with the mPaaS plug-in.
- Delete and then reinstall the app and the new workspace configuration information takes effect immediately.
In dynamic workspace switching, workspace options in mobile phone settings are modified to dynamically modify the app workspace information without repackaging on the client.
- This mode applies to a scenario where an app is developed in multiple workspaces in parallel and is frequently switched among them in the development phase.
- The dynamic workspace switching feature is only supported on Apsara Stack.
Restricted by the mPaaS security signature verification mechanism, updating workspace configuration information modifies the WSG signature verification image
yw_1222.jpg. Therefore, dynamic workspace switching has two restrictions.
- The dynamic workspace switching mode applies only to the development phase. Therefore, be sure to delete the corresponding configuration before the app is released.
- Signature verification for network requests must be disabled in the mPaaS console. Otherwise, requests will fail due to incorrect signature verification image information.
Enable dynamic workspace switching. Specifically, rewrite the
MPaaSInterfaceand return YES.
@implementation MPaaSInterface (Portal)
Download the workspace configuration file Settings.bundle.zip, and then add it to the project.
Understand the workspace configuration information in
Setting.bundleprovides four workspaces by default, corresponding to the 4 configuration files: Debug, Sit, Release, and Custom respectively.
Among them, Debug, Sit and Release are preset workspaces. You need to download the configuration files of the target workspaces from the mPaaS console. Rename them to Debug, Sit, and Release, and use them to replace the example files in the original
The Custom workspace applies to a scenario where repackaging is not performed on the client and app workspace information is directly configured in mobile phone settings. The configuration path on a mobile phone is Settings > Current app > Settings > Customizing. Enter the corresponding values based on the downloaded configuration information.
To preset more workspaces in addition to the default Debug, Sit, Release, and Custom workspaces, add a configuration item in
Setting. bundle/Service. plistand add the corresponding configuration file. The format is as follows:
After the Settings.bundle workspace configuration file is added, the app configuration information will overwrite the default
meta.configfile in the project, and the workspace selected in
Settings.bundleprevails. The path for viewing the currently selected workspace is: Mobile phone Settings > mPaaS app > Settings > Category. The Sit workspace is selected by default.
To switch to another workspace, go to Mobile phone Settings > mPaaS app > Settings > Category and select the workspace. End the process and start it again for the new workspace to take effect.