Skip to content

Fix crash when adding sub project.#762

Open
HDB-Li wants to merge 1 commit into
CocoaPods:masterfrom
HDB-Li:master
Open

Fix crash when adding sub project.#762
HDB-Li wants to merge 1 commit into
CocoaPods:masterfrom
HDB-Li:master

Conversation

@HDB-Li

@HDB-Li HDB-Li commented Jun 8, 2020

Copy link
Copy Markdown

I once mentioned a PR, but that branch was deleted by me, so I proposed a new one.

745 PR

In the current version(1.16.0), if you add a sub project to the project, the application will be crash when running, because the sub project will be added to the original Products PBXGroup, that's why it crashed. After manually adding the sub project through analysis, Apple will create a new Products PBXGroup, and add the sub project to the newly created Products PBXGroup, so we can do the same thing as Apple.
Another small problem, the remotoInfo of PBXContainerItemProxy should be the name of the project, but now is 'Subproject'.

@HDB-Li

HDB-Li commented Jun 9, 2020

Copy link
Copy Markdown
Author

@dnkoutso Hi, I resubmitted my PR, everything is ok now. I'm waiting for a review. 😄

@HDB-Li

HDB-Li commented Jun 10, 2020

Copy link
Copy Markdown
Author

Clear commit history.

@HDB-Li HDB-Li reopened this Jun 10, 2020
Comment thread lib/xcodeproj/project/object/helpers/file_references_factory.rb
@HDB-Li
HDB-Li requested a review from dnkoutso June 13, 2020 14:41

@HDB-Li HDB-Li left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

@HDB-Li

HDB-Li commented Jun 20, 2020

Copy link
Copy Markdown
Author

@dnkoutso I'm waiting for a review.

@dnkoutso

Copy link
Copy Markdown
Contributor

I am still trying to understand the fix and the issue. It also seems like a duplicate PR to #728.

I want to ensure this is not a breaking change for anyone.

@HDB-Li

HDB-Li commented Jun 20, 2020

Copy link
Copy Markdown
Author

@dnkoutso Fix the same problem in that PR. but that PR didn't work as same as Apple. remote_info also need changed. You can try to add a sub project to a project. to reappear the crash and find the differents between Apple and Xcodeproj.

@dnkoutso

Copy link
Copy Markdown
Contributor

@HDB-Li does this fix also fix this old issue CocoaPods/CocoaPods#7728?

@HDB-Li

HDB-Li commented Jun 24, 2020

Copy link
Copy Markdown
Author

@dnkoutso No.

@HDB-Li

HDB-Li commented Jun 27, 2020

Copy link
Copy Markdown
Author

@dnkoutso Do I need to provide a demo to describe what issue I had modified?

@dnkoutso

Copy link
Copy Markdown
Contributor

@HDB-Li apologies for this taking too long. I am uncertain whether this ends up being a breaking change for folks or not. Might not be but I want to somehow verify that. Can you post screenshots of what Xcode does manually?

@HDB-Li

HDB-Li commented Jul 18, 2020

Copy link
Copy Markdown
Author

@dnkoutso Hi, I've been working a lot recently, and I've been responding late. I have provided you with a set of demos. You can compare and see how the system works, how Xcodeproj does it, and how my version does it.

Demo : https://github.com/HDB-Li/XCodeProjDemos

Look forward to your reply.

@HDB-Li

HDB-Li commented Jul 18, 2020

Copy link
Copy Markdown
Author

I also provided a screenshot in demo.

@HDB-Li

HDB-Li commented Jul 22, 2020

Copy link
Copy Markdown
Author

@dnkoutso

@HDB-Li

HDB-Li commented Aug 27, 2020

Copy link
Copy Markdown
Author

@dnkoutso Hi

@HDB-Li

HDB-Li commented Oct 8, 2020

Copy link
Copy Markdown
Author

@dnkoutso Hi, Is there no reply to this question?

@HDB-Li

HDB-Li commented Apr 13, 2021

Copy link
Copy Markdown
Author

Did this problem fixed?

@HDB-Li

HDB-Li commented Apr 13, 2021

Copy link
Copy Markdown
Author

@dnkoutso hi

@avetiso

avetiso commented Jul 30, 2021

Copy link
Copy Markdown

@dnkoutso Hello, this crashing is causing a lot of issues for our mobile development team at MX Technologies. Is there any intent to fix it? If not, we will consider forking and maintaining a separate version of xcodeproj internally so we can fix the problem for our team, but would prefer not to if this can be fixed somehow.

Would love to hear back. Thanks!

@dnkoutso

Copy link
Copy Markdown
Contributor

hey @avetiso this PR needs a rebase and potentially an additional test?

We can see if we can get it merged but its relatively old now and needs a rebase at least.

@avetiso

avetiso commented Jul 30, 2021

Copy link
Copy Markdown

hey @avetiso this PR needs a rebase and potentially an additional test?

We can see if we can get it merged but its relatively old now and needs a rebase at least.

Okay. Let me see if I can find one of our devs that are most familiar with Xcode and our build system to take a look at this, as it's not my area of expertise.

@dnkoutso

Copy link
Copy Markdown
Contributor

FWIW cocoapods does offer multiple project generation for its projects so it must be getting the sub-project references right.

I saw similar code in cocoapods here https://github.com/CocoaPods/CocoaPods/blob/master/lib/cocoapods/native_target_extension.rb

ref.include_in_index = nil

product_group_ref = find_products_group_ref(group, true)
product_group_ref = group.project.new(PBXGroup)

@dnkoutso dnkoutso Jul 30, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does Xcode keep adding a new "Products" group for each subproject?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Xcode does add a "Products" group for every subproject.

@avetiso avetiso mentioned this pull request Aug 4, 2021
@deberle

deberle commented Jan 6, 2022

Copy link
Copy Markdown

I'd love to see this merged!

@avetiso

avetiso commented Jan 6, 2022

Copy link
Copy Markdown

@dnkoutso just FYI regarding this issue, we were able to find a way to fix the linker phase with this patch. We've pulled xcodeproj internal to apply this patch anyways, but it may be that the error with adding libraries to linker phase may have simply been use misusing other xcodeproj functionality.

@lxbndr

lxbndr commented Jul 12, 2024

Copy link
Copy Markdown

Ugh... I noticed xcode crashes after adding a subproject, and my investigation took me exactly to this point. We need one 'Product' group per subproject. These groups are referenced nowhere but in the project_reference[:product_group].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants