I have a bit of a problem with setting different configuration for my project. I have two versions of the same static library. One has logging enabled, the other doesn't.
I am using two different xcconfig files for Debug vs. Release. In these files I specify the library and header search paths for the two variants of the static lib. So far so good.
However, in my build settings I can't see a way to conditionally link the actual library. I.e use the debug variant for Debug and the release for Release.
Any ideas?
You need to link the library using the "Other Linker Flags" build setting, rather than the standard "Link Binary With Libraries" UI. The build setting can be changed depending on the configuration:
Click the triangle and you can give different values for Debug/Release. You will need to use the -l flag. For example, for a filename of libMyLib.a use the flag -lMyLib. You may need to edit the "Library Search Paths" to search the appropriate location.
If the filenames for the debug and release version are the same and you don't want to change them, put them into their own lib/Debug and lib/Release directories respectively. Then edit the "Library Search Paths" build setting adding either "$SRCROOT/lib/Debug" or "$SRCROOT/lib/Release" for the appropriate configuration.
I just used Xcode's refactoring tool to rename a core data class from Player to Person. After fixing about 100 errors resulting from using dot notation that Xcode missed in the rename, I got to the last one:
Player.m - Lexical or Preprocessor issue - 'Person.h' not found
Player.m no longer exists in the project, and shows up as deleted (empty icon) in the error. Obviously, since I got rid of it, I don't want it to exist anymore!
To fix this, I have tried re-adding an old copy of Player.h and Player.m, and also cleaning. I have checked the Build Phases->Compile Sources section, and Person.m is there, Player.m is not. Person.h does in fact exist.
Not sure if it matters, but I am using mogenerator to generate my core data classes. Also, this is my third xcdatamodel version. Versions 1 and 2 used Player.h.
Here is a screenshot of the error:
Try clean build, if that doesn't work, restart Xcode, if that doesn't, delete the DerivedData directory, maybe even reboot.
Xcode sometimes gets confused.
You can try to do a super clean (not sure what the real term is) by hitting Cmd+Alt+Shift+K. This performs a clean and removes everything from the build folder.
Well I had a very similar problem and solve it removing the missing compile source of my project settings. to do that follow these steps
Click at the project page. This page contains the general settings
of your app
Select Build phases.
In Build Phases section, select compile sources.
If there is missing some class or file or something that needs to be compiled.
Select water mark file and click the minus sign at the bottom of this section.
Just click and the project may run. I hope this help others.
I'm having a really tough time getting XMPPFramework to work.
I've followed every direction written on the net, and XCode is not finding any of my XMPPFramework classes.
Expected specifier-qualifier-list before 'XMPPStream'
XMPP.h: No such file or directory
XMPPRoster.h: No such file or directory
I have XMPPFramework copied into my project's root directory. Why can't these files be seen? Is there something that I need to do under Header Search Paths or Library Search Paths?
I've set those entries to $(inherited) and $(SRCROOT) and XCode 4.2 auto-fills in my project's root directory and still doesn't find my files.
I'm quite sure that I'm not the only one having this issue, and it is a showstopper. Any ideas?
The wiki on github is out of date. Here is how I installed XMPPFramework manually.
Step 1
Clone the XMPPFramework repository to somewhere on your machine and drag the needed folders in somewhere/XMPPFramework to your Xcode project.
The necessary folders are:
Vendor/CocoaAsyncSocket
Vendor/CocoaLumberjack
Vendor/KissXML
Vendor/libidn
Authentication
Categories
Core
Utilities
You may also need Extensions, it's optional though.
It's important to select the checkbox/radio buttons exactly like this image when dragging folders to your Xcode:
Step 2
a) Drag Sample_XMPPFramework.h to your Xcode and select the checkbox/radio buttons like step 1
b) rename it to XMPPFramework.h
c) customize the content of XMPPFramework.h based on your needs. (I didn't change anything)
The file structure should look like this in Xcode project navigator after doing step 1 and 2:
Step 3
link following frameworks and libraries
CFNetwork.framework
Security.framework
libxml2.dylib
libresolv.dylib
libidn.a
Step 4
Added these 2 lines to Build Settings:
other linker flags = -lxml2
HEADER SEARCH PATHS = /usr/include/libxml2
You should be good after these 4 steps. However, please notice that you usually need to #import <UIKit/UIKit.h> before using XMPPFramework
At the XMPPFramework gitHub wiki 1 there is a step by step instruction that helps setting up XMPPFramework for your project.
In fact the error you have mentioned is close to what is also indicated by the instructions.
"However, upon importing an XMPPFramework class, such as by calling
'#import XMPP.h' will cause XCode to show an error 'XMPP.h' not found.
It appears that XCode is not finding any of the XMPPFramework files."
I hope this gives you enough information to solve this issue you are facing, even though the instructions are not targeted specifically to iOS-5.
Additional information related to the instructions in #Brian's answer.
Addition to Step 3:
If a lib file such as libxml2.dylib is not available in the "Choose frameworks and libraries to add" window, follow these steps to find it:
Click Add Other...
In the file selection window, COMMAND+SHIFT+G (Go to folder)
Type /usr/lib and then Enter or click Go
Select the .dylib file you need and click Open
After Step 4:
Also note that XMPPFramework and its dependencies use ARC.
If your app primarily uses MRR instead of ARC, either convert your app to ARC or perform step 5.
Step 5
Add -fobjc-arc compiler flag to the XMPPFramework files.
In Xcode, for each target that will use XMPPFramework,
Go to the target's settings
Go to Build Phases
Expand Compile Sources
Select all the XMPPFramework-related files in the list
Press Enter to open the edit window for compilers flags
Type -fobjc-arc
Enter again to save the change.
The Compile Sources list is unsorted, so it is helpful to use the search field to filter the list on XMPP and then on XEP. That finds most of the files, but there are still some that have to be picked out from the full list of files.
I downloaded one of the sample apps for iOS and it gives me the above error.
No launchable executable present at path /Users/..../MyProject/build/Debug-iphonesimulator/MyProject.app
What i do have is the MyProject/build/MyProject.build/Debug-iphonesimulator/GeneratedResources.build/ some files.
No build errors.
When I see in the finder the directory is indeed not even present. What could be the problem ?
Update: Yes, i did try cleaning & deleting Build directory, doesn't help
I also had this same error code for my project. I was using a number in the Target -> Product Name. Once I changed the Product Name of the target to letters only everything worked fine.
Try opening the Info.plist and removing "executable name" value if it's filled with custom string instead of string variable (the one that should look like ${FOO_BAR}, but doesn't).
I had this problem. it turned out I had the active target set incorrectly, in my case to a cocos library instead of to my own app.
After trying the things mentioned here, also make sure you click on "Clean All Targets" then quit XCode and restart XCode. This fixed it for me and many others on the web!
I had the same problem. In my case, I had an additional target for the same project (which contained test libraries). At some point xCode always tried to launch the test binary, regardless of what binary it compiled.
Removing the pbxuser and perspective files (inside project.xcodeproj) solved it for me.
I'm getting this error when building my iPhone application:
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library
/Frameworks/UIKit.framework/UIKit, missing required architecture i386 in file
It goes the same for all the frameworks in my app. It's very weird since this was not happening earlier.
This happens when you add a framework to your project and unintentionally copy the framework into your project directory.
The fix is to check your project directory (where you store your project on disk) for any iphone SDK *.Framework files and delete them.
Project will build fine afterwards.
I had this same problem, and the solution turned out to be an easy fix. Backup then open project.pbxproj (located inside your project file bundle) in TextMate or TextEdit and search for the section titled "/* Begin XCBuildConfiguration section */". Look for a key named FRAMEWORK_SEARCH_PATHS and delete it and it's contents (once per build configuration, so I removed it in two places). Here is an example of what I deleted:
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"\"$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library/Frameworks\"",);
My project now build for both the iPhone device and the iPhoneSimulator.
What has happened here is that Xcode has mysteriously added a "Framework Search Paths" entry that points to a particular iPhone device SDK. For example, mine was recently set to:
$(DEVELOPER_DIR)/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.2.1.sdk/System/Library/Frameworks
This leads the compiler to find frameworks of the incorrect architecture. Removing any values under the "Framework Search Paths" key in your target's build settings will resolve the issue.
I just wanted to mention that in XCode if you go to "Edit Project Settings"
and find "Search Paths" There is a field for "Framework Search Paths". Updating this should fix the problem, without having to hack the project file!
Cheers!
Jesse
Check that you didn't copy the framework into your project when you added it. If you copied it, it can't find the original paths. To fix this problem. Delete the AVFoundation framework from your frameworks folder in your project, then add it again, but this time, make sure you don't have copy check marked.
This fixed it for me!
I fixed it in a different way.The reason why i was getting this error was that i added security.framework twice in my project.I was not able to see security framework in xcode ,i opened the project in finder and found this framework which i deleted and problem solved.
If your app is meant to run on the device, make sure you are not trying to run in it on the simulator. May sound obvious, but check anyway.
Though it is possible that something got deleted, it has been my experience that something gets screwed up in the project file. I have yet to pin down what that "something" is. I've had similar issues when the SDK installation is just fine. There are a couple of options.
First, add all of your files to a new project. This seems to usually work. Kind of a pain, though.
Second, you can right-click project in XCode/Get Info/Build/Library Search Paths. Add new paths similar to /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.sdk/usr/lib. Add appropriate versions of that string for each version (2.2.1, etc) and platform (simulator or iPhoneOS). Perform a similar action for Framework Search Paths if frameworks are your problem.
Third, which is more work but more reliable, is to open project.pbxproj from within MyProject.xcodeproj (Textmate is good for this). Look for "/* Begin XCBuildConfiguration section */", then "LIBRARY_SEARCH_PATHS" and "FRAMEWORK_SEARCH_PATHS". Add or modify the paths as appropriate, and save the file.
In any case, a pain in the butt, and I'd sure like to pin-point the cause because I've had this happen a couple of times. Project builds fine, then just up and refuses to do so with what seems to be little reason.
"Edit Project Settings" and find "Search Paths" There is a field for "Framework Search Paths". delete all!!
It just happened here to me as well. Thanks to a great partner we found the answer. Your Xcode may be pointing to the simulator ..change it to a IOS device instead ..built smooth after ....
Run the file command on the framework from Terminal:
file /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.sdk/System/Library /Frameworks/UIKit.framework/UIKit
You should get back a message telling you which architectures the UIKit binary is compatible with. If you don't see "i386" listed, then you've somehow managed to remove the i386 version of UIKit, which will mean that you can't build for the simulator.To fix that, you'll have to re-install the SDK.
If you get some other error, hopefully it'll help you figure out what the actual problem is.
I just want to let you know that In my case, I was having the same problem, I realized that I had an older Xcode folder called Xcode3.1.3 I just rename it because it was an older version and that did the magic for me.
Check your library search paths in your target settings. Sometimes goofy libraries get entered in there and this will give you a similar error.
You can remove all entries in this section.
I'd just experienced something slightly different, because I work on my own library (WM_GSRecognizerLib), but the error is the same.
What'd happen: due to some updates, the path targeting the lib to include (.a) was from the "Debug-iphoneos" folder (where it is generated). Compiling for Generic iOS Devices worked fine, but not for simulator, complaining for the missing i386 architecture.
What I did for this issue, is to also include the binaries from the "Debug-iphonesimulator" folder.
It can help for this topic, because the explanation is here: devices require binaries for arm64/armv7/armv7s, while simulator does need i386.
My solution was to set on simulator target debug YES, just look on git status to see the new line added as architecture only on .project. if you don't set this the build will run to all architectures and will show some missing architecture like i386 or other.
NOTE THAT obviously the main issue is to use some framework that implements some kind of specific architecture.
I too got the same error am using xcode version 4.0.2 so what i did was selected the xcode project file and from their i selected the Target option their i could see the app of my project so i clicked on it and went to the build settings option.
Their in the search option i typed Framework search path, and deleted all the settings and then clicked the build button and that worked for me just fine,
Thanks and Regards