Carthage: Use Framework Search Paths instead of adding frameworks to "Linked Frameworks and Libraries" section?

Created on 5 Jul 2018  ·  14Comments  ·  Source: Carthage/Carthage

The getting-started guide suggests drag and drop each frameworks into the "Linked Frameworks and Libraries" section. However, I found that if I add $(PROJECT_DIR)/Carthage/Build/iOS to the Framework Search Paths build setting, there is no need to do this step. As long as the copy framework build script is correctly set up, the application target can be built and run successfully.

Is this something recommended? Or am I missing the obvious here?

question

All 14 comments

Do you see your frameworks referenced anywhere in the Xcode project?

I don't think your necessarily doing anything wrong.

I tried it out with a new iOS project and added Alamofire in Carthage using this way. I was able to import Alamofire and made a request.

Good to hear that I'm not doing anything obviously wrong here. This is one less step to configure in the Xcode project when adding or removing dependencies with Carthage. It could definitely some time.

I'm not aware of any differences between these approaches. 🤔

Cool. Thanks for clarification. I will close the issue.

Hi:

I am on Xcode Version 10.1 (10B61). I am having the following problem, which is related to this issue: If I do not add $(PROJECT_DIR)/Carthage/Build/iOS to the FRAMEWORK_SEARCH_PATHS, then I get no such module <module_name> errors. My root directory is as follows:

APP.xcodeproj
APP.xcworkspace
Cartfile
Cartfile.resolved
Carthage
... (other files)

Any help would be appreciated, as I am using cocoapods also, and setting the FRAMEWORK_SEARCH_PATHS has incompatibility issues (as cocoapods is also setting its values there).

FRAMEWORK_SEARCH_PATHS is needed for the linker, you need to tell it where to find the frameworks you mention.

I could not find any information about it: reading issues, and because the README does not say anything about setting FRAMEWORK_SEARCH_PATHS, I was thinking that something was wrong in my setup.
So, to be 100% clear, setting FRAMEWORK_SEARCH_PATHS is a mandatory step in the setup of Carthage?

You don't need to set it. If you drag and drop Xcode will add the search locations automatically. If something is overriding it then you might have a problem.

Okey, thanks. Yes, I am getting into trouble because I am using xcconfig files... Thanks! @blender

@tmspzz: I'm using XCode Version 10.2.1 (10E1001) and I get the same result with OP.

Follow to the tutorial, instead of step [3], I only need to add $(PROJECT_DIR)/Carthage/Build/iOS in Build Setting > Framework Search Paths and all frameworks are ready to use.

[3] On your application targets’ General settings tab, in the “Linked Frameworks and Libraries” section, drag and drop each framework you want to use from the Carthage/Build folder on disk.
And this is unnecessary.

If we can update it in Carthage tutorial (at least for iOS), we can reduce the step "Linked Frameworks and Libraries" every time we add new framework.

sample: CarthageTest.zip

@nahung89 Is it safe to do this? even if we have both Carthage and Pod

@Dania-Dl as a side note, I would recommend using XcodeGen, which solves the carthage integration for you

Changing the framework search paths will only work at link-time. That setting alone will not allow your app to find its dynamic frameworks on a device.

Just hit similar problem as @acecilia : in my case I was providing custom path for app's archiving configuration to look for frameworks in the Release products directory.

Was this page helpful?
0 / 5 - 0 ratings