Comments (16)
I might need to do some research about this one. Couple of questions:
- Are you opening the pods project?
- Your goal is to add it to both targets at the same time?
- What kind of file are you trying to add? (extension of the files)
- Does it work if you add them in another non-pods project?
from mod-pbxproj.
- I am opening the pods project.
- I would like to add these first just to Pods project first target.
- .h and .m
- Yes, it works, when I developing my pods, But when I submit the pods and manage it with cocoapods, and run this script to add files to
Pod
project, some of the code there cannot be executed.
from mod-pbxproj.
can you provide a pod's xcode project?
from mod-pbxproj.
Through email?
from mod-pbxproj.
share it in a gist. https://gist.github.com/
from mod-pbxproj.
This is the correct project https://gist.github.com/Draveness/0c0ced9fb54bd30b8ce9
from mod-pbxproj.
This is a wrong proj https://gist.github.com/Draveness/2e913c74c7f24878da1f which is added through this:
project = XcodeProject.Load(pbxproj_file_path)
project.remove_group_by_name('UIKit', True)
project.save()
main_group = project.get_groups_by_name('DKNightVersion')[0]
uikit_group = project.get_or_create_group('UIKit', None, main_group)
groups = json.load(open(json_file_path))
for group, files in groups.iteritems():
new_group = project.get_or_create_group(group, None, uikit_group)
for f in files:
project.add_file(f, new_group)
project.save()
from mod-pbxproj.
I tested the following script
#!/usr/bin/python
import sys
from mod_pbxproj import XcodeProject
pathToProjectFile = 'test/test.xcodeproj/project.pbxproj'
project = XcodeProject.Load( pathToProjectFile )
framework_path = 'System/Library/Frameworks/WebKit.framework'
framework_group = project.get_or_create_group('Frameworks')
project.add_file(framework_path, parent=framework_group)
project.add_file('source.m', framework_group)
project.add_file('source.h', framework_group)
project.save()
The files were added properly to ALL targets (see images below, note the black letters instead of red ones.)
My suggestion though, is not to use add_file
directly, but use add_file_if_doesnt_exist
instead, it adds some validations and avoid duplications.
from mod-pbxproj.
Do you means I are supposed I should use add_file_if_doesnt_exist
instead of all all_file
methods?
from mod-pbxproj.
wait, i didn't see the second gist. I'm rechecking...
from mod-pbxproj.
OK, I am trying now..
from mod-pbxproj.
I found something. Can you:
- comment out you
project.remove_group_by_name('UIKit', True)
- remove the group manually from xcode
- rerun your code.
I suspect there was an exception during the remove process that aborted the execution of the rest.
from mod-pbxproj.
I tried, but not work.... I am really confused with this...
from mod-pbxproj.
I committed a change regarding the remove_group_by_name. please update and try again. If still fails i have to dig deeper in the issue, it will take a while.
from mod-pbxproj.
I have already use xcodeproj instead, I think it is a problem this doesnot adding files to correct target.
from mod-pbxproj.
Thx for your help 👍
from mod-pbxproj.
Related Issues (20)
- again How to add one framework just want to build it output as a framework with my main proj HOT 2
- [BUG]When I use setup.py to install pbxproj module syntax error occured. HOT 1
- conda forge package HOT 2
- [FEAT] How to add sub-project into current project, but sub-project has two kinds of target type
- [BUG] This one project loads but doesn't save HOT 2
- Moving an existing group to another group HOT 2
- update flag HOT 1
- [BUG] Update multible Flags HOT 2
- [FEAT] Can I change setting on Build Settings > Signing HOT 1
- [FEAT] How do you get a flag value ? HOT 1
- [FEAT]Can I find my favorite books at will?
- Referencing files into UnityFramework
- File or folder association settings
- add_package [BUG]
- remove a file with fileID HOT 1
- [BUG] Local package XCLocalSwiftPackageReference is not getting parsed properly HOT 1
- [BUG] Build steps that have shell commands lose formatting when project is saved
- [FEAT] add flag with null value
- Cannot create subfolders HOT 2
- [BUG] Exception is thrown when finding `productRef` instead of `fileRef`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mod-pbxproj.