node-xcode
node-xcode copied to clipboard
addFramework throws Cannot read property 'children' of null error
I am using the simple example from the xcode npm module readme file:
var xcode = require('xcode'),
fs = require('fs'),
projectPath = 'test.xcodeproj/project.pbxproj',
myProj = xcode.project(projectPath);
// parsing is async, in a different process
myProj.parse(function (err) {
//myProj.addHeaderFile('foo.h');
//myProj.addSourceFile('foo.m');
var path2files = "test.framework";
myProj.addFramework(path2files);
fs.writeFileSync(projectPath, myProj.writeSync());
console.log('new project written');
});
If I comment out .addFramework I get the 'new project written' message. but if i leave it in I get an error. The file is in the same location where i'm running my npm module from. I tried playing with the path variable (which is why it's a var) but no luck.
error:
/Users/ldeluca/.nvm/v0.11.14/lib/node_modules/sdk/node_modules/xcode/lib/pbxProject.js:328
pluginsGroup.children.push(pbxGroupChild(file));
^
TypeError: Cannot read property 'children' of null
at pbxProject.addToFrameworksPbxGroup (/Users/ldeluca/.nvm/v0.11.14/lib/node_modules/sdk/node_modules/xcode/lib/pbxProject.js:328:17)
at pbxProject.addFramework (/Users/ldeluca/.nvm/v0.11.14/lib/node_modules/sdk/node_modules/xcode/lib/pbxProject.js:194:10)
at pbxProject.
To workaround, create a group named "Frameworks".