Skip to content

Instantly share code, notes, and snippets.

@akofman
Last active July 5, 2016 19:57
Show Gist options
  • Save akofman/b53124f76ec309160e08 to your computer and use it in GitHub Desktop.
Save akofman/b53124f76ec309160e08 to your computer and use it in GitHub Desktop.
Cordova hook to disable bitcode for ios9 projects.
#!/usr/bin/env node
/*
* Disable bitcode for ios9 projects.
* versions:
* xcode 0.8.2
* cordova-lib 5.3.3
*/
var xcode = require('xcode');
var fs = require('fs');
var util = require('cordova-lib/src/cordova/util');
var ConfigParser = require('cordova-lib/src/configparser/ConfigParser');
var projectName = new ConfigParser(util.projectConfig(util.isCordova())).name();
var projectPath = './platforms/ios/' + projectName + '.xcodeproj/project.pbxproj';
var myProj = xcode.project(projectPath);
myProj.parse(function (err) {
if(err){
console.log('Error: ' + JSON.stringify(err));
}
else{
myProj.updateBuildProperty('ENABLE_BITCODE', 'NO');
fs.writeFileSync(projectPath, myProj.writeSync());
console.log('✔ BITCODE disable');
}
});
@ashconnell
Copy link

Nice! Thanks for this, manually changing each build is annoying.

I ended up manually entering the projectName removing the need for cordova-lib dependency

@akofman
Copy link
Author

akofman commented Nov 16, 2015

You're welcome ! I also write a plugin version if you prefer not to copy/paste this hook for all your projects :
https://github.com/akofman/cordova-plugin-disable-bitcode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment