Facebook iOS SDK sample code doesn't compile - iphone

I downloaded the code from https://github.com/facebook/facebook-ios-sdk
But none of the sample projects compile in Xcode. I have read the readme.txt and it doesn't help.
The error is: 'FacebookSDK/FacebookSDK.h' file not found
There is no folder called FacebookSDK, it's actually called src. When I change the code to say src the new error is: ld: framework not found FacebookSDK
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Can anyone download the code and get the samples to work?

I wrestled with this same problem for a while before discovering that there is a not-so-obvious file that is supposed to be downloaded and installed (versus just getting the ZIP file and its contents). The file is called FacebookSDK-3.0.pkg and I found it at:
http://www.google.com/url?sa=t&rct=j&q=facebooksdk-3.0.pkg&source=web&cd=1&ved=0CEgQFjAA&url=https%3A%2F%2Fgithub.com%2Fdownloads%2Ffacebook%2Ffacebook-ios-sdk%2FFacebookSDK-3.0.pkg&ei=Mg8kULzOLofgiALg14DwDQ&usg=AFQjCNF0i0Vkq_cPsOvfrs5nb_IOUR6XhA&sig2=kERJcdvR7UgAB6mr-RUi6w
(first link provided when searching for the filename)
I installed it and the samples work fine now.

Facebook SDK 3.0 for iOS with samples
For more details https://developers.facebook.com/ios/

If you install the package to another location besides ~/Documents, you need to change the Framework Search Path for the sample projects.
When you open the project up in XCode, click the project info (e.g. blue "HelloFacebookSample" in the file browser.
Go to the Build Settings tab.
Under the "Search Paths" section, find "Framework Search Paths".
Doubleclick the value and you'll see an entry that is like:
$(SRCROOT/../../../../Documents/FacebookSDK
Double click that value and change it to point to the destination folder where you placed the SDK.
In my case, I installed the SDK to /Dropbox/SDKs/FacebookSDK so I changed the value to
$(SRCROOT/../../../../SDKs/FacebookSDK
(the 4 ../ are because it's relative to the HelloFacebookSample project)

Related

Pod install GPUImage does not work

I am working on a Swift project with cocoapods. Here is Podfile:
pod 'GPUImage', '~> 0.1.4'
After i run pod install, i try got the error about import file:
import GPUImage
I uninstalled GPUImage from podfile, then try the second solution, i got different error.
This link is the project instruction on github. My steps are:
Copy&Paste GPUImage.xcodeproj into project root directory, and added it into my project.
Go to "Build settings" -> "Build Phases" -> "Target Dependencies", added PUImageFramework, in Link Binary With Libraries section, added GPUImage.framework.
But i got an error:
error: unable to read module map contents from 'Source/iOS/Framework/module.modulemap': Error Domain=NSCocoaErrorDomain Code=260 "The file “module.modulemap” couldn’t be opened because there is no such file." UserInfo=0x7f872cfb0b80 {NSFilePath=/Users/william/A/muguang-ios/Source/iOS/Framework/module.modulemap, NSUnderlyingError=0x7f87413f4dd0 "The operation couldn’t be completed. No such file or directory"}
Any help, thx!
EDIT:
The error right now is:
dyld: Library not loaded: #rpath/GPUImage.framework/GPUImage
Referenced from: /private/var/mobile/Containers/Bundle/Application/9CF1D10C-1D78-40CB-955F-19110B3C3EA8/testGDU.app/testGDU
Reason: image not found
EDIT:
For solution without using pods, here is solution:
You then need to add a new Copy Files build phase, set the Destination
to Frameworks, and add the GPUImage.framework build product to that.
This will allow the framework to be bundled with your application
(otherwise, you'll see cryptic "dyld: Library not loaded:
#rpath/GPUImage.framework/GPUImage" errors on execution).
But question 1 with cocoapods still not work.
it's my bad, i got the solution:
You then need to add a new Copy Files build phase, set the Destination
to Frameworks, and add the GPUImage.framework build product to that.
This will allow the framework to be bundled with your application
(otherwise, you'll see cryptic "dyld: Library not loaded:
#rpath/GPUImage.framework/GPUImage" errors on execution).
I had the same issue with the following library versions:
Xcode 6.3
Cocoapods 0.37.2
Finally I solved this issue by the following steps:
First step:
Open Xcode
Click Window (Menu Bar)
Click Projects
Remove all projects (e.g. use backspace)
Close Xcode
Second Step:
Open a terminal app
cd ~/Library/Developer/Xcode/DerivedData
rm -rf Build/* see below if you have a customized build location
rm -rf ModuleCache/*
Close a terminal app
Third Step:
Open Xcode
Product > Clean
Product > Run
If you have defined a custom build location:
Go with Finder or the Terminal to the location of the build files. The location for these files is defined in Xcode. To check where these files are:
Open Xcode
Go to Settings -> Locations -> Derived Data
Go to that location and delete the Build folder
Then everything work well.
Hope this can help somebody in the future.
In my case, just change Develop account in Signing & Capabilities then build app again. It works

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.

Copying facebook-ios-sdk and configuring the Xcode project

I have gone through this document :Getting Started with the Facebook SDK for iOS v3.1
I have successfully configured my Xcode project by following it.
But I want to do it without adding the Facebook.framework.
As previously we used to only add the "src" folder which we used to clone from :Facebook SDK for iOS - Github. Why can't I just copy the "src" folder and configure my project.
I want to play around with FBFriendPickerViewController.m (dot m) file. Which I am not able to view if I follow the standard tutorial. But is available in the "src" folder.
Please how can I do that ? And it also seems that FbGraph.h file doesn't exist.
Please help.
If you want to play with the source, go to:
https://github.com/facebook/facebook-ios-sdk/
After getting the code, run this script to build the framework locally:
<Install Location>/scripts/build_framework.sh
This will drop the framework in the folder:
<Install Location>/build
Follow the same instructions in the Getting Started to include the Facebook SDK, however, you will get the framework from your local build folder.
Note: You'll likely have to modify the build search path in Xcode if you're swapping out, say one of the sample projects (that was looking for the Framework in a particular place).

XCode Compiler Error: ld: library not found for -loauth

I'm trying to use the Twitter libraries and after adding liboauth.a and adding oauthconsumeriphonelib to my header search path, I'm now down to 1 compilation error, which I can't seem to get rid of.
ld: library not found for -loauth
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
Anyone know what could be causing this?
Continuing to What Robin suggested You also need to set the Library Search Path. Right Click the Target File and Choose -- Get Info else you can also get the same by choosing Edit Actice Target Under the Project Tab in XCode. Look for Library Search Path and add this "$(SRCROOT)/Twitter+OAuth/SAOAuthTwitterEngine" Where Twitter+OAuth/SAOAuthTwitterEngine is the directory path for Twitter Library in project folder.
I hope this will fix the problem.
Well #Nefsu you need to add those libraries to your project by adding an existing framework and then giving the path of the libraries you want to use.
And if you have already added the libraries by drag and drop, than dont remove them just add existing framework by right clicking on groups and folders and add the libraries from the folder and you will be done
I discovered this HIGHLY misleading message while trying to upgrade to the new Google Analytics library.
In my case the problem was having TWO CONFLICTING COPIES of the library. They were in different folders but both were listed in my App's Library Build Paths (under Build Settings).
Moving all the deprecated library files out of the folder ended up doing the trick and made the mysterious error messages go away.

iPhone application build fails with "dyld: Library not loaded: /System/[...]" error? Why?

For my own reasons and not for the app store I am referencing the Apple private framework Apple80211 in an iPhone app. I got the framework from an earlier version of the iPhone SDK.
I added the "existing framework", verified that that absolute path to the framework is
/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.0.sdk/System/Library/PrivateFrameworks/Apple80211.framework
and tried to build the app.
But the build (to device) fails with the error
dyld: Library not loaded: /System/Library/PrivateFrameworks/Apple80211.framework/Apple80211
Referenced from: /var/mobile/Applications/3691587D-87AF-44EA-A505-F73D17F39B3B/iWire2.app/iWire2
Reason: image not found
I cannot figure out why Xcode would look for the library in a /System path (instead of using the path given in the frameworks list) or how to change that behaviour.
I tried the tricks I found here and elsewhere for similar (and identical) sitiations:
Delete the myusername.* files in the xcodeproj bundle
Delete the build directory
Clean all targets
Start new project
Result is always the same.
How can I add this (or a) framework to an iPhone project AND get Xcode to at least look at the library located where I point to rather than a location in /System?
You can try to open project file with text editor, found records for that library, and check which exact path is stored there. Probably, XCode added some defines inside it.