libxml/tree.h file not found for tests - ios

I'm using libxml in a project. I had an issue before where the app would not compile due to a "Lexical or Preprocessor issue" in which the file libxml/tree.h could not be found. I fixed this by copying the library into my projects root folder and adding the Header Search Path: "${SDKROOT}/usr/include/libxml2".
This fixed the original issue. However, whenever my unit tests have a dependency on any part of the project with an ultimate dependency upon libxml2, the same problem occurs. My project still compiles fine, just not when I'm try to run unit tests.
I'm quite new to objective-c/iOS so I'm really clueless. Any help would be greatly appreciated. Thanks!

So it turns out that I had set the header search path "${SDKROOT}/usr/include/libxml2" in the main app target, but in order to use the library in my unit tests the header search path must also be set in the "[App name]Tests" target settings.

Related

Excluded Source File Name causes pod header file not found

There is an Objective-c framework in the project, the framework does not support running on simulator. It's not good for developing, so I excluded the file in Build Settings --> Excluded Source File Name, but this causes errors xxxx.h file not found. in Bridge-Header.h.
I also tried to set Validate workspace = yes, again, the framework seemed to be excluded, but it causes the errors.
How can I exclude framework correctly? and why the errors above happens?
Thanks.
This cause errors because Xcode can't find the files in the framework!You should find out all the files that have referred to any file of the framework. After you find them out, you'd better disable the functions provided by the framework, and remove all the reference in all the files. The errors will disappear after you remove all the reference
Don't delete or mess up the code, you need them when running on a real device after all.

Xcode/iOS xctest - Build input file cannot be found

I created the first unit test target in our iOS application by simply clicking through the plus icon inside the test tab on the left navigator.
(The target to be tested is set to the main application)
The unit test target created itself successfully but when I try to run the pre-generated tests, it outputs an error message. The error message displays that the build input file cannot be found. More specifically, the file /Plugins/XXXTests.xctest/XXXTests cannot be found. I double checked and in fact that file is not in that directory.
While I could not find anything similar to this problem, I tried everything that was close to it but nothing seemed to fix problem.
Any help would be greatly appreciated!
For me, it was because the test source files are not included in the test target.
Including those test files in the test target solved it.
It's been a while but we finally found a solution! The problem was in the Podfile where our pods weren't being applied to the different targets of our app. To fix the solution we had to define a shared pod module that included all of our pods and then we applied this new module to each different targets in our app.
Our Podfile looks like this now
I hope this helps out some people!
Do you have it set properly in schemes?
Go to Product -> Scheme -> Edit Scheme -> Test and check, if your test target is properly added to the correct scheme. It should look something like this:

Cannot load underlying module for unit tests

I am currently developing a swift framework for my iOS class.
Here is the project structure :
I would like to test my class named SimpleCoreData, but when I go to the generated ESGISimpleCoreDataTests file, the import (also generated) isn't accepted:
Cannot load underlying module for 'ESGISimpleCoreData'
So I checked this other topic, and verified the targets, but everything seems fine.
framework:
tests build phases:
I am beginning in Swift, so I may have missed something obvious. Can you please help me with this one?
Finally, after examining each commit to see where it breaked, it turns out that the problem was probably coming from a unit test file I created, which had the same issue (probably didn't created it correctly), and then only removed its references instead of moving it to trash.
So I went a commit backward, used the default unit test file generated, and it worked.
Here's another variation on this theme. 🎢🎡
I imported a folder of files into my main project, and in that folder was a file which had import XCTest in it.
The compiler didn't flag this problem, and I didn't see it until I used finder (like CodingMouse).
Once I moved this testing file to the UITests folder and changed its "Target Membership" to the UITests Module, I did a clean and build to get everything working again.
So the takeaway from this is the compiler won't always point you directly to the actual problem. Using finder, scan through your files and confirm nothing looks suspicious or out of place. πŸ€

Not able to find Xcode generated Swift header when running under -cal target

I'm encountering a bit of a weird issue. Calabash works for me up until a specific. I've tried narrowing down the issue and I believe it is being caused by importing the Xcode generated Swift header file, as it's always the same error:
'<projectName>-Swift.h' file not found
I've tried changing the name of the import from <projectName>-Swift.h to <projectName>-cal-Swift.h with no luck. I've tried removing the -force-load compile flag, also with no luck.
If anyone has encountered a similar issue and solved it, I'd love some help!
Edit: I should mention, when not running on the -cal target, everything works as expected, so it's something inside the -cal target causing the error.
I was able to fix this issue. It required two steps under the project build settings
Change the Defines Module setting to Yes
Change your Project Module Name to what the expected name in the projectName-Swift.h file is. e.g. - if you expect the header to be called MyAwesomeApp-Swift.h, change the Project Module Name to MyAwesomeApp.

FMDatabase.h not found when using route-me library

So im trying to use the route-me widget in my app, but xcode keeps complaining that it cant find FMDatabase.h, yet its included in the project (albeit under a different project that is included into my project). I've copied how a sample app has been made yet the sample project doesnt get this error. The RMDBMapSource.h file is contained within the MapView project, so i shouldn't need to include the fmdb stuff myself (and because the sample project doesn't do that)
Surely if the files are under compile sources / copy headers under build phases, that means it should be able to find the file? This is a pretty lackluster explanation of my problem, but if anyone has used the route-me library before maybe they have had the same problem and can point me in the right direction
Resolved my own mistake. First off in the build settings of the main project, the 'search for header paths' was not set correctly, it was set to /MapView/ instead of /MapView/** that resolved the FMDatabase.h missing error.
Then in case someone else had a linker error like i did after i resolved the first issue, make sure you have libMapView.a included in your link binary with libraries section. (i had it their before, but during a version control commit, somehow our project file decided to not add that library anymore and i had totally forgotten about it, so took me quite a while to find out that it was missing)

Resources