@TachyonVortex解决方案似乎是最好的选择,但在我的情况下却崩溃了。此问题是由空的NSMainNibFile字段引起的,该字段未由plist NPM软件包正确转换。在.plist文件中
<key>NSMainNibFile</key>
<string></string>
<key>NSMainNibFile~ipad</key>
<string></string>
转换为:
<key>NSMainNibFile</key>
<string>NSMainNibFile~ipad</string>
我通过添加到脚本来修复它:
obj.NSMainNibFile = '';
obj['NSMainNibFile~ipad'] = '';
脚本最终看起来像(scripts / my-hook.js):
var fs = require('fs');
var plist = require('plist');
var FILEPATH = 'platforms/ios/***/***-Info.plist';
module.exports = function (context) {
var xml = fs.readFileSync(FILEPATH, 'utf8');
var obj = plist.parse(xml);
obj.GDLibraryMode = 'GDEnterpriseSimulation';
obj.NSMainNibFile = '';
obj['NSMainNibFile~ipad'] = '';
xml = plist.build(obj);
fs.writeFileSync(FILEPATH, xml, { encoding: 'utf8' });
};
和config.xml:
<platform name="ios">
<hook type="before_build" src="scripts/my-hook.js" />
</platform>