You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a file to XCode Project (e.g., GoogleService-Info.plist)? #196
I'm wondering if there is a way to add a file to XCode project programmatically? Using copy is not sufficient, as XCode does not automatically recognize the new file in its folder. Thanks!
changed the title [-]Add a file to XCode Project (e.g., GoogleService-Info.plist)[/-][+]Add a file to XCode Project (e.g., GoogleService-Info.plist)?[/+]on Jul 18, 2023
I don't know how to do it in the YAML config, but I have done this with by own code.
I have written custom bash executables to automate a lot of the build processes for our Capacitor app. The bash file executes a typescript file based on Node.js.
import { MobileProject } from '@trapezedev/project';
import { Build, CommandOpts } from '../utils/common';
export async function run(build: Build, opts: CommandOpts) {
const project = new MobileProject(process.cwd(), {
android: {
path: 'platforms/android'
},
ios: {
path: 'platforms/ios/App'
}
});
// Load the project configuration
await project.load();
// Check if the android platform has been added
if (opts.android && project.android) {
const { configure } = await import('./platforms/android');
await configure(project.android, build, opts);
}
// Check if the iOS platform has been added
if (opts.ios && project.ios) {
const { configure } = await import('./platforms/ios');
await configure(project, project.ios, build);
}
// Commit the changes
await project.commit();
}
platforms/ios
You need to add "GoogleService-Info.plist" as a Resource file so that it is copied into the packaged app. As of v7.1.3 of trapeze/project there is a bug when using addResourceFile. The xcode package dependency v3.0.1 doesn't do any null checking when looking for a folder called "Resources". You can either manually add this yourself, or my code does it for you. I automated this part so we don't have to commit the platforms folder generated by Capacitor.
The xcode package devs have already fixed the bug, but it is only available in their v3.0.2-nightly build.
this.ios refers to the ios property on the MobileProject class.
Activity
[-]Add a file to XCode Project (e.g., GoogleService-Info.plist)[/-][+]Add a file to XCode Project (e.g., GoogleService-Info.plist)?[/+]Paradox7208 commentedon Feb 21, 2025
I don't know how to do it in the YAML config, but I have done this with by own code.
I have written custom bash executables to automate a lot of the build processes for our Capacitor app. The bash file executes a typescript file based on Node.js.
package.json
onetouch bash file
Without sharing too much of the code, in my typescript file, I have some code that looks like this:
commands/platform
platforms/ios
You need to add "GoogleService-Info.plist" as a Resource file so that it is copied into the packaged app. As of v7.1.3 of trapeze/project there is a bug when using
addResourceFile. The xcode package dependency v3.0.1 doesn't do any null checking when looking for a folder called "Resources". You can either manually add this yourself, or my code does it for you. I automated this part so we don't have to commit the platforms folder generated by Capacitor.The xcode package devs have already fixed the bug, but it is only available in their v3.0.2-nightly build.
this.iosrefers to the ios property on the MobileProject class.fix(project): repair diff pipeline, properties double-load, addFile b…