MGTwitterEngine for Iphone SDK errors - iphone

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!

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.

Cocoa Swift: Launch At Login not working & throws error in Xcode?

I am using https://github.com/sindresorhus/LaunchAtLogin as it reduces the hassle to implement Launch At Login from Scratch.
I did follow all the instructions in the README as follows -
Made a Podfile & installed with pod install
platform :osx, '10.12'
target 'myApp' do
use_frameworks!
pod 'LaunchAtLogin'
end
Added a new "Run Script Phase" below "Embed Frameworks" in "Build Phases" with the following:
./Pods/LaunchAtLogin/LaunchAtLogin/copy-helper.sh
But I get the error
cp: /Users/username/Library/Developer/Xcode/DerivedData/myApp-bcrytpktfvzflmexubmyosnhzksq/Build/Products/Debug/myApp.app/Contents/Frameworks/LaunchAtLogin.framework/Resources/LaunchAtLoginHelper.app: No such file or directory
Command /bin/sh emitted errors but did not return a nonzero exit code to indicate failure
As you can clearly decode from the error LaunchAtLoginHelper.app cannot be found at /Users/username/Library/Developer/Xcode/DerivedData/myApp-bcrytpktfvzflmexubmyosnhzksq/Build/Products/Debug/myApp.app/Contents/Frameworks/LaunchAtLogin.framework/Resources/ that's why the build is failing.
How do I generate that or what should I do to sort this thing out because this makes Launch At Login not work?
I also made a simplest demo for the app to see if it works but it doesn't - https://github.com/deadcoder0904/LaunchAtLoginPod
PS - I have also code signed the application as I did follow this & checked it with codesign -dvv /Applications/myApp.app & it returned Build Time perfectly.
I had the same issue while using Carthage instead of CocoaPods. Currently, there seem to be lots of open CocoaPods' related issues in this project's repository so you might consider trying Carthage and follow these steps.
I solved this issue using the following steps:
In XCode, under Build Settings, under signing, make sure Code Signing Identity is set to either Sign to Run Locally or any other form of actual signing
Use this tutorial to install Carthage
Follow the install and usage of the package, using Carthage, as appears in the README file here: https://github.com/sindresorhus/LaunchAtLogin
Delete all of the contents in DerivedData
To make sure, also clean the project: (Product -> Clean Build Folder)
In your project's folder, execute carthage build
There should now be a new folder inside your project's root folder named Carthage. Inside, there is a Build folder. Search for the file LaunchAtLogin.framework.dSYM (note the .dSYM extension)
In XCode, under Build Phases, in Embed Frameworks step, drag and drop the .dSYM file (see image below)
Change the destination to Products Directory (see image below)
Check the Code Sign On Copy checkbox of this framework (see image below)
Add another step New Run Script Phase, make sure it runs the native shell (/bin/sh). Inside, add this line: exec "${PROJECT_DIR}/Carthage/Build/Mac/LaunchAtLogin.framework/Resources/copy-helper.sh" (this is the line that appears in the repository) - (see image below)
Make sure that the script appears after the embedded framework
Build and run
Not exactly an answer but found an alternate solution.
I couldn't solve this with CocoaPods but I did make a simple demo with Carthage & it worked.
Here's the link for the interested - https://github.com/deadcoder0904/LaunchAtLoginCart
Edit:
Found the solution thanks to Ferruccio
Add a new "Run Script" below "[CP] Embed Pods Frameworks" in "Build Phases" with the absolute path to copy-helper.sh.
For simplicity, you can just drag & drop copy-helper.sh. Drag it inside label Shell. Then change Location to Absolute Path
Also you can try https://github.com/deadcoder0904/LaunchAtLoginPod as a simple working demo.

Swift mongoc.h file not found

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.

Framework not found GoogleMaps sdk in iOS

I want to use google map to existing(not a new one) iPhone project.Now i am using Google map ios sdk and i successfully added google map framework to my project.But i got error like this
ld: framework not found GoogleMaps
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to solve this issue.I am using xcode4.5 and google map iOS sdk version is 1.5. When i am creating new project with google map iOS sdk then no error getting for me.Error only for existing iOS Project.Please help me.
I solved my issue
You need to do this
Click on your project (targets)
Click on Build Settings
Under Framework search paths (set your framework path)
Following information for getting framework search paths
Right click on your framework folder (for ex: GoogleMaps.framework)
select Get info
copy the path from General->where and paste this path in your framework search path (path should contain in single line)
Good luck
I encountered a scenario in which I had to import a project that was using Google Maps and noticed the same problem - module: "Google Maps" not found.
To solve this problem it was necessary to delete Podfile.lock and Podfile folder and re-install the pods again. Good luck !
You can also :
- remove GoogleMaps from Podfile
- pod install
- add GoogleMaps to your Podfile again
- pod install
This solution works for me, you can also check the search paths a well.
Clean your project. The shortcut is command + shift + k. This will clear information that xcode has stored that might imply that the sdk isn't included.
Also press the project icon at the top of the hierarchy of files, press the target that is your project, press build phases, open link with binary libraries, and make sure that the google maps sdk is in there. If it is not, press + and add it in.
Follow the steps :
Download GoogleMaps-iOS-1.1.0.zip from their site
Unzip the file. You now have a GoogleMaps-iOS-1.1.0 folder
In that folder you have a GoogleMaps.framework folder.
Copy or move the GoogleMaps.framework folder to inside your project folder (in Finder).
Drag the GoogleMaps.framework folder onto your Frameworks group in Xcode.
In the options sheet, uncheck "Copy items into destination group's folder". Make sure your target is checked in "Add to targets". Click OK.
(Note that you can also do this the other way, by not copying it into your project folder and checking "Copy items into destination group's folder". Xcode will copy the folder itself.)
Import using #import "GoogleMaps/GoogleMaps.h". The angle bracket usually work too, but in this case it should use quotes.
From : <GoogleMaps/GoogleMaps.h> file not found Google Maps SDK for iOS
my problem was fixed by adding in:
build settings
Framework Search Paths
clickable and add the following lines:
"${PODS_ROOT}/GoogleMaps/Base/Frameworks"
"${PODS_ROOT}/GoogleMaps/Maps/Frameworks"
If you use Pods
Left menu > Pods > Pods > choose Framework > right menu > copy path from "ios/....."
My: ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMaps.framework
Then Project > Build Setting > Framework Search Path > Click on
$(PROJECT_DIR)/ios/Pods/GoogleMaps/Maps/Frameworks/GoogleMapsCore.framework
Sometimes it happens when you are migrating the code from one system to another so your Framework search paths look empty at this moment, so one simple solution I try is to reinstall the podfile and it works for me.
I've been struggling with this issue for hours; I'm using CocoaPods, Swift and Xcode 6.1.1. I followed all the steps for including GoogleMaps in my project carefully, tried many different things like removing symbolic links in the downloaded package or manually linking the binaries in build phases or trying #include "GoogleMaps.h", #include "GoogleMaps/GoogleMaps.h" and "#include <GoogleMaps/GoogleMaps.h> in my bridge file, none of that worked... Finally used CocoaPods instead of including the framework myself and it worked! Hope it helps someone out there:
In the Podfile:
pod 'Google-Maps-iOS-SDK', '~> 1.9.2'
And in your Bridge file:
#import "GoogleMaps.h"
Delete derived data and delete Podfile.lock file and then run pod install.
Maybe it'll be useful for anybody, next steps helped me:
1. Delete "Headers" and "GoogleMaps" folders manually (from the Finder).
2. Run 'pod install'
3. Re-build the project in Xcode.
In my case, I forgot that I need to open the workspace file with pods, not the project.

lexical or preprocessor issue file not found occurs while archiving?

I am new to this iPhone development and i have almost completed my first application but when i try for creating an archive it gives an error lexical or preprocessed issue file not found But it runs fine in simulator and also has also tested on device. I have included SDwebimage architecture for lazy loading of image in table view.Can any tell me what is the issue?
Few things to try, Ensure the Framework and all it's headers are imported into your project properly.
Also in your Build Settings set YES to Always search user paths, and make sure your User header paths are pointing to the Framework.
Finally, Build->Clean and Restart Xcode.
Hope this helps !
UPDATE: According to SDWebImage's installation, it's required you make a modification to Header Search Path and not User header paths, As seen below.
Have you done this as well? I suggest slowly, re-doing all the installation steps from the beginning.
Spaces in a folder name in your header search path can cause this problem. Make sure the folders in your project do not have spaces in their names.
My project was building fine until I updated to Xcode 10.1. After the Xcode update, started getting Lexical or preprocessor Issue errors on build. Some XCDataModel header files could not be found.
This fixed the issue.
Go to Build Settings, Header Search Paths
Change the appropriate value from $(SRCROOT) non-recursive to recursive.
This ensures that subfolders are also searched for headers during build.
I had this same issue now and found that my sub-projects 'Public Header Folder Path' was set to an incorrect path (when compared with what my main project was using as its 'Header Search Path' and 'User Header Search Path').
e.g.
My main project had the following:
Header Search Paths
Debug "build/Debug-iphoneos/../../Headers"
Release "build/Debug-iphoneos/../../Headers"
And the same for the User Header Search Paths
Whereas my sub-project (dependency) had the following:
Public Header Folder Path
Debug "include/BoxSDK"
Release "include/BoxSDK"
Changing the 'Public Header Folder Path' to "../../Headers/BoxSDK" fixed the problem since the main project was already searching that folder ('../../Headers').
PS: I took some good screenshots, but I am not allowed to post an answer with images until I hit reputation 10 :(
I had this problem after changed project name. I used all the methods mentioned on the internet but still doesn't work. Then I realized that all the header files not found was from cocoapods, so I re-installed the cocoapods using pod install, and thus solved the problem.
Hope this could help.
In my case I was developing a framework and had a test application inside it, what was missing is inside the test application target -> build settings -> Framework Search Paths:
The value needed to be the framework path (the build output - .framework) which is in my case:
"../FrameworkNameFolder/" - the 2 points indicates to go one folder up.
Also, inside the test application target -> Build Phases -> Link Binary With Libraries:
I had to remove the framework file, clean the project, add the framework file again, compile and this also solved the issue.
The new version contain fix for this, feel free to update.
Or you can just replace
#include "iPhone_View.h"
with
#if UNITY_VERSION < 450
#include "iPhone_View.h"
#endif
Delete the unit testing from your project follow the below steps this will solve the issue.
select your project from the project navigator to open the project editor. From the target delete the test from the left side of the project editor and press the Delete key.
I know this is old, but I'm gonna chime in anyway because it may be useful to someone. If you can still see the file in Finder, then click on the file in your project and delete it, selecting "remove references" and not "move to trash".
Once the reference is removed, drag and drop the file from finder into your project again and it should sort itself out.
Just adding another thing that worked for me :
react-native link
Evidently my ReactNative files were no longer there. I could figure that out by clicking on
Build Phases -> Link Binary with Libraries ->
Then right clicking a file I knew was responsible for React, and clicking Show In Finder .
But nothing opened. So assuming the library went missing, I just ran the above command which relinked everything again.
Also if you havn't, try :
rm -rf node_modules/ && npm install
This happened to me after I renamed a file. For some reason it was still looking for the file with the old name. What I did was create the file that it was complaining about and added to the project. Then I did a Project->clean, then Project->Build and verified the error was gone. Then I selected the newly added files and deleted them. This removed all references and I no longer see the error.
I fixed mine. The fb sdk downloaded (from my browser) as 'FacebookSDKs-iOS-4.22.0' -- I just had to rename the folder to FacebookSDK. So now in Build
Settings --> Framework Search Paths
the path looks something like /Users/.../Documents/FacebookSDK (where as before it was /Users/.../Documents/FacebookSDKs-iOS-4.22.0)
Hope this helps!
For what it's worth, my problem was completely unrelated to the error Xcode was giving. I stumbled onto a solution by deleting the .h reference, compiling, adding the reference back and compiling again. The actual error then became evident.