PhoneGap Facebook Connect Plugin on iOS - ios

I was wondering if any succeeded with the instructions at : https://github.com/phonegap/phonegap-facebook-plugin ?
My environment is as follows:
1) xcode: Version 4.5.1 (4G1004)
2) Phonegap: 2.5
3) Macbook Pro 64bit.
4) Facebook SDK 3.2
5) Target build is iOS5 ( tried 6 but also failed )
After following the instructions at https://github.com/phonegap/phonegap-facebook-plugin for iOS, my build failed.
And the error message is:
ld: 379 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
can anyone point me as to how to fix this error ?
any online tutorials, or step by step instructions will be great too.
Thanks!

I had the same issues, and fixed it by following this on Github : https://github.com/ghn/phonegap-facebook-plugin/commit/83d41c1b3e999f11333ff7da89918ff6e58bf72f
Add the Cordova Facebook Plugin:
Locate the plugins section of your Project Navigator and create a group "ios". Make sure it is added as a "group" (yellow folder)
From the Cordova Facebook Plugin folder copy FacebookConnectPlugin.h and
FacebookConnectPlugin.m from the src folder into the new group "ios".
Find the config.xml file in the project navigator and add a new entry as a child to the plugin tag:
< plugin name="org.apache.cordova.facebook.Connect" value="FacebookConnectPlugin" />
You have to create an ios folder into the plugins directory. And ensure FacebookConnectPlugin.h and FacebookConnectPlugin.m are removed from plugins directory.

This error usually comes from including both a compiled library (as a framework in the project or as a build target in the "Build Phases" project properties tab) and the .m source files that generate it.
Some tutorials tell you to include the FacebookSDKResources.bundle frameworks and some tell you to copy the source files in Plugins/ios/facebook. If you do both you'll get this error.

Related

Xcode project giving pod file error for FIRAnalyticsConnector.framework . How to solve it?

I'm working on a book project and the project is connected by API . I'm working on the book app which has different libraries imported from the various places.
Recently, i cloned the project from bitbucket in Xcode and tried to run it. The result i got i error as follows:
enter image description here
It shows :
ld: in /Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_a8eeba373b74508311b8b22b8d3202a6.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/ishinfoservices/Documents/vadltaldhambooks/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Help needed to fix the error, as the project has lots of mixes of old libraries along with .h and .m files, the swift files with wireframes
According to the image I saw that you are trying run the app on the iOS simulator, then you could try to add the arm64 to the Excluded Architectures on the Build Settings section of your project or target, it would be like:
Take in mind that if you use Cocoa Pods is possible that also you should add the arm64 to the Exclude Architectures into the Pods project
After the above, clean, build and run the project on the iOS simulator, is possible that on your physical device you must remove the arm64 from the Exclude Architectures, it could depend on what you use in your project.
On the other hand, you can try the following: Select the project -> Select the target -> Go to the Build Phases -> Expand the Link Binary with libraries and add all pod libraries (remove if they exist in embedded binaries or Remove the old FrameWorks), after that, clean and build the project

Not able to link a Carthage framework to Xcode project

I am trying to link a new framework downloaded via Carthage to one of my project but getting a linker error:
I'm following these steps:
Updated the Cartfile with the framework location.
Run carthage update command to fetch the framework.
Under project target -> Build Phase added a new Run script and renamed it to Framework Copy.
Added the script to copy the framework from the file system : $(SRCROOT)/Carthage/Build/iOS/CleanroomLogger.framework.
Dragged and dropped the framework from the mentioned location under Link Binary With Libraries section of project target -> Build Phase.
Double checked the Framework Search Path under build settings and it seems to be set correctly : $(PROJECT_DIR)/Carthage/Build/iOS.
Am I missing something?
Eventually it turned out to be deployment target issue. The framework I was linking was supported with minimum deployment target as 8 and I was running with 7 :). I wish the build error could be more descriptive.

‘Cordova/CDV.h’ file not found in Xcode 8.2.1

I have one hybrid Cordova project, which is running fine Xcode 5.1.1, but when I am trying to Archive the project in Xcode 8.2.1 with ‘Generic iOS Device’ I am getting the error ‘Cordova/CDV.h’ is not found.
I read many articles about this problem, but none could solve my problem. Most answers are telling to follow the below steps:
"Add this line to your Build Settings -> Header Search Paths:
$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
"
I have did this but problem not solved, getting another error ‘ld: library not found for -lcrt1.3.1.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)’
Also I have changed the bitcode YES to NO in target Build Settings, but no fruitful result.
Project cordova version 3.4.0 where installed cordova version in machine 6.4.0
Has anybody experience with this kind of problem?
Please, can anyone help? I've been working on this for days.
I got it work by following below steps
In your Xcode project settings select TARGETS
Within TARGETS select the Build Settings tab
In the sub-options under the Build Settings tab be sure to select All
Scroll down to the Search Paths section
Locate Header Search Paths
Add the following configuration to the Release option (as a new value on its own line): $(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include
Clean the project: Command + Shift + K
Restart Xcode
I wanted to report that the response provided by Vinay worked for me. I had to make sure I was in the share extension target, and I added it to the path exactly as suggested above in the Release option, and did not even have to do a clean to get it to regenerate the PCH.
BUT, I was puzzled by this after looking at the setting further and I realized this path was already in the setting. I edited it again, and removed the redundant path, hit 'run' again, and it loaded onto my iPhone and ran fine.
So, I believe that just setting this in the search path forced a recompile on the share extension PCH and all is working again.
I hope this helps others.
I know its too late to answer on this question but still many developers facing the above issue and as per the latest Cordova & ionic version below steps will work in the above error.
As per new update in Cordova some time due to some permission issue or directly run or build iOS platform it's unable to add below file or folders in your iOS project platform :
CordovaLib
so somehow above folder will not add in your project and that's why it's not building your iOS project.
To overcome this issue you need to remove iOS platform from your ionic project and again add it.
Remove iOS platform: sudo ionic cordova platform remove ios
Add it again: sudo ionic cordova platform add ios
By doing this cordova download CordovaLib folder from server and add it into your iOS project and after that users can able to build their project without any error.
recently I faced this issue and I solved by doing the above steps.
Hope this helps others.
Happy coding!
Seems like the "Cordova" folder isn't getting copied into the project during cordova platform add ios
So, you'll have to copy the "Cordova" source folder into your project manually. But you'll have to download the ios source packages from github first, which is located at:
https://github.com/apache/cordova-ios
After downloading the "cordova-ios-master.zip" package and unzipping it, copy the folder named "CordovaLib" into your project next to the Xcode project file:
PROJECT_FOLDER/platforms/ios/PROJECT_NAME
PROJECT_FOLDER/platforms/ios/PROJECT_NAME.xcodeproj
PROJECT_FOLDER/platforms/ios/PROJECT_NAME.xcworkspace
PROJECT_FOLDER/platforms/ios/cordova
PROJECT_FOLDER/platforms/ios/CordovaLib <------- here
PROJECT_FOLDER/platforms/ios/ios.json
PROJECT_FOLDER/platforms/ios/platform_www
PROJECT_FOLDER/platforms/ios/pods-debug.xcconfig
PROJECT_FOLDER/platforms/ios/pods-release.xcconfig
PROJECT_FOLDER/platforms/ios/www

clang: error: linker command failed with exit code 1, only when testing on device

I was just about to test my app on a device when I ran into this problem, I'm getting this Linker Error.
I've already checked all my compile sources and Build Phases, but there's no sign of my importing things twice.
ld: duplicate symbol _calculateNextSearchPage in /Users/wouter/Sites/test/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit) and /Users/wouter/Sites/test/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit) for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
This only happens when testing on a device, not in the simulator.
Alright guys I had the same problem. Seems like I fixed it.
I am using cocapods therefor the described standard procedure can not be properly executed.
Steps to do to properly add FastPDFKit with Cocoapods.
Download FastPDFKit
In your project Add Files to "Your Project"
go to FastPDFKit folder you just have downloaded
locate 1 folder and 1 project file. Press and hold Command key and add these in to your project
FastPdfKit.xcodeproj
FastPdfKit.embeddedframework
(Note: FastPdfKit.embeddedframework is the actual Framework and you
might want to open FastPdfKit.xcodeproj standalone before adding it
to your project, delete FastPdfKit.embeddedframework folder from
your disk and Build FastPdfKit target in the project. You should see
newly created FastPdfKit.embeddedframework folder)
Go to your Project Settings > Your target > Build Phases > Link Binary with Libraries
Make sure FastPdfKit.framework is there.
If not, drag it from the project and put it there.
Clean the project, delete derived data
Add #import <FastPdfKit/FastPdfKit.h> where you need it and you are good to go.
Here is how my Link Binary with Libraries look like
Please let me know if you have any troubles I might've missed something.
Try to delete duplicate files/images which are in target-> Build phase -> Compile files, Copy bundle resources

Linker error building project with Facebook SDK

I just added the latest Facebook SDK code from Github to my project. Because I'm using ARC, I used their supplied shell script to build the static library. I added it to my project and made sure the static library is being linked, but I'm receiving this linker error:
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_FBFrictionlessRequestSettings", referenced from:
objc-class-ref in libfacebook_ios_sdk.a(Facebook.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Here are the linker settings:
Any ideas?
The head revision has some recent changes that seem to have broken ARC builds (static library). The static library builds ok, but then when used in my project I get the linker errors. What I did to fix the problem was to revert to the previous version of the Facebook sdk and these linker errors went away.
See https://github.com/facebook/facebook-ios-sdk/commits/master
I used the version checked in on the 24th Feb (not 25th Feb, sorry Jason Clark!)
https://github.com/facebook/facebook-ios-sdk/tree/9acf74345bb248d698966eac9a3057a4b4be1b0f
The Feb 25th commit has FBFrictionlessRequestSettings.m missing from the xcode project so it is not included in the static link library eventhough the header is.
1.- Clone the latest repo, at the time of this post the latest commit is: https://github.com/facebook/facebook-ios-sdk/commit/4e3567c40e3b7f8156a82f18e5a2f5cd18e077eb
2.- Open the xcode project facebook-ios-sdk.xcodeproj under the src directory
3.- Add FBFrictionlessRequestSettings.m under FBConnect.
4.- Using the project Navigator, make suer FBFrictionlessRequestSettings.m is listed in build phases under compile sources
5.- Save and close xcode project
6.- Run scripts/build_facebook_ios_sdk_static_lib.sh to build most recent static linked library and follow installation instructions, you should be able to compile and link your project without any issues.
Better yet, clone this repo and build it. All ready to go https://github.com/alvarezm50/facebook-ios-sdk
Looks like something whent wrong when building your fb-ios-sdk … Everything up2date and there were no errors when building the static lib?
I have no problems getting the latest version of the SDK up & running in the simulator or on my iOS5 device.
Here's what I did (OS X 10.7.3, Xcode 4.2.1, iOS5 ARC)
Grab the lastest source files: https://github.com/facebook/facebook-ios-sdk/zipball/master
Unzip files & build it cd ~/facebook-ios-sdk/scripts/ && ./build_facebook_ios_sdk_static_lib.sh
Now grab the facebook-ios-sdk folder inside ~/facebook-ios-sdk/lib/, put into your Xcode project foler like this: http://cl.ly/1X3B203f272z2l0w2t39 & link against libfacebook_ios_sdk.a in Xcode
Add ${SOURCE_ROOT}/facebook-ios-sdk to your Header Search Paths
I have tried this procedure and able to fix it.
Select Your project Target -> build phases ->compile Sources
add all the .m files from facebook static library also json static library.
Now if you run the app it wont throw any linker errors.
I had the same issue. It turned out to be fairly trivial. I do use XCode's support for git, preferring to use the command line. However, this means that I need to make sure that every time I pull from git I also add any new files and remove all deleted files. In this case, FBFrictionlessRequestSettings.* did the trick.
File->Add Files to "My Project"
This has been fixed in master as of 2/27. Please pull the master and that should take care of this issue.
https://github.com/facebook/facebook-ios-sdk/commit/e10bdc15b31ab23b229f1f3e77b0e8d7affe60af
Thanks!

Resources