1

I'm adding a custom framework to my Xcode project using the xcodeproj Ruby Gem:

top_group = project.groups[0]
framework_ref = top_group.new_file(framework_path)
target = project.targets[0]
target.frameworks_build_phase.add_file_reference(framework_ref)

When I then open Xcode and look at the target, the framework is listed correctly under Linked Frameworks and Libraries, yet the linker complains that the framework cannot be found when building. Dragging the framework in the Linked Frameworks list in Xcode fixes it, and I can build successfully.

Why? Dragging seems to force Xcode to regenerate the project.pbxproj and add a missing reference. What would that be?

MGY
  • 7,245
  • 5
  • 41
  • 74
pr1001
  • 21,727
  • 17
  • 79
  • 125

2 Answers2

1

you need to set the path where your framework is!

append the path in build settings for "FRAMEWORK_SEARCH_PATHS"

settings = target.build_settings("Debug")
settings["FRAMEWORK_SEARCH_PATHS"] = [settings["FRAMEWORK_SEARCH_PATHS"], your_framework_directory ]

or

settings["FRAMEWORK_SEARCH_PATHS"] = settings["FRAMEWORK_SEARCH_PATHS"] + " " + your_framework_directory ]
Chakalaka
  • 2,807
  • 19
  • 26
0

Append the path in build setting as follows:

#Add framework search path
settings = target.build_settings("Release")
settings["FRAMEWORK_SEARCH_PATHS"] = Array(settings["FRAMEWORK_SEARCH_PATHS"])<< '$(PROJECT_DIR)/SDK'
settings["LIBRARY_SEARCH_PATHS"] = Array(settings["LIBRARY_SEARCH_PATHS"])<< '$(PROJECT_DIR)/SDK'
parkycai
  • 1
  • 1