error: exportArchive: The data couldn’t be read because it isn’t in the correct format
error: exportArchive: The data couldn’t be read because it isn’t in the correct format
我有这个不是我写的脚本,它应该构建 .ipa
不同构建风格的脚本:
import path from "path";
import { execSync } from "child_process";
import { name, iosDirectory } from "../../app.json";
import { version } from "../../package.json";
import { resolveFromRoot, distDir, createLogger } from "../build";
const getProcessOptions = () => {
return {
env: Object.assign({}, process.env, {
// used to skip packager, since we default to release bundler is built in
RCT_NO_LAUNCH_PACKAGER: true,
CI_IOS_VERSION_NAME: version
// CI_IOS_BUILD_NUMBER: build,
})
};
};
const buildProcess = ({ xcodebuildArgs }) => {
return `xcodebuild ${xcodebuildArgs.join(" ")}`;
};
const archiveProject = ({
xcodeProject,
scheme,
configuration = "Release",
buildPath,
archivePath
}) => {
const xcodebuildArgs = [
xcodeProject.isWorkspace ? "-workspace" : "-project",
xcodeProject.name,
"-configuration",
configuration,
"-scheme",
scheme,
"-derivedDataPath",
buildPath,
"-archivePath",
archivePath,
"archive",
"-UseModernBuildSystem=NO"
];
return buildProcess({
xcodebuildArgs
});
};
const exportProject = ({ archivePath, exportOptionsPlist }) => {
const xcodebuildArgs = [
"-archivePath",
archivePath,
"-exportPath",
distDir,
"-exportOptionsPlist",
exportOptionsPlist,
"-exportArchive"
];
return buildProcess({
xcodebuildArgs
});
};
const run = () => {
const logger = createLogger("ios builds");
const projectPath = resolveFromRoot(
path.join(iosDirectory, `${name}.xcworkspace`)
);
const release = process.env.GitVersion_MajorMinorPatch || "1.0.0";
const buildNumber = process.env.Build || 1;
const fullAppVersion = `${release}-${buildNumber}`;
const setVersion = `agvtool new-marketing-version ${release}`;
const setBuild = `agvtool new-version -all ${buildNumber}`;
const setBuildAndVersion = `cd ios && ${setVersion} && ${setBuild} && cd ..`;
execSync(setBuildAndVersion, {}, error => {
logger.logHeader("Error setting version and build numbers iOS", {
repeatChar: "#"
});
logger.log(error);
});
const flavours = [
{
endpoint: "dv",
flavour: "DEV",
appcenterKey: "<hash>"
},
{
endpoint: "in",
flavour: "INTG",
appcenterKey: "<hash>"
},
{
endpoint: "qa",
flavour: "QA",
appcenterKey: "<hash>"
},
{
endpoint: "ua",
flavour: "UA",
appcenterKey: "<hash>"
},
{
endpoint: "prod",
flavour: "PROD",
appcenterKey: "<hash>"
}
];
const devFlav = flavours.find(f => f.flavour.toLocaleLowerCase() === "dev");
const buildFlavour = process.env.GitVersion_BranchName.startsWith("release/")
? flavours
: [devFlav];
buildFlavour.forEach(f => {
const scheme = f.flavour;
const devPList = path.resolve(__dirname, "dev.plist");
const appStorePList = path.resolve(__dirname, "app-store.plist");
// if PROD scheme, then use app-store.plist. Else, dev.list
const exportOptionsPlist = scheme === "PROD" ? appStorePList : devPList;
logger.logHeader(`${scheme} Build IOS Start`, { repeatChar: "#" });
const buildPath = path.resolve(iosDirectory, "build");
const archivePath =
path.resolve(buildPath, "Archive", scheme) + ".xcarchive";
//prettier-ignore
const engaInfo = `ENGAGE_VERSION=${fullAppVersion}`;
const engaEndpoint = `ENGAGE_ENDPOINT=${f.endpoint}`;
const engaCenter = `APPCENTER_KEY=${f.appcenterKey}`;
const engaPlatform = "APPCENTER_PLATFORM=ios";
//prettier-ignore
const prepare = `${engaEndpoint} ${engaCenter} ${engaInfo} ${engaPlatform} npm run setup`;
const archiveCmd = archiveProject({
xcodeProject: {
name: path.relative(".", projectPath),
isWorkspace: path.extname(projectPath) === ".xcworkspace"
},
scheme,
buildPath,
archivePath
});
const exportCmd = exportProject({
archivePath,
exportOptionsPlist
});
logger.logHeader(`${prepare} && ${archiveCmd} && ${exportCmd}`, {
repeatChar: "#"
});
execSync(
`${prepare} && ${archiveCmd} && ${exportCmd}`,
getProcessOptions,
error => {
logger.logHeader(`Error --- ${scheme} IOS `, { repeatChar: "#" });
logger.log(error);
}
);
});
};
run();
我不知道脚本是否有问题,但失败并显示以下错误:
nps is executing `ios.build` : node node_modules/rimraf/bin.js dist/*.ipa && babel-node scripts/ios/build.js
############################# DEV Build IOS Start #############################
ENGAGE_ENDPOINT=dv APPCENTER_KEY=<hash> ENGAGE_VERSION=1.0.0-1 APPCENTER_PLATFORM=ios npm run setup && xcodebuild -workspace ios/NFIBEngage.xcworkspace -configuration Release -scheme DEV -derivedDataPath path/to/ios/build -archivePath path/to/ios/build/Archive/DEV.xcarchive archive -UseModernBuildSystem=NO && xcodebuild -archivePath path/to/ios/build/Archive/DEV.xcarchive -exportPath path/to/dist -exportOptionsPlist path/to/scripts/ios/dev.plist -exportArchive
2019-10-07 10:23:07.730 xcodebuild[15084:16992455] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/nd/6b67gs7n3wg6714rx36q0r140000gn/T/ENGAL-DEV_2019-10-07_10-23-07.728.xcdistributionlogs'.
error: exportArchive: The data couldn’t be read because it isn’t in the correct format.
数据格式不正确是什么意思?我应该在哪里调试它?
当我查看日志时,我得到了这个晦涩的错误:
Error Domain=NSCocoaErrorDomain Code=3840 "No value."
我看到一个回答说我需要添加 compileBitcode
但我的 dev.plist
文件中有:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>enterprise</string>
<key>teamID</key>
<string>1234ABCD</string>
<key>uploadBitcode</key>
<true/>
<key>compileBitcode</key>
<true/>
<key>uploadSymbols</key>
<true/>
<key>signingStyle</key>
<string>manual</string>
<key>signingCertificate</key>
<string>iOS Distribution</string>
<key>provisioningProfiles</key>
<dict>
<key>com.nfib-enterprise.engage-dv</key>
<string>ENGA - DEV - Dist</string>
<key>com.nfib-enterprise.engage-in</key>
<string>ENGA - INT - Dist</string>
<key>com.nfib-enterprise.engage-qa</key>
<string>ENGA - QA - Dist</string>
<key>com.nfib-enterprise.engage-ua</key>
<string>ENGA - UA - Dist</string>
</dict>
</dict>
</plist>
我通过 运行 以下命令解决了这个问题:
gem list | grep sqlite3
gem install sqlite3 --platform=ruby
rvm use system --default
我有这个不是我写的脚本,它应该构建 .ipa
不同构建风格的脚本:
import path from "path";
import { execSync } from "child_process";
import { name, iosDirectory } from "../../app.json";
import { version } from "../../package.json";
import { resolveFromRoot, distDir, createLogger } from "../build";
const getProcessOptions = () => {
return {
env: Object.assign({}, process.env, {
// used to skip packager, since we default to release bundler is built in
RCT_NO_LAUNCH_PACKAGER: true,
CI_IOS_VERSION_NAME: version
// CI_IOS_BUILD_NUMBER: build,
})
};
};
const buildProcess = ({ xcodebuildArgs }) => {
return `xcodebuild ${xcodebuildArgs.join(" ")}`;
};
const archiveProject = ({
xcodeProject,
scheme,
configuration = "Release",
buildPath,
archivePath
}) => {
const xcodebuildArgs = [
xcodeProject.isWorkspace ? "-workspace" : "-project",
xcodeProject.name,
"-configuration",
configuration,
"-scheme",
scheme,
"-derivedDataPath",
buildPath,
"-archivePath",
archivePath,
"archive",
"-UseModernBuildSystem=NO"
];
return buildProcess({
xcodebuildArgs
});
};
const exportProject = ({ archivePath, exportOptionsPlist }) => {
const xcodebuildArgs = [
"-archivePath",
archivePath,
"-exportPath",
distDir,
"-exportOptionsPlist",
exportOptionsPlist,
"-exportArchive"
];
return buildProcess({
xcodebuildArgs
});
};
const run = () => {
const logger = createLogger("ios builds");
const projectPath = resolveFromRoot(
path.join(iosDirectory, `${name}.xcworkspace`)
);
const release = process.env.GitVersion_MajorMinorPatch || "1.0.0";
const buildNumber = process.env.Build || 1;
const fullAppVersion = `${release}-${buildNumber}`;
const setVersion = `agvtool new-marketing-version ${release}`;
const setBuild = `agvtool new-version -all ${buildNumber}`;
const setBuildAndVersion = `cd ios && ${setVersion} && ${setBuild} && cd ..`;
execSync(setBuildAndVersion, {}, error => {
logger.logHeader("Error setting version and build numbers iOS", {
repeatChar: "#"
});
logger.log(error);
});
const flavours = [
{
endpoint: "dv",
flavour: "DEV",
appcenterKey: "<hash>"
},
{
endpoint: "in",
flavour: "INTG",
appcenterKey: "<hash>"
},
{
endpoint: "qa",
flavour: "QA",
appcenterKey: "<hash>"
},
{
endpoint: "ua",
flavour: "UA",
appcenterKey: "<hash>"
},
{
endpoint: "prod",
flavour: "PROD",
appcenterKey: "<hash>"
}
];
const devFlav = flavours.find(f => f.flavour.toLocaleLowerCase() === "dev");
const buildFlavour = process.env.GitVersion_BranchName.startsWith("release/")
? flavours
: [devFlav];
buildFlavour.forEach(f => {
const scheme = f.flavour;
const devPList = path.resolve(__dirname, "dev.plist");
const appStorePList = path.resolve(__dirname, "app-store.plist");
// if PROD scheme, then use app-store.plist. Else, dev.list
const exportOptionsPlist = scheme === "PROD" ? appStorePList : devPList;
logger.logHeader(`${scheme} Build IOS Start`, { repeatChar: "#" });
const buildPath = path.resolve(iosDirectory, "build");
const archivePath =
path.resolve(buildPath, "Archive", scheme) + ".xcarchive";
//prettier-ignore
const engaInfo = `ENGAGE_VERSION=${fullAppVersion}`;
const engaEndpoint = `ENGAGE_ENDPOINT=${f.endpoint}`;
const engaCenter = `APPCENTER_KEY=${f.appcenterKey}`;
const engaPlatform = "APPCENTER_PLATFORM=ios";
//prettier-ignore
const prepare = `${engaEndpoint} ${engaCenter} ${engaInfo} ${engaPlatform} npm run setup`;
const archiveCmd = archiveProject({
xcodeProject: {
name: path.relative(".", projectPath),
isWorkspace: path.extname(projectPath) === ".xcworkspace"
},
scheme,
buildPath,
archivePath
});
const exportCmd = exportProject({
archivePath,
exportOptionsPlist
});
logger.logHeader(`${prepare} && ${archiveCmd} && ${exportCmd}`, {
repeatChar: "#"
});
execSync(
`${prepare} && ${archiveCmd} && ${exportCmd}`,
getProcessOptions,
error => {
logger.logHeader(`Error --- ${scheme} IOS `, { repeatChar: "#" });
logger.log(error);
}
);
});
};
run();
我不知道脚本是否有问题,但失败并显示以下错误:
nps is executing `ios.build` : node node_modules/rimraf/bin.js dist/*.ipa && babel-node scripts/ios/build.js
############################# DEV Build IOS Start #############################
ENGAGE_ENDPOINT=dv APPCENTER_KEY=<hash> ENGAGE_VERSION=1.0.0-1 APPCENTER_PLATFORM=ios npm run setup && xcodebuild -workspace ios/NFIBEngage.xcworkspace -configuration Release -scheme DEV -derivedDataPath path/to/ios/build -archivePath path/to/ios/build/Archive/DEV.xcarchive archive -UseModernBuildSystem=NO && xcodebuild -archivePath path/to/ios/build/Archive/DEV.xcarchive -exportPath path/to/dist -exportOptionsPlist path/to/scripts/ios/dev.plist -exportArchive
2019-10-07 10:23:07.730 xcodebuild[15084:16992455] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/nd/6b67gs7n3wg6714rx36q0r140000gn/T/ENGAL-DEV_2019-10-07_10-23-07.728.xcdistributionlogs'.
error: exportArchive: The data couldn’t be read because it isn’t in the correct format.
数据格式不正确是什么意思?我应该在哪里调试它?
当我查看日志时,我得到了这个晦涩的错误:
Error Domain=NSCocoaErrorDomain Code=3840 "No value."
我看到一个回答说我需要添加 compileBitcode
但我的 dev.plist
文件中有:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>enterprise</string>
<key>teamID</key>
<string>1234ABCD</string>
<key>uploadBitcode</key>
<true/>
<key>compileBitcode</key>
<true/>
<key>uploadSymbols</key>
<true/>
<key>signingStyle</key>
<string>manual</string>
<key>signingCertificate</key>
<string>iOS Distribution</string>
<key>provisioningProfiles</key>
<dict>
<key>com.nfib-enterprise.engage-dv</key>
<string>ENGA - DEV - Dist</string>
<key>com.nfib-enterprise.engage-in</key>
<string>ENGA - INT - Dist</string>
<key>com.nfib-enterprise.engage-qa</key>
<string>ENGA - QA - Dist</string>
<key>com.nfib-enterprise.engage-ua</key>
<string>ENGA - UA - Dist</string>
</dict>
</dict>
</plist>
我通过 运行 以下命令解决了这个问题:
gem list | grep sqlite3
gem install sqlite3 --platform=ruby
rvm use system --default