Swift mongoc.h file not found - swift

I am trying to install the Mongo Swift library using cocoapods but am fronting some problems.
As the documentation pointed out, for the mongo swift pod to work, it needs the mongo-c-driver. Which I installed using homebrew and is sitting in the Cellar folder in my usr folder(Meaning it is installed). I then modified the podfile the same as the example and when running pod install the library is correctly installed.
The problem then comes when i open the project and try to build it. I have now these two errors:
'mongoc.h' file not found
Could not build Objective-C module 'libmongoc'
I made sure that I open the xcworkspace and not the default workspace.
I also tried to add the path to the mongoc.h file to the Runpath Search Path in hope of some results but without luck.
As you may see i do not understand a lot of this and it basically could be something silly. But I do not know how to get this library to work.

So i managed to get it to work.
I don't know why this happened but the header and library search paths were set wrongfully. I had installed version 1.10 of the mongo-c-driver and the search version in xCode was set to 1.94.
I also was trying to modify the search paths in my own project rather in the cocoa project which led to absolutely no results.
TLDR; Add the correct include and lib folder to the Header/Library Search Path in Xcode and make sure you set it in the Pods Project.

Related

How to embed third party framework on ionic capacitor custom plugin?

I am developing an Ionic Capacitor plugin which imports 2 iOs .framework files and a .bundle that refers to one of this .framework files. The thing is that no matter how I link/embed and point/copy this files on the plugin project, xcode claims, on the app project, that it cant find the module in the swift file.
I already tried to add the files to the project, used the "Embedded binaries" option, linked libraries, allow non-modular includes (on build options menu), add the files to the headers (on build phases), and so on....
The line that xcode point the error is:
import OneFramework
And xcode claims:
No such module 'OneFramework'
I was expecting that when I add the plugin to my app project via npm, and later running a "$ rm -rf ios && ionic capacitor run ios" to run the app, xcode find all the modules of the plugin that I am trying to do.
I found the solution. To achieve this the first thing to know is that when you do npx #capacitor/cli plugin:generate what the CLI do for you is the generation of a cocoa pod. The root of this pod is the generated folder itself.
With that in mind, the next thing to do is to learn how to make pods, but i'll sumarize the principal aspects that led me to the success.
-First of all you open the *.xcworkspace. Followed by that, click on the "Add Files to Pod..." option and add your files. Please ensure that the "Copy files if needed" option is marked. Please refer to the picture below.
-Now its nice to create a folder for your .framework and another for the .bundle (if there are any) files. Do this by right clicking the Pods project and select the option "New group". Select a name like that is different from the pattern of xcode, it is nice to know that this folders are created by you.
-If you done this right, the frameworks you recently added to the project will appear on the pods project like this:
-Now, for your swift implementation find your files, drag your .frameworks that are on the pods project for the "Frameworks, Libraries and Embedded content" of the plugin project. The result will be something like this:
-Ok, files included and linked. Now we should let our cocoa pod know about this and declare this files. The file "YourAwesomePlugin.podspec" (located at the root of the plugin project) is the main entrance of the pod. In this file you will declare which files (.frameworks, .bundle, etc) belong to your pod and consequently will belong to your plugin when you npm install it. To declare this you'll need three directives:
s.vendored_frameworks = 'ios/Pods/YourFrameworkFolder/**'
s.resource = 'ios/Pods/YourResourceFolder/YourBundle.bundle'
s.xcconfig = {'ENABLE_BITCODE' => 'NO'} #This is mandatory on my case, but you need to evaluate if this options applies to your plugin.
-Now we hit play on the plugin project. To test on your app if the plugin is ok, you need to add the path of the root of the plugin project on the podfile of the pods project of the APP project. Like this:
-To install it you can go on Yourproject/ios/App and run pod install.
Please note that:
To declare the existence of your recently created plugin you you need to do some declarations as well, but this part is easy and already documented on capacitor/plugin docs.
The installation method via pod install that I suggested is for testing. It would be nice if you pack your plugin using npm and npm install it like all other plugins.
I dont have much knowledge on cocoapods like I wish, but this works and I think that is a clean solution. If not, please let me know.
If this answer is useful for you, please thumbs it up, it is a week of research and trying that I am sharing, along the time to write it all down.

Xcode error while archiving: No such file or directory

I am trying to archive an App to generate an Adhoc version and I'm getting this error:
/Users/XX/Library/Developer/Xcode/DerivedData/XX-agdiwzkbuiqgyudhcwqimxlyeiqc/Build/Products/Debug-iphoneos/SQLite.swift/SQLite.framework: No such file or directory
I tried multiple solution from updating my Cocoapods to removing the Derived Data and nothing worked.
I'am using Xcode 8.2.1
If you are including frameworks or libraries in your project, make sure that you included them from the correct location. I ran into a similar situation where I was trying to embed a framework and it was pulling it from the DerivedData folder rather than the actual location.
It might be helpful to remove embedded frameworks in your Project file and then include them again. Make sure that the framework location is the actual path to the library relative to your project and not the simulator files.
How are you installing it? I guess you are using this right?
For Cocoapods are you using Xcode Beta. It seems that you need to work with the default one:
sudo xcode-select --switch /Applications/Xcode.app
If it doesn't work with cocoapods, try using it with Swift Package Manager
Ok so as SamG said, Xcode was actually pulling the SQLite.framework from the DerivedData for some reason.
Besides that, i removed the SQLite Pod and installed it manually following this
and now its working.

how to compile kdesvn from githib repo

I've downloaded the sources for kdesvn from the github repo as I'm thinking to look into working on an addition to the project. Now turns out, I'm not even able to properly compile the downloaded sources: I've created a directory kdesvn-build changed into it and launched cmake ../ (as described on https://github.com/KDE/kdesvn/blob/master/INSTALL-cmake) which does some stuff but then stops saying:
CMake Error: The following variables are used in this project, but
they are set to NOTFOUND. Please set them or make sure they are set
and tested correctly in the CMake files: SUBVERSION_INCLUDE_DIR
Now, I don't know what SUBVERSION_INCLUDE_DIR should be set to nor could I find it searching around the web. Anyone?
It is a directory containing svn_*.h files. If you are on Linux, you'd need to install something like subversion-dev package. On FreeBSD headers are installed with main package, and the directory is /usr/local/include/subversion-1/.

PNChart-swift not working

I wanna use some charts in my swift project, actually I was using PNChart before, but now I need to move on to PNChart-swift.
https://github.com/kevinzhow/PNChart-Swift
as the readme saids I added some lines in Podfile, and I
pod install
then I get "no such module PNChart-swift"
I think Pod is cloning the wrong Codes from the PNChart-swift repository.
Is there any way I can clone the codes and use as the library without using Pod?
Thank you.
For manual installation you could just download the repo as zipfile and than drag the .xcodeproj file into your project.
This will create the required reference so that you can use it.
You may also need to add it as embedded framework in your project settings.

MGTwitterEngine for Iphone SDK errors

I'm trying to get MGTwitterEngine to work for the iPhone SDK. I've followed the read me below and now I keep getting the following errors:
TCDownload.h: No such file or directory
yajl_parse.h: No such file or directory
Now, I've done a search on my system and don't have either one of them. So am I missing something? Also, I've downloaded the MGTwitterEngine code within the last couple days from gitub.
READ ME
Add libxml2.dylib in Other Frameworks. You'll find the library in:
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk/usr/lib/libxml2.dylib
Add "$SDKROOT/usr/include/libxml2" as a Header Search Path in your Project Settings.
Although I've never used MGTwitterEngine, that error basically says that you are missing yajl library.
You can install it manually by doing (I assume you install to default /usr/local location):
git clone git://github.com/lloyd/yajl
cd yajl
./configure
sudo make install
Then in your xcode project:
Add libyajl.dylib or libyajl_s.a (dynamic/static - whichever you prefer, either should be located in /usr/local/lib/) to 'external frameworks and libraries' in your project tree. In project settings add "/usr/local/include/yajl/" and (possibly) "/usr/local/include/" to Header Search Paths (in Search Paths section).
After that it should build.
On mac, you can use port (See how to install here)
After install simply type in terminal :
sudo port install yajl
And like ttvd say before:
In your xcode project:
Add libyajl.dylib or libyajl_s.a (dynamic/static - whichever you prefer, either should be located in /usr/local/lib/) to 'external frameworks and libraries' in your project tree. In project settings add "/usr/local/include/yajl/" and (possibly) "/usr/local/include/" to Header Search Paths (in Search Paths section).
This works if you don't care about YAJL:
"Guys – the yajl/yajl_parse.h error is confusing and the reason the demo works is that the files that need yajl are excluded from building, even though they’re in the project. To fix in your own project go into the MGTwitter folder via xcode and select each .m file with the term yajl in it (there should be 6), right-click -> Get Info -> Targets tab and uncheck the box next to your app name. HTH, Jon"
One of the comments on http://aralbalkan.com/3133
I am just going to add something because I think it is important and I usually hacked around it in the past.
---->>
The header search paths are defined in project settings but are over-ridden in the target settings so if you are having problems including certain files check the header search paths that are set in your target settings. If they are bold then they are being used and overriding the default settings for the project.
dl and install this: http://cmake.org
before
git clone git://github.com/lloyd/yajl
cd yajl
./configure
sudo make install
then add the dylibs and you should be ok!