Cordova Hot Code Push Plugin -9 错误治疗方法

iOS Plugins/HCPPlugin.m 文件需要添加一行

- (void)installWwwFolder {
    _isPluginReadyForWork = NO;
    // reset www folder installed flag
    if (_pluginInternalPrefs.isWwwFolderInstalled) {
        _pluginInternalPrefs.wwwFolderInstalled = NO;
        _pluginInternalPrefs.readyForInstallationReleaseVersionName = @"";
        _pluginInternalPrefs.previousReleaseVersionName = @"";
        HCPApplicationConfig *config = [HCPApplicationConfig configFromBundle:[HCPFilesStructure defaultConfigFileName]];
        _pluginInternalPrefs.currentReleaseVersionName = config.contentConfig.releaseVersion;
        
        [_pluginInternalPrefs saveToUserDefaults];
        
        //治疗 LOCAL_VERSION_OF_APPLICATION_CONFIG_NOT_FOUND -9 错误
        _filesStructure = [[HCPFilesStructure alloc] initWithReleaseVersion:_pluginInternalPrefs.currentReleaseVersionName];
    }
    
    [HCPAssetsFolderHelper installWwwFolderToExternalStorageFolder:_filesStructure.wwwFolder];
}

Android HotCodePushPlugin.java 需要添加一行

/**
     * Install assets folder onto the external storage
     */
    private void installWwwFolder() {
        isPluginReadyForWork = false;

        // reset www folder installed flag
        if (pluginInternalPrefs.isWwwFolderInstalled()) {
            pluginInternalPrefs.setWwwFolderInstalled(false);
            pluginInternalPrefs.setReadyForInstallationReleaseVersionName("");
            pluginInternalPrefs.setPreviousReleaseVersionName("");

            final ApplicationConfig appConfig = ApplicationConfig.configFromAssets(cordova.getActivity(), PluginFilesStructure.CONFIG_FILE_NAME);
            pluginInternalPrefs.setCurrentReleaseVersionName(appConfig.getContentConfig().getReleaseVersion());

            pluginInternalPrefsStorage.storeInPreference(pluginInternalPrefs);

            //治疗 LOCAL_VERSION_OF_APPLICATION_CONFIG_NOT_FOUND -9 错误
            fileStructure.switchToRelease(pluginInternalPrefs.getCurrentReleaseVersionName());
        }

        AssetsHelper.copyAssetDirectoryToAppDirectory(cordova.getActivity().getApplicationContext(), WWW_FOLDER, fileStructure.getWwwFolder());
    }
相关文章

相关标签/搜索