IPhone xcode search path for device vs simulator?

I am confused about this setting (Project -> Edit Active Target). Search paths may differ depending on the SDK setting (simulator versus device).

But if I provide both the simulator and the device path, as the Frameworks path allows, then I get linker errors. But it seems that I only provide the right path for whatever SDK I choose, then it builds perfectly!

How do I keep both path parameters? Currently I need to cut and paste the appropriate SDK-based path that I have chosen to build.

Thank!

+2


source to share


4 answers


You should have two separate target build profiles set up, one for the sim and one for the device, rather than constantly editing the same. That kind of goal.



+1


source


What kind of search path are you talking about? The system search paths are automatically handled for you, so I assume your problem is some custom library.

There are two solutions. You can use conditional settings or use generic libraries. I fell in love with generic libraries, but haven't had time to write complete instructions yet. The way they work is to create a static library for the simulator and device and then use lipo

them to glue them together. Then you can use the same library for both platforms. I really need to write complete instructions for this because it is very helpful.

There are two more approaches. You can use conditional settings first. In xcconfig files (see my talk about why using xcconfig files), you put something like this:

LD_FLAGS[sdk=iphonesimulator*] = -lsasl2

      



This binds sasl2 just for the simulator. Install whatever you need. Another solution is variable replacement:

HEADER_SEARCH_PATHS = "$(SRCROOT)/MyPackage/build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/include"

      

This assumes it MyPackage

is located in a subdirectory of your project and was embedded in the directory build

. It will look like, for example, Debug-iphoneos

for its variables.

You can also do both of the above in the build bar, but I really recommend people get away from the build bar for any serious project. Variable substitution is done the same in the build pane, and conditional settings are available from the right click on the setting.

+6


source


If you only use

  • project headers
  • SDK frame headers
  • sqlite3 headers

then your title search paths should be empty. Xcode automatically provides search paths for your project headers, SDK frameworks, and / usr / include / * .h, and configures them for the framework in use.

The only reasons for custom header search paths to appear are references to headers that are not in the SDK, are in "deep" locations in the SDK (for example, in / usr / include subdirectories or hidden frames), or are in other targets or projects of your cross project links.

+1


source


Rob has already hinted at this, but explained how you installed it using the build window.

In the Build Settings window, select the setting you want to change (for example, Framework Search Paths). Then click the gear in the lower left corner and select Add Build Customization Condition. Then you can add a value that only applies to the iOS Simulator and a second build customization condition to apply to device strings only.

+1


source







All Articles