XCode 8 - Build works but archive fails - React Native - xcode

I have an haunting issue. I am trying to build an React Native app in Xcode 8. Build/Run in Simulator works fine but as soon I start to archive I am getting the following error:
Apple Mach-O Linker (ld) Error Group
clang: error: linker command failed with exit code 1 (use -v to see invocation)
That's the only error and it's after all steps have been completed with no further explanation.
Now I installed Fastlane and found out that it fails because of duplicate symbols. Removing the duplicates from "Linked Frameworks and Libraries" solves the issue and allows me to archive the app.
However now I can't build anymore for the simulator because of missing symbols.
I been looking into this for 2 days now and I can't find a solution.
Anyone has an idea why this is happening and how to solve it?

I found the solution for it!
Based on this thread https://github.com/facebook/react-native/issues/12814 if you use Pods, it also includes the base react project which will end up causing the duplicate references.
In order to fix this issue, the react reference need to be removed:
Open your [yourproject].xcworkspace
Select your Pods project
In TARGETS delete React. (clicking on the minus button - below of the targets list.)
Clean (Product > Clean) & archive/build/whatever.
Kudos to andfk for this solution!

Related

XCode 12 error building project with error libDoubleConversion.a, building for arm64 but attempting to link with file built for x86_64

I am getting following error when trying to run a react-native project in xcode simulator
ignoring file ../libDoubleConversion.a, building for iOS Simulator-arm64 but attempting to link with file built for iOS Simulator-x86_64
Undefined symbols for architecture arm64: "double_conversion::DoubleToStringConverter::ToPrecision(double, int, double_conversion::StringBuilder*) const"
Here is how my xcode is configured
Also added VALID_ARCHS in pod file and in project
Tried to add Linked Binary with libraries libDoubleConversion.a it didnt help. I also tried to exlude arm64 in Excluded architectures but then the error reverses Simulator-x86_64 -> Simulator-arm64 but on different file, Tried to use Xcode 13 beta same thing. So i got the point i am just going in circles and cant find a solution to successfuly run this project.
I found the answer here
https://stackoverflow.com/a/68273669/1393695
Turns out the newest version of Flipper-Folly (2.6.9) is causing this
issue. Replace that line
use_flipper!({'Flipper' => '0.92.0', 'Flipper-Folly' => '2.6.7'})
With this i got an error in Xcode could not find swiftSwiftOneOnoneSupport..., then i added this lib in Link binary with files. And managed to run the build successfully.

Flutter library not found for -ldevice_info, can't archive the ios app with xcode

when I try to archive the app or run in a real device, I always get below errors:
ld: library not found for -ldevice_info
clang: error: linker command failed with exit code 1 (use -v to see invocation)
but if I just run in a simulator, everything is ok, if I try to remove the device_info package, then it will also show another package not found:(
I am using the latest flutter dev sdk, and I have setup a valid iOS developer certificates.
Thanks!
It seems that the solution here in this SO post as mentioned in the comment works for this case:
In new projects, in the iOS part is necessary to adjust a few
parameters, such as signing, and that you can only do in Xcode.
So, try to open the iOS project with Xcode and try to build it from
there. You'll see better warning and error messages there, specially
regarding signing.
You can open Xcode and locate your project ios folder, or:
cd yourproject/ios
open -a Xcode .
Then select Product > Run in the menu.
Also, this GitHub post discussion could also be a possible reason for other cases. Try to check the following:
I was able to successfully archive with your pubspec.yaml.
Can you confirm you opened ios/Runner.xcworkspace and NOT ios/Runner.xcodeproj? See Better handle case where a developer
opens Runner.xcodeproj instead of Runner.xcworkspace
#10770.
Did you run flutter build ios before you Archived? See https://flutter.dev/docs/deployment/ios#create-a-build-archive.

Adding Facebook SDK to a project without CocoaPods in Xcode 10

I'm not able to build my app with the Facebook SDK in iOS 10. I've included both the "Bolts.framework" and "FBSDKCoreKit.framework" frameworks to my projects. I've also added my Facebook SDK folder to the "Framework Search Paths" in "Build Settings". This is the folder that contains these frameworks.
I'm getting this error and I'm not sure how to resolve it. My project compiled fine in Xcode 9 but won't compile in Xcode 10. Is there another step I'm missing in Xcode 10?
'FBSDKCoreKit/FBSDKCoreKit.h' file not found
UPDATE: Xcode seems to not be able to find the frameworks. This is the error I'm getting. I dragged the frameworks into Xcode from that folder. If I right-click on the framework and click "Show in Finder" it goes right to the frameworks so I don't understand my Xcode can't locate them.
ld: warning: directory not found for option '-F~/MY_FOLDER/FacebookSDK'
ld: framework not found FBSDKCoreKit
clang: error: linker command failed with exit code 1 (use -v to see invocation)
UPDATE 2: Even if I remove that folder from my build options Xcode still complains it can't find the frameworks. I have to completely delete them from my project in order to build successfully.

Issue with running application on iOS9 XCode 7

After several hours of investigation I am stuck with this one. After migrating from Swift to Swift2 I manage to deal with all the errors, but in the end I got clang error:
ld: file not found:
-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I am not really sure why does this happen nor how I can resolve it. Some of you got similar problem ?
I tried :
close/open XCode
clean build
clean build folder
delete derived data
tried to add another device (Devices screen, add simulator)
tried to build for iOS device ( same error, just instead of iphonesimulator i got iphoneos )
opened particular folder, everything is there
I am able to open iOS simulator from code
EDIT, Oct-9-2015:
After a bit more investigation, I found out following:
Pods compile correctly. Every one of them.
If I remove iphonesimulator/iphoneos they don't work
Tried to clear Library path, set it to various differenet values - no success (Library path because of -L at the start).
Found out that swiftCore is somehow missing in path:
Unable to find swiftCore; please set SWIFT_LIBRARY_PATH (currently '')
to the folder containing swiftCore.
Building from terminal to get more info about the error.
Tried to restart computer, reinstall XCode and other most common things
Tried other project - working without problem(project without pods)
Seems like this will be a diary till I commit suicide...
After 2 days of losing my mind, finally got to the solution. Hope it will save someones day :)
First, I decided to recreate the project file and pods to see if there is something wrong with them. It turned out they are fine. Project build without any issue.
So, clearly, problem was in the project/workspace file. I started comparing flag by flag, and ended up in changing the following:
Duplicate Pods_X.framework - removed one
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO - was YES before
GCC_SYMBOLS_PRIVATE_EXTERN = YES; - was no for debug
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - was something long before
If someone knows why this flags could produce something that painfull I will be happy to find out...

Apple Mach-o Linker Error Cocoa Pods AFNetworking iOS 7.x.x & iOS 8.x.x

After debugging in iOS 6 I tried to go back to debugging in iOS 7 however now I keep getting the following build errors. I have tried searching Google, Stack Overflow, Apple Dev Forums but sadly all suggestions don't seem to work. Xcode allows me to build an Archive and that works fine on a real device, but I am having issues when trying to run on the software or the real device when in debugging. Any Ideas?
I deleted and re-added the pod by running "pods installs" in the app folder, cleaning the build, sadly to no success. I have also checked all the build settings for all targets and to my knowledge all the correct architectures are present. I have tried the "select valid architectures and press delete" but nothing changed.
Build Errors:
Pods-AppName was rejected as an implicit dependency for 'libPods-AppName.a' because its architectures 'i386' didn't contain all required architectures 'i386 x86_64'
ld: library not found for -lPods-AppName
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Thank you in advance for any potential help.

Resources