Xcode does not restore the application when the source file is updated in the dependent static library

I ran into a problem with implicit Xcode dependency checking and static libraries, which I consider to be a bug in Xcode (and report as such); I bring it up here if anyone has any ideas about this. In short, if the application depends on a static library, and the source file, which is a component of the library, changes, Xcode rebuilds the library, but does not redirect the application, so this change is not observed in the application.

In particular: I have a workspace containing the application project and the static library project, so the application calls the function in the library (and the result is seen in the application: for example, the function returns the text displayed in the shortcut in the application). The static library is included in the build phase of the Link Binary with Libraries application target. Building from scratch causes the library to be created first, and then the application, as expected (in other words, Xcode detected the dependency).

Now, if I change the message text in the source file of the library, then click the create and run button, Xcode will rebuild the library correctly, but will not be able to redirect the application, so when the application starts, the message text is displayed unmodified.

I am running Xcode 4.5.1 on Mac OS X 10.8.2. In the described scenario, the application is a one-time iOS application, and the called function of the static library is implemented in C ++.

I currently don't know any workarounds other than cleaning and rebuilding. Has anyone else seen this or had a different understanding? Thanks in advance.

+4
source share
1 answer

I initially searched for SO without success, but I should not formulate my searches correctly. However, when writing my question, the list of “similar questions” offered much better results, and I was able to find a workaround here . In short:

  • select a library in Project Navigator
  • Find a location in the File Inspector it’s probably “Relative to the group”
  • change it to "Regarding product assembly."

This fixed the problem in my test case; Now the application is correctly rebuilt whenever the source code of the library changes. I did not find it necessary to manually edit the project.pbxproj file as suggested.

I would still claim that this is a bug in Xcode, but at least right now I have a workaround.

+7
source

Source: https://habr.com/ru/post/1440834/


All Articles