8

So frustrated with XCode right now. I can build and run from code perfectly fine. However, trying to archive is a disaster.

I created a project, then dragged the .xcodeproj into XCode on the project navigator. Shows up fine, cool. Parent project build settings:

Other linker flags: -all_load, -ObjC

Target Dependencies : CocoaLibSpotify (subproject I'm incorporating)

Link Binary with Libraries : libCocoaLibSpotify.a

When I build my project, the following lines work

#import "CocoaLibSpotify.h"
#import <CocoaLibSpotify.h>

However, when I archive, my project fails to find these files. It's worth noting that the subproject files aren't in the same directory as the parent project. However, isn't that the point of the target dependency/link binary with library? Why is it failing to archive? This seems like it should be a lot easier than it's being.

Thanks.

Edit: Errors from compiling

In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/AppDelegate.m:12:  
In file included from  /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/GUI/ViewControllers/LoginViewControll er.h:9:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/GUI/BaseViewController.h:10:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/Managers/Managers.h:9:
In file included from /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/Managers/AppLogicManager.h:11:
In file included from   /Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/CoreData/CoreDataObjects.h:13:
/Users/ericharmon/Projects/teamsync/teamsync/TeamSync/Classes/Model/CoreData/Track.h:13:9: fatal error: 'CocoaLibSpotify.h' file not found
#import <CocoaLibSpotify.h>
    ^
1 error generated.`
LyricalPanda
  • 1,424
  • 14
  • 25
  • Please post the log of the compile step (from the Log pane). – trojanfoe Nov 26 '12 at 15:50
  • Added the error. Let me know if you need the full compile log dump – LyricalPanda Nov 26 '12 at 16:01
  • 1
    I have seen this error myself in the past. My current project uses an Xcode Workspace and is working well with one master project and 3 sub-projects. Perhaps try using a Workspace yourself? – trojanfoe Nov 26 '12 at 16:11
  • I'll look into trying to use a Workspace and see if it solves the issue in that case :) – LyricalPanda Nov 26 '12 at 16:14
  • Just a side comment: I tried implementing the workspace and got the same errors. For now I've gone through and simply added each .h to my project just so I can get a build out the door. Not exactly sure what's going on, but after 3 hours it was getting a little ridiculous. – LyricalPanda Nov 26 '12 at 16:54
  • A better intermediate solution would be to add each `$(SRCROOT)/../subproject/include` to the *Header Search Path*. However adding the *Library Search Path* will almost certainly fail :( – trojanfoe Nov 26 '12 at 16:59

1 Answers1

16

Archive uses a different directory structure when building, which can be a pain. I've found success by adding the following to the User Header Search Paths build setting of your application's target:

"$(BUILD_ROOT)/../IntermediateBuildFilesPath/UninstalledProducts/include" (including the quotes).

Also, make sure Always Search User Paths is set to Yes.

In addition, I have $CONFIGURATION_BUILD_DIR/include in my Header Search Paths setting, but I don't think that'll help archiving.

iKenndac
  • 18,730
  • 3
  • 35
  • 51
  • Man, I never even noticed the "User Header Search Paths" setting in XCode... I just feel so dumb, you made my day. Thanks – Redwarp Apr 22 '13 at 16:59
  • The "User Header Search Paths" and "Always Search User Paths" together makes it work for me... breaking my head with this issue, and here comes the saviour!!!... Thank you @iKenndac – Mouli Apr 20 '15 at 14:29
  • super cool. thanks for the answer but does this change affect from hiding the option to create a ipa file?? because i am not able to create a application archive and instead of that i am able to see other options like "save build products " and "export as an xcode archive". the adhoc option is missing . – ravoorinandan Jul 13 '15 at 13:43