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
Static 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.
This method is only applicable to scenarios where only the configuration information of the current application environment is updated.
Replace the
meta.config
file of the current project with the mPaaS plug-in.Delete and then reinstall the app and the new workspace configuration information takes effect immediately.
Dynamic workspace switching
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.
![ ddd](http://docs-aliyun.cn-hangzhou.oss.aliyun-inc.com/assets/pic/111262/AntCloud_zh/1552905359956/%E5%9B%BE%E7%89%874.png)
Workspace information configuration
Enable dynamic workspace switching. Specifically, rewrite the
enableSettingService
method incategory
ofMPaaSInterface
and return YES.@implementation MPaaSInterface (Portal) - (BOOL)enableSettingService { return YES; } @end
Download the workspace configuration file Settings.bundle.zip, and then add it to the project.
Understand the workspace configuration information in
Setting.bundle
.Setting.bundle
provides 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
Setting. bundle
.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. plist
and add the corresponding configuration file. The format is as follows:
Dynamic workspace switching
After the Settings.bundle workspace configuration file is added, the app configuration information will overwrite the default
meta.config
file in the project, and the workspace selected inSettings.bundle
prevails. 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.