@TachyonVortex解决方案似乎是最好的选择,但在我的情况下崩溃了。该问题是由 plist NPM 包未正确转换的空 NSMainNibFile 字段引起的。在.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'); // nodejs.org/api/fs.html
var plist = require('plist'); // www.npmjs.com/package/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>