Issue with running application on iOS9 XCode 7 - xcode

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...

Related

XCode - creating archive fails with error «…-Prefix.pch» not found

I have a workspace with multiple targets.
Each target has its own prefix.pch file.
Prefix-Header is entered in Build Settings and Precompile Prefix Header is set to YES.
The app compiles and runs fine when I run it on my device.
There are no errors when I just build the app.
But when I try to archive it, I get a compile error saying:
No such file or directory: '/Users/me/Library/Developer/Xcode/DerivedData/myApp-dcmvkatguqcxgjfyrqcunbsfuxcd/Build/Intermediates.noindex/ArchiveIntermediates/myAppTarget/PrecompiledHeaders/SharedPrecompiledHeaders/13524936819627194222/myAppTarget-Prefix.pch'
And indeed, when I open this folder on my hd, I can't see the pch-file. There are, however, similar files there:
myAppTarget-Prefix.pch.d
myAppTarget-Prefix.pch.dia
myAppTarget-Prefix.pch.gch
I tried everything I found on SO and elsewhere, but nothing helped.
I have Cocoapods installed and use them in this project, but I don't think that error is related to that (they seem to compile fine).
XCode 12.4
Seems like I figured it out.
The culprit was a totally unrelated build-setting.
In Other C Flags my settings differed in debug and release.
I had $(inherited) in both of them, but in the release setting I additionally had -isystem - which apparently is already included in $(inherited). That caused a multitude of errors that ended with the prefix.pch not being copied...

Archive fails with error archive Unable to read GoogleService-Info.plist at path Xcode 10.1

It's the first time I go through the process of archiving my app and myy problem is that when I build the projects it builds fine, it runs fine both on simulator than physical iPad, but when I do choose Archive it fails with the error message Command PhaseScriptExecution failed with a nonzero exit code 31merror: Unable to read GoogleService-Info.plist at path.
Following other posts here on SO, I made sure that in Build Phases/Copy Bundle Resources GoogleService-Info.plistis present. I also checked that GoogleService-Info.plist Target Membership is correctly selected.
I tried to delete, throw it into trash and re-add it to the project by drag and drop. I restarted Xcode but nothing solved it.
Any ideas on what else I should have a look at?
Could it be related to my developer's certificate?
As always many thanks.
UPDATE:
I tried uninstalling the pods and reinstalling them but with no changes.
I downloaded again the GoogleService-Info.plistfrom Firebase but also that didn't make a difference.
Update 2:
I deleted the firebase app and recreated one.
Re-downloaded the GoogleService-Info.plistand it's working ok..both on iPad and simulator.
but still archive fails not been able to read the GoogleService-Info.plist..
I'm actually deploying for iOS 9.3 and up..can it have something to do with it?
After a few days of comparing this app with the other one, part of the same bundle, that Archives without a problem, I finally found the problem: A second Fabric script ..that should be used for Answers which was giving me problems and I just put aside using for the moment. I forgot to delete the script for it.
Now that I think about the script could be well be the reason for Answersnot to be working ..time to investigate it ..
Well.. hopefully this will be of help to others..
The incriminated script:
"${PODS_ROOT}/Fabric/upload-symbols" -gsp "${PROJECT_DIR}/GoogleService-Info.plist" -p ios "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}"
In my case, the very same error message "Unable to read GoogleService-Info.plist at path [...]" was happening during a simple build, and in my case, that was because my build path had a space in its name like "username/path/to/build/Blabla v0.0/GoogleService-Info.plist".
The executed command in Fabric didn't liked it and was unable to find the file GoogleService-Info.plist.

How to use Xcode to compile ("Command /usr/bin/make failed with exit code 2")?

I used to use the Terminal to compile C-programs written in Xcode so far(it is so much easier..). Now i would like to use the debugger as well.
I found this manual http://classes.engr.oregonstate.edu/eecs/winter2017/cs261-001/Resources/XcodeTutorial.pdf and am trying to act exactly how it suggests.
However, every time i tried to press the 'build' button i got this error:
Command /usr/bin/make failed with exit code 2
The only posts i find regarding this are
Using CocoaPods stops iOS build using ionic Project (as it concerns cocoapods i guess that plugin is not helpful.)
These guys had a similar problem..
/usr/bin/make failed with exit code 2 but i do not get the solution in the last post.
If you know what the error wants to tell..please translate it for me.
I realise that this is no programming but rather an i_am_lost_with_Xcode question. Please help though by sending a link to another manual or giving me a hint how to just compile with Xcode.
Well..it worked out. I created a new project and chose as a template OS X>Application>Command Line Tool. I am not sure how but it builds fine now.

Run react native app on Xcode 10

I get this error when i want to run my react native app hello world app on Xcode 10 (new beta version), can you help me?
The error :
error: Build input file cannot be found:
'/Users/nic/Documents/X-Project/xapp/node_modules/react-native/Libraries/WebSocket/libfishhook.a'
Screen shot from my Xcode
This helped me:
Remove and add again libfishhook.a from Xcode and the path issue will resolve.
This issue is caught by the stricter xcode 10 new build system.
A temporary fix while react-native really fix the issue is to switch back to using the old build system
In Xcode, Select File -> Project/Workspace Setting. You will see a Build System option to select the Legacy Build System as shown below
Clear your project and "Derived Data" Build and Run your project
BONUS Point: If you are using a CI/CD pipeline you can also add the xcodebuild argument -UseNewBuildSystem='NO' to the cli or via fastlane xcargs: "-UseNewBuildSystem='NO'"
Manually copypasting libfishhook.a into the correct folder, as suggested here, worked for me:
For a solution, I copied the file from my ios/build/Build/Products/Debug-iphonesimulator/libfishhook.a and pasted it into ../node_modules/react-native/Libraries/WebSocket/ and got the build. I hope it helps.
...
Daniel's answer helped me to solve problem. Just note that if it's tvOS, then the same action of removing and adding should be done of RCTWebSocket-tvOS.a

XCode 8 - Build works but archive fails - React Native

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!

Resources