AliSoftware / OHAttributedLabel

UILabel that supports NSAttributedString
https://github.com/AliSoftware/OHAttributedLabel/wiki
1.51k stars 344 forks source link

Adds Copy Header task to the Build Phase to fix the need to create a configuration for OHAttributedLabel when using configurations other than Debug and Release #157

Closed gdavis closed 10 years ago

gdavis commented 10 years ago

Instead of having to change the project settings whenever you are archiving or building using a configuration that is not the default Debug or Release, this pull request makes it so you can always archive and build no matter the configuration. The project using OHAttributed label needs to specify: "$(BUILT_PRODUCTS_DIR)/../../Headers" as a User Header Search path (including quotes) and $(OBJROOT)/UninstalledProducts as a Library Search Path

gdavis commented 10 years ago

Almost forgot, you will also need to add this to Library Search Paths: $(OBJROOT)/UninstalledProducts

AliSoftware commented 10 years ago

Didn't have time right now to open your modified xcodeproj in Xcode to check your actual changes (I don't have a Mac today) but normally you use a "Copy Files" for that, (and not "Copy Header Files", which does not work correctly for static libraries)

See see Apple TechNotes about that (emphasis mine).

To configure which headers are exported to clients, select your library project to open the project editor, select the library target to open the target editor, and select the build phases tab. If your library target has a “Copy Headers” build phase, you should delete it; copy headers build phases do not work correctly with static library targets when performing the “Archive” action in Xcode.

Next you will add a Copy Files build phase for exporting your headers. New static library targets created with Xcode 4.4 or later will come with an appropriately-configured Copy Files phase for headers, so you should check to see if you already have one before creating one.

When using "Copy Files" you won't need to add anything to the "Search Paths" build settings.

AliSoftware commented 10 years ago

Confirmed: this won't be merged, because this is not the way it should be done, as explained in Apple's TechNote quoted above.

I'm closing this issue now. If you still need to add the headers to the "Copy Files" phase, feel free to create a new pull request, but that does it the way Apple suggests in its TechNote ("Copy Files" phase and not "Copy Header Files" phase, which will avoid the need to alter the "Search Paths" too — see the TechNote for complete explanations)