Can't use FBSDKShareVideo without ENABLE_BITCODE Linker command error - swift

I have the latest Bolts, FBSDKCoreKit, FBSDKLoginKit and FBSDKShareKit as part of the Facebook SDK frameworks which I am using in Swift. In a Swift file, I imported FBSDKCoreKit and FBSDKShareKit. If I use FBSDKShareVideo in any way, I get a Linker command error that reads
".../Frameworks/FBSDKShareKit.framework/FBSDKShareKit(FBSDKShareVideo.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)"
-I've looked up solutions to this online, mostly which were to set Enable Bitcode in the project's settings, which was already set to YES. I also tried setting it to NO. I've tried various combinations of YES and NO with the project and target's settings.
-I then added the frameworks to the Copy Bundle Resources and rebuilt. I still get the error.
-I've cleaned, rebuilt
-I quit out of Xcode and reopened the project and rebuilt.
The line in which I try to use FBSDKShareVideo reads:
let video : FBSDKShareVideo = FBSDKShareVideo()
Without using that line and having the FBSDKCoreKit and FBSDKShareKit imported, I get no errors. So how can I possibly resolve this so I can use FBSDKShareVideo?

Related

Framework not found FBLPromises (Swift Package Manager)

I've seen this problem listed elsewhere, but it always seems to be linked to a Cocoapods installation of Firebase. My problem is the opposite - trying to upgrade from pods to SPM has given me this problem when I try to compile:
ld: framework not found FBLPromises
I'm currently running Xcode 13.3 on a Mac Mini with an M1 chip, but the problem was present in earlier versions of Xcode.
Previously I had Disk (https://github.com/saoudrizwan/Disk) installed via SPM and Firebase/Messaging and Twilio (5.5.1) installed via Cocoapods. I ran pod clean and pod deintegrate, deleted all the Pod files etc and have installed Twilio and Firebase Messaging using SPM. This gives me the following Package Dependencies (and you can see that Promises 2.0.0 has been added successfully):
The top result I get when I look into this is FBLPromises Framework not found, and the second answer suggests adding arm64 as an excluded architecture, but doing that gives me further problems (warning and error below), and I'd rather not exclude an architecture blindly and then go down a rabbithole of trying to fix that when it might not be the solution to my original problem.
Warning and error when I try to exclude arm64 architecture:
None of the architectures in ARCHS (arm64) are valid. Consider setting ARCHS to $(ARCHS_STANDARD) or updating it to include at least one value from VALID_ARCHS (arm64, arm64e, armv7, armv7s) which is not in EXCLUDED_ARCHS (arm64).
error: Build input file cannot be found: '/Users/myName/Library/Developer/Xcode/DerivedData/project-exchrqebmyccatebeoxupvxpdsul/Build/Products/Debug-iphoneos/project.app/project' (in target 'project' from project 'project')
I've not checked to make sure I've not introduced other errors further down the line, but I think the problem was caused by Linker Flags being retained in the build settings.
I went to the Target -> Build Settings -> Linking and deleted everything under 'Other Linker Flags' (OTHER_LDFLAGS is how this is reflected in the project.pbxproj file according to my git diff).
File now compiles and runs successfully, if I find some subtle bugs later that might be caused by this I shall edit this answer accordingly!

Xcode 9.2: linker command failed with exit code 1 (use -v to see invocation)

I installed Cocoapods. I used GoogleMaps. When I build workspace on my device i get this error: Error
I also tried all this instructions: Linker command failed with exit code 1 after installing CocoaPods and firebase pod
P.S. Building on simulator works
Probably you've already check if you've open the .xcworkspace created in your project folder.(NOT .xcodeproj)
If still doesn't work try
Go to Project Settings.
Go to Build Settings.
Change BUILD ACTIVE
ARCHITECTURE ONLY to NO.

clang: error: linker command failed with exit code 1 (use -v to see invocation) Parse.com and Swift

so today I updated my code to Swift 2 and now my app won't run because apparently the Parse Frameworks I was using have expired or something. This is the message I get: ld:
'/Users/tripphillips1/Desktop/Spotter/Parse.framework/Parse(PFAnalytics.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64
Does anyone know what this means and how i can fix it?
Thanks
Ok so I found a solution to my problem. You have to go into the Build Settings and disable the Bitcode. Simple as that. Now it runs fine.

ld: 871 duplicate symbols for architecture armv7, clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am using FastPDFKit in my iPhone app for displaying PDF. When I run the project on simulator, it works fine. However when I run the project on iPhone, it gives me below error.
duplicate symbol _value_map in:
/Users/alkandari/Desktop/iPhone Apps/MyTest002/MyTest002/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit)
duplicate symbol _writeUnicodeToUTF8Buffer in:
/Users/alkandari/Desktop/iPhone Apps/MyTest002/MyTest002/FastPdfKit.embeddedframework/FastPdfKit.framework/FastPdfKit(FastPdfKit)
ld: 871 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld: 871 duplicate symbols for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any idea why it is happening like this?
Error comes when I add FastPDFFramework in Configuration in Debug and Release section.
Here's a solution I found even after messing with the header/framework search paths, rebuilding, etc:
http://support.fastpdfkit.com/discussions/problems/443-i-am-unable-to-link-fastpdfkitembeddedframework
I removed the -all_load linker flag in my project and it compiled successfully. As a warning, make sure removing this flag is appropriate for your project. It was probably placed there for a reason
Can you try to clean up the FastPdfKit target and recompile it? It should generate a new framework ex-novo that you then should be able to add to you project, overwriting the one you are using. You can grab the new .embeddedframework in the FastPdfKit project root directory.
These line helped me from the link below.
http://support.fastpdfkit.com/discussions/problems/759-duplicate-symbols-for-architecture-armv7
there are another reason this error often happens is accidentally importing the .m file instead of the .h.
it's happened to me :)
link : https://stackoverflow.com/questions/12279622/duplicate-symbols-for-architecture-i386-clang
You have too many #include or #import directives in header files for the same things. Move to using #class in headers and only import/include in your .m files.
In all you just need to review where these are and reassess them.
I add my solution, as if you follow the readme, it will ask you to do:
Inherit the project options: select the Project an from info tab and configurations line choose **FastPdfKitFramework** from the drop down list;
I replace the FastPdfKitFramework target to None and now it work great.
As it is on the readme file, I never add .a in my project so download the recompile one don't help me as I do not want to restart all integration.
I hope it can be helpful for someone.
I tries removing -all_loads linker flag, and it worked for me without any problem in the project.

facebook ios sdk build fails on device, works on simulator

I am trying to build an app (with ARC) that uses the facebook_ios_sdk (the latest version on github).
As recommended by Facebook, I used the build script to create a static library and then added it to the project.
Now when I build the project for an iPhone 5.1 Simulator, it works fine. However, on running it for an actual device (which is running 5.1), it gives the following build error -
ld: in ../facebook-ios-sdk/libfacebook_ios_sdk.a, file is universal but does not contain a(n) armv7 slice for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any suggestions on how to resolve this?
You could modify the build script for static library (which was too complicated for me), or just skip the library approach:
add the Facebook sources from SDK to your project
if using ARC, go to "target->build phases->compile sources" and mark all the Facbook source files with the--fno-objc-arc flag
That's it, works for me.
One work around that worked was to change the Valid Architectures from"armv6 armv7" to just armv6