Xcode subproject cannot find its own header files - ios

I have an sdk that is added to my project as a subproject in xcode. My main project's classes can import all the header files successfully into the code by using
#import "Filename.h"
because I added the sdk directory to my Header Search paths in the build settings of my main project.
However, the problem is that the classes of my sdk can't successfully import each other unless they are in the same directory. In my case, this is a problem because my sdk has folders within it with header files that the files in the main sdk folder want to import. As a result, I receive the error:
'Filename.h' cannot be found
when files in the main sdk folder try to import header files nested in deeper folders in the sdk. When I tried to move all the files into the main directory (I'm fine with sacrificing organization for functionality), the original error remained and I got two more errors:
clang: error: no such file or directory: '/Users/.../MainProjectFolder/SDKFolder/NestedFolder/Filename.m'
clang: error: no input files
It seems to know where to look for the files but the other files still can't access it.
Does anyone have any ideas to help?
Thanks, any help is appreciated!

Related

'opencv2/opencv.hpp' file not found in Xcode

I'm using the npm package react-native-perspective-image-cropper and it requires me to install opencv2. In the package's file, it imports opencv2, with the following:
#import <opencv2/opencv.hpp>
And no matter what I do I keep getting the following error:
'opencv2/opencv.hpp' file not found
I've read almost every article and question online and I just can't figure it out. I followed the installation steps provided in the article:
I downloaded opencv2.framework from here and moved the file opencv2.framework into my ios folder.
Then in XCode, I right clicked on my project, choose add files and selected opencv2.framework
This is when I first got the error. I tried the following fixes to no avail:
I tried to reinstall and relink the npm package that I was trying to use (I'm not using cocoa pods).
I tried changing the import to be #import "opencv2/opencv.hpp" (replacing the brackets with parenthesis.
I tried adding opencv2.framework to Link Binary with Library under Build Phases
I tried adding opencv2.framework to Copy Bundle Resources under Build Phases
I changed Always Search User Paths (Deprecated) to yes
I added a Framework Search Path of:
$(inherited)
$(PROJECT_DIR)
$(PROJECT_DIR)/opencv2.framework
$(PROJECT_DIR)/./opencv2.framework
$(PROJECT_DIR)opencv2.framework
/usr/lib**
I added a Header Search Path of:
$(inherited)
$(PROJECT_DIR)
$(PROJECT_DIR)/opencv2.framework
$(PROJECT_DIR)/./opencv2.framework
$(PROJECT_DIR)opencv2.framework
/usr/lib**
I tried moving opencv2.framework under the Framework folder
I tried moving opencv2.framework directly under the package
I cleaned the product and rebuilt after each attempt and each attempt was attempted at least once (which you can imagine was a ton of fun).
Here are some of the sources I tried to use:
'opencv2/opencv.hpp' file not found
hpp file in imported framework is not found by XCode
Xcode can't find source files
'opencv2/opencv.hpp' file not found in my private pod
opencv2/opencv.hpp file not found in Xcode (note this is different than #1)
https://github.com/opencv/opencv/issues/5989
https://github.com/kylemcdonald/ofxCv/issues/167
https://forums.xilinx.com/t5/Vivado-High-Level-Synthesis-HLS/Cannot-find-quot-opencv2-opencv-hpp-quot/td-p/478368
https://groups.google.com/forum/#!topic/caffe-users/Poteul9Rz20
http://answers.opencv.org/question/34066/framework-not-found-opencv/
https://github.com/iMicknl/cordova-plugin-openalpr/issues/12
I genuinely have no clue where to look at this point. Any help would be greatly appreciated. I can also post any updates if more information would be helpful.
you can maybe try cocopod https://cocoapods.org/pods/OpenCV or https://cocoapods.org/pods/OpenCV2 in my case I am not sure why I can't install OpenCV2 with cocopod but it stop giving me error after I use cocopod

How to embed framework without copying in project

There was a similar question, but the answer is no
I use appodeal-ios-sdk-mobile-adapter. I want to add them to your projects without copying each.
in the Link Binary with Libraries framework added
But I get:
ld: framework not found GoogleMobileAds
clang: error: linker command failed with exit code 1 (use -v to see invocation)
In order to add the framework to your project without copying proeta folder, drag the folder using the (Create groups), and add the path where you have a set framework -> "Build Setting -> Library Search Paths and Framework Search Paths
/Users/username/Framework/AppodealAdapters/**
Well you can open the system directory where all the frameworks are present
that is in the system folder where all the frameworks are installed
Hit Shift+Command+G
and use the below address
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks
Once in the directory copy the framework which you want to use. Take care to not mess around other frameworks in this directory.
Once the frameworks are copied into this directory you can add them to your project just like you include a regular system defined framework.
Try it out it works for me. I am using XCode 7.3.

XCode 7.3.1 can't find sqlite3.0 lib despite the file being where it says it can't find it

I have a static lib project that has been working fine and had the libsqlite3.0.tbd dylib linked to it. I moved the static lib project into a new UI project and suddenly that lib, and all other libs actually that could be linked to through the UI as .tbd, can not be found by XCode. I thought, okay I've corrupted my static lib project file I'll just create a new static lib project and move files into it. So I tried to create a brand new static lib and link the sqlite3.0 dylib to that before moving any files into it and it too gives this same error message:
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: can't open file: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk/usr/lib/libsqlite3.0.tbd (No such file or directory)
Yet I can go to Terminal and cd to that dir and there's the file.
But the projects won't build.
Any help appreciated. Thanks!

Header files are not found while archiving the build in xcode

I have a sub project that has been developed as dynamic lib and included that sub project into my main project and been set as target dependency.
When I run my main project, .a file for my sub project has been created successfully and the corresponding header files are created in the build directory such as (build/release-iphoneos/include). I have mentioned path using MACRO
In my main project, I mentioned header search path as the same that i mentioned above using MACRO.
But when I try to archive the build it throws the run time error file not found in the import statement
#import <subproject/myfile.h>
But it is getting build and run successfully even though it displays the file not found error in the xcode editor in compile time.
My question is
Is this because of the build directory will be empty while archieving?
I solved the problem as below
1. The header files were private so changed them as public so they are exposed to main project. (To build & run successfully)
2. I copied the header files and created a directory and add them into my main project and set the header search path to point that directory (To archive successfully)

Facebook iOS SDK 3.1 from Github missing FacebookSDK.framework

I want to use Facebook SDK on XCode 4.5 for integration with iOS6.
I read this tutorial. I was using this .dmg package to install the library but I need to track and read the implementation of some methods, so I noticed that there is a repo on Github with the current source code.
My problem is that I don't know how to install this properly as with the package .dmg. Any ideas on how to do it? I tried to just import the src folder and reference the whole project but I'm having a lot of issues, warnings and errors.
Update
I had to do this again, so now I made it work. Here is what I did:
I tried both ways, building the source code (1) and importing the files directly(2). On the first scenario it was easy, on the root folder of Github repo just run:
sudo scripts/build_framework.sh
You will get the files needed, the same that you get when installing with .pkg. But I needed to track the functions, so I tried to importing the files.
First I added the src folders from the Github repo on my project. I had an issue with duplicated definitions on every file. The problem was on my Build Settings (BS), I was still referencing to the .pkg install directory of Facebook so I had the files duplicated. I removed every reference to that folder on BS and then added the files.
After that, on the files that imported the Facebook files I got:
Undefined symbols for architecture i386
When I copied the files to XCode, the .m files where not automatically added to the Build Phases / Compile Sources. I added them manually and imported FBConnect.h on my files.
Hope it helps some one with the same issue.
If you include the FacebookSDK via git, you will need to build the framework. Run the following command from within the FacebookSDK directory:
scripts/build_framework.sh
Then, FacebookSDK.framework will appear in FacebookSDK/build
Add the entire src folder to your project. Import FBConnect.h in any class where you want to use Facebook. The connect class imports the rest of the necessary classes.
#import "FBConnect.h"

Resources