Facebook iOS SDK 3.1 from Github missing FacebookSDK.framework - ios

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"

Related

Automate the process of including generated proto files into an Xcode project

Our iOS app currently is using Google protobuffer gRPC as our API layer to communicate between App and backend. And so we have these .proto files in our backend directory which will be converting to .grpc.swift and .pb.swift files by gRPC-Swift-Plugins and then consumed by the App.
This works okay, but the process of converting is very tedious, and we would like to automate the whole process.
Below is how we're doing it:
Delete previously copied directory, and copy all .proto files from backend (.proto files are maintained by backend devs) to App directory named "Protos" via a shell script
We already set up Build rules and include .proto files in Compile Sources. Following the steps from an answer here on SO
Screenshot of the current setup in Xcode Build Rules:
Whenever we build the project, .pb.swift and .grpc.swift are generated and putting into a directory named "generated" under the "Protos" folder.
Here are the problems:
If the backend added a new .proto files into the source directory, my script will only copy the files into the Protos directory but not included news files in the Compile Sources list.
Similar to the first problem, we need to manually set up Compile Sources in Xcode and that means if a new dev joins our team, he/she also needs to do the same setup again.
We sometimes need to refer to the .grpc.swift and .ph.swift files while coding. But If we add these files into Xcode and build the project again, Xcode will complain that these generated files are there like (Sorry, we're working on a private repo, so the project name and file names are replaced):
Multiple commands produce '${user_path}/${proto_name}.pb.o':
Target '${my_project_name}' (project '${my_project_name}') has compile command for Swift source files
Target '${my_project_name}' (project '${my_project_name}') has compile command for Swift source files
Any answers or comments and suggestions are greatly appreciated!
It's interesting I didn't have those problems with Swift if I use the $DERIVED_FILE_DIR
protoc "$INPUT_FILE_NAME" --swift_out="$DERIVED_FILE_DIR" --proto_path="Your/proto/path"
I don't use the plugin because I've got the plugin installed in my /usr/local/bin
But I have exactly those problems when we use the output for cpp files.

'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

Remove fabric framework from ios app

I have been landed an iOS project from a client. The main task is to explore and see the user interface so that multiplatform app will be made from scratch with Xamarin.
I notice that the project uses third party framework called fabric. From what i see it is used from crash analytics. I don't need that and i don't have registration so i want to remove all dependencies from the project.
So far I did:
Deleted define ENABLE_FABRIC ( which removed some code from
AptDelegate, replaced logging messages with plain NSLog etc)
Removed some fabric script invocation from build phases
Removed reference from fabric framework in project
So i still have errors building my app:
/bin/sh:
/Users/macmini/Library/Developer/Xcode/DerivedData/../Build/Intermediates/../Script-FDC6FCE81A4488D000F2613D.sh:
(null): bad interpreter: No such file or directory
Does anyone know a quick way to get rid of this?
I know it's an old question but I want to help. When you install Fabric, previously Crashlytics, it asks you to put a script in project->Build Phases-> Run Script
it will look like this
./Fabric.framework/run 123456fd7ec....6e2170Q
I think you should remove that script and other Linked Frameworks and Libraries and then it possibly could run
Try deleting the files DerivedData path and clean build folder
cmd+opt+shift+k
then re run the application.
Also check once again the Framework search path in xcode settings.

Cocos2d - json/document.h file not found

I create a mobile game using cocos2d framework. The problem is I got this error when I try to compile ios platform.
In file included from /Users/MNurdin/Documents/Game/WTP/frameworks/js-bindings/bindings/manual/chipmunk/js_bindings_chipmunk_manual.cpp:26:
In file included from /Users/MNurdin/Documents/Game/WTP/frameworks/js-bindings/bindings/proj.ios_mac/../../cocos2d-x/extensions/cocos-ext.h:16:
In file included from /Users/MNurdin/Documents/Game/WTP/frameworks/js-bindings/bindings/proj.ios_mac/../../cocos2d-x/extensions/assets-manager/AssetsManager.h:32:
/Users/MNurdin/Documents/Game/WTP/frameworks/js-bindings/bindings/proj.ios_mac/../../cocos2d-x/extensions/assets-manager/Manifest.h:36:10: fatal error: 'json/document.h' file not found
#include "json/document.h"
I follow exactly this tutorial from A- Z. I run this command in my terminal to compile my project.
cocos compile -p ios
Reference: http://cocos2d-x.org/docs/manual/framework/html5/v2/cocos-console/en
This is only an issue if you are using the source code from github.
I assume you are missing extra step required when you got the project from github.
In ReadMe it says:
Github note
If you fork our github repository or download the package from github,
you will need to do some extra tasks:
Run frameworks/js-bindings/cocos2d-x/download-deps.py to download external dependencies for Cocos2d-x
Run tools/cocos2d-console/download-bin.py to download bin files for some cocos2d-console plugins like Google Closure Compiler and JSC
Compiler.
It looks like the subproject is completely missing json/document.h file as referenced in Manifest.h. I attempted a simple comment of the include, but this raised errors I believe related to the missing header. I think filing a bug related to this subproject (Cocos2d_libs) is in order.

Issues Using GIT with Xcode projects

I know git and use it to manage a lot of my Repos on other projects. However I run into issues when it comes to xcode projects.
I start a project on Machine 'A' - when I push up to a repo and pull to let say machine 'B' I always receive compiling errors. Normally the errors have to do with files not being found. Literally "no such file or directory" followed by a path.
I'm working with the same version of Xcode on both mac's A and B. I also use the threetwenty framework.
When I zip the project up and send via email - the same results occur.
Many times these files that xcode can't find and that fail the build, are media files, like a image or video. Sometimes I see the three20 framework too.
My question is - how in xcode should I set a project up to play nice with git and or code sharing in general. Let me know if you need more information, I know the above is a little vague.
The first thing I always do is set up the .gitignore file before adding any other files from the project. Problems can occur when loading project settings for two different machines that may have the same User account name. You have to make sure some settings aren't added to the repo whilst others are.
I set up my .gitignore by adding the following:
.DS_Store
*/.DS_Store
*.swp
*~.nib
build/
*.pbxuser
*.perspective
*.perspectivev3
*.mode1v3
*.mode2v3
Documentation/Generated
doxygenWarnings.txt
*.xcodeproj/xcuserdata/*.xcuserdatad
*.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad
*/*.xcodeproj/xcuserdata/*.xcuserdatad
*/*.xcodeproj/project.xcworkspace/xcuserdata/*.xcuserdatad
If you create the repos from scratch or run git rm --cached <filethatshouldbeignore> to each file that should be ignored and then commit, see if the problem still occurs.
Problems will occur in the .pbxproj file, so make sure all conflicts are corrected too.
Regarding files that cannot be found, remember to import the libraries etc. into the project folders and reference them from there. Apple's own iOS libraries should be fine, but others won't be. For example, in your project folder, copy your images from there and reference them only within the project folder.

Resources