please take a look at the picture:
It's my project structure:
1 app(top one)
3 frameworks (create by myself)
1 cocoa pods static library(bottom one)
When I cmd+b, all the sub projects would be build start from the bottom one to the top one, here is no problem, everything are fine.
To refer/link the frameworks, I drop the framework product to every sub project's /Build Phases/Link Binary With Libraries and /Build Phases/Copy Files.
The problem is:
When I copy/move the project folder to another place (like ~/oldFolder/app to ~/newFolder/app) the sub project cannot finds the frameworks, it report Not Found Error, I need re-build and drop the framework product to link to fix the error.
It's too stupid and hard to work with other people, anyone can help?
p.s.: sorry for my poor english.
Add error pic:
You can use $(SRCROOT) if you want to refer paths relative to your source directory . $(SRCROOT) will point where your project files are . apple doc
An example :
if you have a directory x in your MyApp folder which contains your project file then the folder x can be reffered as $(SRCROOT)/x. Enter this in frameworks path section in Build settings to refer to your library .
This all boils down to you not being able to change the location of the already imported frameworks right? This is an example with the FBSDKCoreKit.framework. If I were to change the folder location I would need to change the relative path. Click on the folder Icon right next to the name and choose the new location
I post the detail of how to fix this issue on my side here:
In Framework:
set "$(SRCROOT)/../build" at item "Per-configuration Build Products Path" in Build Setting page;
shift+cmd+k to clean up the framework build, then cmd+b rebuild the framework;
In MyApp
add "$(SRCROOT)/../build" at item "Framework Search Path" in Build Setting page;
Drag the framework from the product of framework project to "Link Binary With Libraries" in Build Phases page;
Drag the framework from the product of framework project to "Copy Files" in Build Phases page(you can add the "Copy Files" item by
click the top left of Build Phases page);
Please note if you use one more framework in the same project, and the framework also links to another one like the sample I sent in my question, you also need to do all the steps as above I posted(Steps of Framework and App).
Another problem you will meet if you also use cocoapods in your project like my sample: After you done all the steps above, XCode will response error in your framework project like:
ld: framework not found Pods_xxx.framework
clang: error: linker command failed with exit code 1 (use -v to see invocation)
The "xxx" should be your framework project name. To fix it, you just need remove the Pods_xxx.framework in your project/General/Linked Frameworks and Libraries. The error will be disappeared after you rebuild the project. Here you can find the detail of this problem.
p.s.: the Pods_xxx.framework will appear in General/Linked Frameworks and Libraries after you install pod, so you need remove it again if you run command "pod install"
I have faced a problem where my game works fine but when I am trying to make it work with AdMob, it gives me error in Xcode.
The error is
ld: framework not found GoogleMobileAds
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
But my point is that I have imported the GoogleMobileAds framework and all the other frameworks what google developer site said, but it still doesn't work.
and this:
In Xcode select your Target, go to Build Settings, search for Search Paths.
It should give you 3 lists of directories - Header Search Paths, Framework Search Paths and Libary Search paths. In Framework Search Paths Make sure non of the directories have quotation marks "like this" and make sure the directory of your GoogleMobileAds.framework is listed. If not than add it.
If there is no GoogleMobileAds.framework file in your entire project than try to look with Finder (it may still be in the project repository but not linked to the project). If you can't find it than just copy it from Unity project Assets/Plugins/iOS/GoogleStuffDirectoryOrSomething/GoogleMobileAds.framework and paste it in Xcode project using Finder, then from Finder manually drag and drop it in Xcode so that project gets the reference to that file.
Build.
1.You have to drag and drop "GoogleMobileAds.jar" in your Xcode.
2.Then you have to add 2 frameworks(AdSupport,Storekit), and also have to add "GoogleMobileAds" plugin to Build Phase.
For more discriptive steps for integrate AdMob with iOS and Android both, follow the belove link.http://www.theappguruz.com/blog/ads-implementation-in-unity-using-admob
I am following this doc for integrating realm in my iOS app.
Realm static framework for iOS
My problem is in step 3. I am unable to find libc++.dylib. I find a few other .tbd ones but none of them are libc++.
I followed a few other SO posts on using the "add other" option and doing command+shift+G and find that library but it's not in that list either.
Does anyone know any workarounds?
I had the same problem. I found some kind of way around.
Go to Build Phases > Link Binary with Librairies > + > Add other
Once in the file selection window do "CMD"+Shift+G (Go to folder) and type /usr/lib/
From /usr/lib you can add : libc++.dylib and more...
Compile and have fun
This is a known issue in the Xcode 7 beta.
To work around this issue for now, please:
Delete all references to .tbd files from either your linked libraries phase, or from the copied bundle resources phase (where they sometimes will be added).
Add the library you want to link manually to the "Other Linker Flags" build settings, by adding the argument:
-l<library_name>
for each library you want to link (for example, add "-lsqlite3" (without quotes)).
For those who are curious, the .tbd files are new "text-based stub libraries", that provide a much more compact version of the stub libraries for use in the SDK, and help to significantly reduce its download size.
-- copy from link
finally, you can add -lc++ in this Other link Flags setting
I have same problem. I cannot find libc++.dylib through xcode but I found it using terminal.
You can copy or create a link to visible folder in xcode like /Users//Downloads.
Command below maybe help to fix the problem.
ln -s /usr/lib/libc++.dylib /Users/<your user>/Downloads/libc++.dylib
I had a similar issue with Realm the other week after the iOS 9 update. I know you already tried the method of going to build phases, add other, CMD + shift + G without success. However this was the method I used to locate libc++.dylib and I just checked it out again now and was able find it.
It is also worth mentioning that after you do manage to add libc++.dylib you may have build errors. In which case the fix I used was to go into your target's build settings and change Enable Bitcode to No.
I know this has been asked a couple of times. I followed instructions from these ones:
Adding frameworks to project in Xcode 5 and having *relative* paths added
xcode4: Linker error: Directory not found for option
Still Xcode is giving this error:
Here's my current configuration:
The bolts framework is so I can use the Parse SDK. I downloaded the blank project from here: https://parse.com/apps/quickstart#parse_data/mobile/ios/native/new
It's working. I tried to copy every config option, but it still doesn't work.
Try deleting Bolts.framework from linked framework and re-add it. Also, in your Framework Search Path keep path until Bolts.framework like $(PROJECT_DIR)/Bolts if it is inside Bolts folder at your project directory path.
I'm pretty new to iOS development. Apparently this problem for me was a result of opening the .xcodeproj Xcode project instead of the .xcworkspace Xcode workspace. I opened the workspace instead and the error has gone away.
error: Framework not found
If you use CocoaPods try to run:
pod deintegrate
pod update
Also use .xcworkspace instead of .xcodeproj
Delete the framework link from the Xcode project setting.
Move the framework to the Project Folder.
Re-add the framework in the Xcode project setting.
clean the project and re-compile it.
delete all frameworks from Embedded Binaries and re-add it
me too was getting this error , I moved the framework file to the root project folder and added to framework again and problem is solved.
1:- Delete the framework from the Xcode project. Quit the Xcode.
2:- Open your project in XCode and go to file under Menu and select Add files to "YourProjectName".
3:- Select "YourFramwork.framework" in the directory where you keep it.
4:- Click on the Copy items if needed checkbox.
5:- Click Add.
Make sure that you have the framework added in both Embedded Binaries and Linked Frameworks and Libraries under Target settings - General. As shown in the following images:-
Here is the solution :
Turn the "$(PROJECT_DIR)" attribute(might be non-recursive by default) into recursive option in Select Project Click on Targets Click - Build Settings Search for 'Framework Search Path' - Double click the input.
Scratched from https://stackoverflow.com/a/31298214/4493512
Besides from removing the framework from the Podfile and Linked Frameworks and Libraries, I also had to remove the reference to the framework in Other Linker Flags.
I just had the same situation (was having a hard time to address the OP's build error after adding a 3rd party framework) and it seems like a bug in Xcode (mine is 8.3.2 (8E2002)).
The problem was that a folder name in path to the framework contained spaces. In this case, Xcode incorrectly escaped them with backslashes like this in Build Settings -> Framework Search Paths:
$(PROJECT_DIR)/Folder\ with\ spaces/Lib
To fix this, just manually edit the entry to remove those backslashes and enclose the whole string in quotes like this:
"$(PROJECT_DIR)/Folder with spaces/Lib"
Delete the framework that is causing the issue (by removing the reference).
Then add it again, following these steps for adding FBSDK frameworks and libraries:
click project
general settings
linked framework and libraries
click the plus button and add all that you want
None of the above worked for me until I found that I had a blank "Any Architecture | Any SDK" line underneath Framework Search Paths / Debug under Build Settings.
Deleted the line and it works!
Error: Framework not found
If you use CocoaPods try to run these commands from terminal:
Intel chip:
pod deintegrate
pod update
Apple Silicon M1 chip:
pod deintegrate
arch -x86_64 pod update
Also use .xcworkspace instead of .xcodeproj
When this error occurred to me was because Pods folder was in iCloud and had no local copy on my computer. Go to your project's folder in Finder and check if there is iCloud's symbol in any of the folders inside it!
I realised that I hadn't run/built my framework with the Generic Device, which strangely lead to these issues. I just put the framework back in and it worked.
If you are using CocoaPods. Similar thing has happened to me. Although this question is old someone like me might still be struggling. So for to help:
after pod install it warns you about project files. I didn't notice till now. it says:
[!] Please close any current Xcode sessions and use
ProjectFile.xcworkspace for this project from now on.
So basically, do not continue working on .xcodeproj after installing Pods. If you do linker won't find files.
My framework has long name like FrameworkSDK_Light-1.0.6.framework so I renamed it to FrameworkSDK_Light.framework and it solved my problem.
I got the error 'AdBrixRM framework not found'. I checked the AdBrixRM.framework. I noticed that 'AdBrixRM' excution file is missed. I copied this file into the framework folder and the issue was gone.
I used to encounter this same exact issue in the past with Google Admob SDK. Most recently, this happened when trying to add Validic libraries. I tried the same old good trick this time around as well and it worked in a jiffy.
1) Remove the frameworks, if already added.
2) Locate the framework in Finder and Drag & Drop them directly into the Project Navigator pane under your project tree.
3) Build the project and Whooo!
Not sure what makes the difference, but adding the frameworks by the official way of going to the section "Linked Framework & Libraries" under project settings page (TARGET) and linking from there does not work for me. Hope this helps.
I found that the file.framework was referencing a file outside my project. So I dragged the file into my frameworks folder under my project and then got rid of the earlier file.framework file and it worked.
add github "BoltsFramework/Bolts-iOS" on your cartfile.
then carthage update.
after copy Bolts.framework from ../carthage/Build/iOS
Switching from iOS simulator to real device solved the problem for me.
Was facing the same error and solved it ---> Build Settings > Build Active Architecture Only = Yes
Please after adding both framework also open each Bolts and Parse framework and add Parse and Bolts to the project then problem will be solve
Running pod update in the root directory of the app fixed the issue for me.
If you are developing one module using cocoapods, try to comment the line
s.vendored_frameworks = "YOURMODULE.framework"
on YOURMODULE.podspec
The error will disappear after you generate and copy your YOURMODULE.framework to your project folder.
I had this issue on one of the project i worked, before you delete and readd the framework do a:
git status
on your project and check to see if the framework is not listed as deleted. In the event that it is either do a
git stash
or
git checkout *framework/file/path*
I'm so new to xcode, I have a speechkit framework with following files as shown in image below
Now When I add this framework to my xcode project the header files are shown empty as below
and I end up with build error 'Lexical preprocessor issue SpeechKit/SpeechKit.h' file not found'. What is the issue with it? How to solve this?
I had the same issue.
Your Header symbolic link is corrupted (others too), you must replace it by a valid Symlink.
You can use ln -s command on each Symlink of your framework or use my script available here :
https://gist.github.com/spawnrider/6088294#file-fix_symlinks_fmk_ios-sh
Another newbie in Xcode here. I also spent a lot of time with this problem.
My scenario is the framework was emailed to me by colleague as a zip file.
I unzipped it on windows and copied it to my Mac. Wrong move. I should have unzipped it on the Mac itself. If you are wondering why your "header" is not a folder, then this is your answer.
The right answer is, that you have to make sure that the files are compiled right. In my case i had to download the SDK/Framework of my choice again.
Delete all files of speechkit in the Project and from the disk
Download it again from your Source
Add it to your project
Make sure you link the Framework (Build Phases->Link Binary with Libraries)
That should make it. I donĀ“t know why it was not compiled proper. But as i followed the steps above, the Framework was compiled right and the Project was built.
Your framework wasn't compiled successfully. You need to add the framework to the "Compile Sources" build phase.
Go to your target's settings and select the 4th tab (Build Phase). Open the "Compile Sources" phase and click on the '+' symbol and add your framework. The lexical/preprocessor issue "'SpeechKit/SpeechKit.h' file not found" should now be solved.
What i found that if you unzip any downloaded sample code and you get any lexical/preprocessor issue then just simply add that framework again by follow these steps Go to your target's settings and select the 4th tab (Build Phase). Open the "Compile Sources" phase and click on the '+' symbol and add your framework by clicking on (add other from sample code folder) option.