XCODE - linker command failed with exit code 1 - since xcode update - ios

I have recently updated my xcode and since doing so I have the following error.
I am not sure why this has all of a sudden appeared? Any help would be fantastic.
Thank you

You can try clean project, delete Derrived Data and Clean Simulator.
It is a first that you can try to resolve this issue.

You can follow this steps -
Press "Cmd+Shift+K" to clean up, and quit Xcode.
Delete the cache Run "rm -rf ~/Library/Developer/Xcode/DerivedData" in terminal
Open the project and re-build it
And make sure to add necessary framework to your project. Check all third party party framework and search its required framework for support. Hope this will solve your problem.

Related

error Couldn't find "PLATFORM_NAME" variable in xcodebuild output

I'm trying to run my application on an iPhone simulator. from the console, I can see the build was successful. but on the next line, I get this.
error Couldn't find "PLATFORM_NAME" variable in xcodebuild output. Please report this issue and run your project with Xcode instead. react-native.
This is quite bizarre, but after getting this error I opened up the workspace in Xcode and ran it from there. Afterwards this error went away when running react-native run-ios
I suspect this might have something to do with the way Xcode 12 optimizes builds and that re-building it from Xcode somehow fixed it. I would like to know why, but I cbf'ed figuring it out myself.
This happened to me because I clean up some image, and removed some native dependancies. All I did was cd ios && pod install then yarn ios to build again.
Tried cleaning build folder and ran, it worked.
Xcode toolbar -> Product -> Clean build folder
Step - 1: Clean the build folder from Xcode.
Xcode toolbar -> Product -> Clean build folder
Step - 2: Delete the App installed in the device/simulator
Step - 3: Go to VSCode and move to ios directory using command line and just to be on the safer side, run the following command (just to remove build folder via VSCode as well)
rm -rf build
Step - 4: Run
pod install
Step - 5: Go back to the project folder and build the app again:
npx react-native run-ios
Context: react-native upgrade fails and cleaning the build folder doesn't work.
What works:
Trash out the node_modules folder.
Make yarn install to re-create dependencies.
It doesn't have any impact on "Podfile", but if you (future users) did, remove Podfile.lock, go to the ios folder and run pod install again. It must solve.
This is obviously overkill, but a reboot fixed this problem for me. I turned off my computer and turned it on again, and it's now working well.
When I log in to "Podfile" I will not be able to say why it does not work, but if you (future users) do it, remove Podfile.lock, go to the ios folder and run it again pod install. It must be resolved

Build fail for google-signin package in react-native?

I am trying to implement react-native-google-sigin package to my react-native Ios project . I have configured everything.
But now the problem if I include google framework to my project there is a pop an error and As soon as I remove it. It works!!
I really don't know why m getting build fail with the following error
Every time i include ios/GoogleSdk frameworks in my project.
I don't know why or how but I ran into this issue and after numerous cleans, DerivedData deletes etc., the solution that worked for me was to follow XCode's advice on upgrading to the recommended settings and changing the iOS Deployment Target of RNGoogleSignIn project to 8.0. I'm using XCode 9 if that helps.
This is how I solved this:
rm -rf node_modules/ ios/
(Copied my podfile to another location)
npm install & react-native upgrade
(this will give me a error free start cause by react-native link)
cp my podfile inside ios/ Pod install
Followed the remaining steps from react-native-google-signin
Added the following to my login.js (iosCLientId and CLientId are different Id's)
await GoogleSignin.configure({
iosClientId: 'iosClientId',
webClientId: 'webClientId',
offlineAccess: false
});
Open Xcode Clear and Build the project.
Note: I would have easily removed the googlesdk(frameworks), links and library . But instead I choose to get get a fresh start. Hope this helps anyone

Command /bin/sh failed with exit code 1 Xcode 9.1

When i am run project in Xcode then showing some error that means my add pod file is unknown error
and
error screen short
Screen Short Link
and showing error text is
"/Users/Appsfactor/Library/Developer/Xcode/DerivedData/You_Task-hfbipjtwskuqvfgdnnjienomkrbm/Build/Intermediates.noindex/ArchiveIntermediates/You Task/InstallationBuildProductsLocation/Applications//You Task.app/Frameworks/ALCameraViewController.framework: unknown error -1=ffffffffffffffff
Command /bin/sh failed with exit code 1"
Try deleting your Keychain certificates pertaining your current project and rebuild using new certificates from developer.apple.com and try. Worked for me.
Clear Derived Data
Empty your Trash
Clean your Xcode Project and Run again.
Worked for me.
Just update your Pods or re - install the same.
Clear Derived Data
It'll work
Clear Derived Data
restart system
after open Xcode and run, it will work

Apple Mach -O Linker (Id) Error?

I am trying to build this xcode workspace which was built from Unity. And after modifying the project a little bit when I getting to the very end of building the project (linking) I get the Apple Mach -O Linker (Id) Error. I can't open the error tab to see what exactly is causing the error. All it says is "Linker command failed with exit code 1 (use -v to see invocation). There are also two Apple Mach -O Linker (Id) Errors which occur but I have no idea how to solve them.
Any help is greatly appreciated!
I can't expand these tabs.. this is all I get told
This is the warning tab expanded, the two Apple Mach -O Linker (Id) warnings are the same
This problem has different solutions , one of them is to set Enable Bitcode to No . ( I don't know why by default it is Yes )
This problem is a ghost like problem . Clearing Cache , Restarting Xcode , Simulator and MAC ,Ensuring proper linking of Frameworks ,Changing app Architecture or , Sometimes just doing nothing can solve this problem .
This issue was connected to "Link Binary With Libraries". I've renamed the target, and there were two .framework files for the Pods. Thus, after removing the outdated one - the issue was solved.
For me the scenario was that I removed one of the dependency in my pods which was not required, after removing it I was getting error that the same dependency not found. So I went to delete its entry from the Project >> Build Settings >> other Linker Flags and then selected the same and deleted it as shown below in the Image. After removing from the linker Flags I started getting the Apple Mach -O Linker (Id) Error? and after trying everything for a day I realised the issue lies inside the linker Flags. Where on deleting any dependecy you have to delete the other line name -framework. you can check the below image to get the clarity.
So I suggest to keep an eye on it while deleting the dependecy from the linker flags, do delete the associated -framework too which lies below the dependency name. In my case it was ObjectMapper
If you just installed/ uninstalled a pod you might want to look at this. Here's what worked for me:
First make sure you are opening the .xcworkspace file not the .xcodeproj. But this is probable not what's causing the issue.
Delete the pod that was recently just installed.
In the project directory on Xcode, open the frameworks folder and if the pod which was just removed is still listed there as one recentlyremovedpod.framework, delete it from there also. This step is what made my project compile eventually.
Another possible cause is if you rename one of your targets (why did I do that?) and you're using pods. You end up with a version of your old target name in the Frameworks folder in your main project (not the Pods project), like pods_oldtarget_framework which no longer exists.
Just delete the old version (or name your target back to it's original and delete the new one), and you should be good to go.
For me it was missing frameworks. Try searching the errors you get on Google and find out which frameworks they're part of, then import them in the Build phases tab.
I was having the same issue, and resolved by
installing the latest CocoaPods
then do pod setup
For me I had the problem because I was using Xcode 9 (beta), then I open the same project with another Xcode 8.3. To solve the problem for me just Clean then Run again.
If building on mac for ios in unity, make sure that in the build settings you disable "Metal Editor Support" under other settings for the ios platform.
I used xcode 9.3 and I got this same error. But with 9.2 it works.
The error may happen because of incompatibilities between the artifacts produced by the two xcodes. The project that threw the error included a framework built with xcode 9.2
I added libstdc++.tbd to "BuildPhases >> Link Binary With Libraries". It works for me.
How I resolved this issue:
I exit Xcode then opened my project's .xcworkspace again.
While Xcode was starting...i saw warnings...xcode is smarter enough and ask you switch to recommended settings...Tap it and let him do the changes.
(Read warning seriously and with positive mind and then you will resolve it) 😊

Apple Mach-O Linker & Ditto Error - Xcode 8

I have just updated my Xcode to Xcode 8 and am now trying to convert my project's code to Swift 2.3. I was able to build a couple times using Xcode 8 without any errors. Now, the following errors came up:
Error #1: Apple Mach-O Linker Error: Linker command failed with exit code 1
ld: file not found: /Users/Linus/Library/Developer/Xcode/DerivedData/MyApp-asdjeshhsetnfxbegcsbcipdreneewgr/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/DownloadsViewController.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I don't even know what a .o file is. The swift file of DownloadsViewController is there, though.
Error #2: Ditto Error: Command /usr/cin/ditto failed with exit code 1
ditto: can't get real path for source '/Users/Linus/Library/Developer/Xcode/DerivedData/MyApp-asdjeshhsetnfxbbciegrfdpdreneewgr/Build/Intermediates/MyApp.build/Debug-iphonesimulator/MyApp.build/Objects-normal/x86_64/MyApp-Swift.h'
Command /usr/bin/ditto failed with exit code 1
The ditto error occurs 3 times: for MyApp.swiftdoc, MyApp.swiftmodule, and MyApp-Swift.h.
Thanks in advance!
Quit Xcode
Restart the System
Select Xcode -> Preferences.
This will open a pop-up window. Select 'Locations'. In Locations, you will see 'Derived Data'. Click on the arrow icon right next to the path.
This will open a folder containing 'Derived Data', delete it.
Clean the Product and Run
Make sure you open the project from the .xcworkspace file instead of the .xcodeproj
step 1 = clicking on the project in the navigation menu
step 2 = select the project
step 3 = build settings
step 4 = search enable bitcode if bitcode is yes than change to No
None of the previous answer have solve my problem.
I think it come from changes in the cocoapods podFile, from using frameworks to not using them
Frameworks was still remind in Target>General Properties>Linked Frameworks. I removed them
I also remove the -framework and corresponding frameworks from other linker flags (saving inherited and objC flags)
Hope that could help
This happened to me after I delete my app while it was running.
I solved it cleaning the project.
Product > Clean or Shift + Command + K
This is because at some point some project file was not compiled. In my case the AppDelegate.swift was not in the compiler. So I added it manually and it worked.
Clean XCode with following cmds and rebuild:
rm -rf ~/Library/Developer/Xcode/DerivedData/
killall Xcode 2> /dev/null
killall Instruments 2> /dev/null
killall 'iOS Simulator' 2> /dev/null
killall Simulator 2> /dev/null
killall 'Simulator (Watch)' 2> /dev/null
killall ibtoold 2> /dev/null
killall simctl 2> /dev/null
# There may be others
# Kill the service itself
sudo killall -9 com.apple.CoreSimulator.CoreSimulatorService
rm -rf ~/Library/*/CoreSimulator
For my react native app, I deleted a folder of a test project inProject Navigator and Targets. It solved my problem.
Don't wory ,just go to your project targat and then build setting and search enable bitcode change it to YES to NO.
Turning Bitcode to "No" solved this issue. This is found in the Build Settings.
I had the same problem when I changed Xcode from a previous version 7 to the new XCode 8. In the new Xcode (8.3.3 now) there are more settings in the compiler.
When you update the project settings into new Xcode (using Editor->Validate Settings), these new settings are applied and set to the default value YES. After this update I had the linker error!
In my project I compared the previous version of the file .pbxproj with the new one (after Settings validation) using Beyond compare (or similar).
In this way I can saw the new settings added in the new version of Xcode and I set the new Settings value to NO. After this update all was OK and the linker error disappear.
If you're importing a framework through Build Phases, try to put it inside the folder of your project and add it into Link Binary with libraries. Actually, I've already experienced that problem before, I am very frustrated with that error until I knew that I have to put the .framework inside the folder of my project.
Hope will help
On top of cleaning derived data and the project and restarting xcode, I've found that re converting your project to current swift syntax and re installing pods if you have them also helps.
To re convert your project you will need to set swift_version build setting back to yes so that your target appears in the conversion list.
The issue I found with XCode 8.2.1 (Version 8C1002) after I converted the project to Current Swift Syntax (Swift 3). I just needed to rebuild it after cleaning, and the errors disappeared.
If the procedure of cleaning and the disabling of bitcode does not work, then it's possible that the reason for the errors simply is a more complex syntax error in your code.
I got the same problem because I had defined a class (using #interface), but did not provide an implementation (using #implementation) for it. It was a simple class so even an empty implementation resolved it.
Also just check if you are importing a "*.m" implementation file in any of your classes, that can cause the same issue.
Removing the import statement can fix the issue
For me it was a problem with react native haptic. I think it was because of a change in CocoaPods but also because of changing up file locations. I just removed it and re installed it. Hope this helps someone.
UPDATE
The build succeeded by when running it it would just crash. To solve this I used File > Add Files to Project for the GoogleService-Info.plist and it worked.
Please make sure you have following changes in Workspace setting in your xcode:
Please go to your workspace setting and make the following changes:
Workspace Setting:
Build System:
Legacy Build System
Per -User Workspace
DerivedData:
Workspace relative location
Build System
Use User Setting
Hope it helps:
Follow the below steps:
step1: Go to Build Phase Tab then only expand Link Binary with Library
step2: Then Go to General Tab then Expand Linked Framework & Library
(because Yourprojectname.framework is disable)

Resources