cordova-node-xcode
cordova-node-xcode copied to clipboard
[Question] How to add file to PBXNativeTarget
I'm trying to add a file (GoogleServices-Info.plist) to my main project folder, but can't figure out what function to use. I've tried every one, and the best I can do is get it into my Plugins folder. Anyone know?
I thought these might work, but they didn't:
project.addToPbxGroupType(file, targetKey, 'PBXNativeTarget');
project.addToPbxFileReferenceSection(file);
// this one gives an error; sources is undefined
project.addToPbxCopyfilesBuildPhase(file);
@jukka You mean like this?
const groupName = 'RNCameraExample';
const [hash] = Object.entries(project.hash.project.objects['PBXGroup']).find(
([, group]) => group.name === groupName,
);
project.addFile('RNCameraExample/Foo.plist', hash, {});
Can you post your full script? I want to achieve the same thing but the file gets copied only to the root folder of my project.
Any idea if is possible to do this?