apache / cordova-ios

Apache Cordova iOS
https://cordova.apache.org/
Apache License 2.0
2.15k stars 986 forks source link

Embedding an external Xcode project in plugin.xml is broken #994

Open kafumanto opened 3 years ago

kafumanto commented 3 years ago

Bug Report

Problem

In cordova-ios v5.1.1, the below snippet can be used in plugin.xml to embed, in the generated Xcode project of the final app, a reference to an external Xcode project used by the plugin adding a list of its targets as dependencies for the final app:

<plugin ...
  <platform name="ios">
    <!-- Create a reference to "MySubLib.xcodeproj" in the generated app project -->
    <framework src="_build/MySubLib.xcodeproj" custom="true" type="projectReference" />
    <!-- Add the needed dependencies to the final app target -->
    <framework src="libMySubLib.a" />

"_build/MySubLib.xcodeproj" is inside the plugin source directory (specifically generated by a CMake-project, but this is not relevant).

The above is broken in cordova-ios v6.1.1.

What is expected to happen?

The above snippet should work the same as before in cordova-ios v6.1.1.

What does actually happen?

The project file (project.pbxproj) generated with v6.1.1 doesn't include all the correct information from the embedded project (it did it with v5.1.1). In the generated Xcode project are inserted both the reference to the external project and the list of dependencies, but not including all the embedded information from the external project the used UUIDs of the targets are missing/wrong, resulting in the final dependencies invalid.

If you take a snapshot of the generated project.pbxproj during each steps of its generation, and at the end you open it with Xcode, you can notice that Xcode "fixes" the project file adding all the missing references (but it's unable to fix the dependencies, as their UUIDs are missing/wrong). The result is a broken project that can't be built, neither with cordova build ios nor from Xcode.

Taking the same snapshots with cordova-ios v5.1.1, shows that the project was correctly generated in the first step. Resulting in a valid and buildable project.

kafumanto commented 9 months ago

Hi guys, just a kind ping after 3 years :)

I continue to have the same need and the problem is still present (it was up to 6.3 and now 7.0.1). Any hope for a solution or workaround? Or maybe is this doable in a new way? Thank you!