node-xcode
node-xcode copied to clipboard
looking for an example
I keep getting an error when trying the xcode npm module. I simplified everything down and here is my code:
var projectPath = 'myapp.xcodeproj/project.pbxproj', myProj = xcode.project(path.resolve(projectPath)); //var hardcoded = path.resolve('myapp', 'node_modules','com.test','CDVCamera.m'); //var hardcoded = "myapp" +"/node_modules/"+"com.test"+"/CDVCamera.m"; //var hardcoded = 'Plugins/' + 'com.test' + "/CDVCamera.m"; var hardcoded = fixPathSep(path.relative('Plugins','com.test', 'CDVCamera.m')); console.log('hardcoded is: ' + hardcoded); myProj.addSourceFile(hardcoded);
and everything fails on the myProj.addSourceFile method
TypeError: Cannot read property 'project' of undefined at pbxProject.pbxGroupByName (/Users/ldeluca/.nvm/v0.11.14/lib/node_modules/ibm-sdk/node_modules/xcode/lib/pbxProject.js:403:27) at correctForPluginsPath (/Users/ldeluca/.nvm/v0.11.14/lib/node_modules/ibm-sdk/node_modules/xcode/lib/pbxProject.js:700:17) at pbxProject.addPluginFile (/Users/ldeluca/.nvm/v0.11.14/lib/node_modules/ibm-sdk/node_modules/xcode/lib/pbxProject.js:88:5) at pbxProject.addSourceFile (/Users/ldeluca/.nvm/v0.11.14/lib/node_modules/ibm-sdk/node_modules/xcode/lib/pbxProject.js:112:21)
Before myProj.addSourceFile you need to add myProj.parseSync();
ok, had the same issue. Wish that was in the main example or at least addressed in the README.md