GithubHelp home page GithubHelp logo

Comments (16)

kronenthaler avatar kronenthaler commented on September 26, 2024

I might need to do some research about this one. Couple of questions:

  1. Are you opening the pods project?
  2. Your goal is to add it to both targets at the same time?
  3. What kind of file are you trying to add? (extension of the files)
  4. Does it work if you add them in another non-pods project?

from mod-pbxproj.

draveness avatar draveness commented on September 26, 2024
  1. I am opening the pods project.
  2. I would like to add these first just to Pods project first target.
  3. .h and .m
  4. 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.

kronenthaler avatar kronenthaler commented on September 26, 2024

can you provide a pod's xcode project?

from mod-pbxproj.

draveness avatar draveness commented on September 26, 2024

Through email?

from mod-pbxproj.

kronenthaler avatar kronenthaler commented on September 26, 2024

share it in a gist. https://gist.github.com/

from mod-pbxproj.

draveness avatar draveness commented on September 26, 2024

This is the correct project https://gist.github.com/Draveness/0c0ced9fb54bd30b8ce9

from mod-pbxproj.

draveness avatar draveness commented on September 26, 2024

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.

kronenthaler avatar kronenthaler commented on September 26, 2024

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.

screen shot 2015-05-05 at 18 07 32
screen shot 2015-05-05 at 18 07 48

from mod-pbxproj.

draveness avatar draveness commented on September 26, 2024

Do you means I are supposed I should use add_file_if_doesnt_exist instead of all all_file methods?

from mod-pbxproj.

kronenthaler avatar kronenthaler commented on September 26, 2024

wait, i didn't see the second gist. I'm rechecking...

from mod-pbxproj.

draveness avatar draveness commented on September 26, 2024

OK, I am trying now..

from mod-pbxproj.

kronenthaler avatar kronenthaler commented on September 26, 2024

I found something. Can you:

  1. comment out you project.remove_group_by_name('UIKit', True)
  2. remove the group manually from xcode
  3. rerun your code.

I suspect there was an exception during the remove process that aborted the execution of the rest.

from mod-pbxproj.

draveness avatar draveness commented on September 26, 2024

I tried, but not work.... I am really confused with this...

from mod-pbxproj.

kronenthaler avatar kronenthaler commented on September 26, 2024

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.

draveness avatar draveness commented on September 26, 2024

I have already use xcodeproj instead, I think it is a problem this doesnot adding files to correct target.

from mod-pbxproj.

draveness avatar draveness commented on September 26, 2024

Thx for your help 👍

from mod-pbxproj.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.