xcodebuild: error: 'project.pbxproj' is not a project file - xcode8

I am new to Xcode so I am probably doing something wrong (or missing something in this case). I would appreciate any help.
I've just created a new project on Xcode. New Project -> macOS -> Command Prompt. I've saved it somewhere and as soon as Xcode returns with its main screen on my project's properties, I've closed it. Then cd'd to the folder where my .xcodeproject was (on terminal) and ran xcodebuild install and it returns me that message. Additionally, I tried editing my project Schema from debug to release and closed Xcode again (to make sure everything was saved), same error.
If I build the project from Xcode's UI it works, obviously, it will print Hello World, but I can't run the builder from command line. Does anyone have any tips? Thank you!
This is on Xcode 8.3.3.

I ran into this issue and my fix was due to an overlooked flag in my .gitlab-ci.yml file.
Pretty easy fix :)
So the error says:
xcodebuild: error: '<some file>' is not a project file.
The reason for that was because in my .gitlab-ci.yml file it said -project instead of -workspace
Super easy to overlook. So if you have the: is not a project file error, make sure your flag says -workspace and not -project.
Alternatively if you have the opposite error xcodebuild: error: '<some file>' is not a workspace file then you'll want to change your -workspace flag to -project

My bad... the xcodebuild install command works from one directory up, outside the .xcodeproj folder.

Related

Cannot configure QtCreator using CMake on Ubuntu 18.04

I am trying to setup a project based on CMake with QtCreator.
In Projects I defined the Build Steps I need.
In the Build setting I get constantly the error message:
Failed to activate protocol version: "CMAKE_GENERATOR" is set but incompatible with configured generator value
I tried to browse on the Internet for this problem but I could not get rid of this error.
If now I however try to build my project specifying a target, my compile steps are not executed, instead, I get the following message:
Running "/usr/local/bin/cmake -E server --pipe=/tmp/cmake-W2VOXm/socket --experimental" in xxxx/.Build/release.
CMake Project parsing failed.
Parsing of CMake project failed: Connection to CMake server lost.
Restarting QtCreator does not help, each time the project is opened the message happens again.
Make sure the build directory it's in the same directory than your projects is, like this:
I got a similar error and have fixed it.
Try to reinstall cmake in Ubuntu by follwing https://cgold.readthedocs.io/en/latest/first-step/installation.html#ubuntu.
Configurate Tools - Options - build & run regarding "cmake" and "kits". Make sure that one of the configurations (auto-detected or maunal) is corrected.
restart qt creator, open project and "run cmake" again.
I have seen and resolved this issue previously by just deleting the build folder, reloading qtcreator and rerunning cmake.

Apple Mach-O Linker Error IOS

When i tried to build and run my project im getting this error.I tried may steps like clean and run, check with workspace.project but still im getting the error.No further details were in the error message. "Linker command failed with exit code 1(use -v to see invocation)
There can be many reasons for this problem, sadly with such little knowledge of your project I can only suggest some fixes
Check for any caution messages and try to fix them
This can also be caused by using #import to import an .m file, if you are using this then remove it.
Sometimes this can be caused by frameworks and libraries, If you are using an external or custom framework, you probably need to add it to the "Frameworks" folder inside the application.
Hope this helped but if it didn't I might need some more info on your project.
Go to Project file -> Build Phases and check if there ara any red icons (specially for Compile Sources or Copy Bundle Resources)

Linker command failed with exit code 1 - duplicate symbol __TMRbBp

Since I've updated to Xcode 8.1 I can't archive and also not run in Release mode (in debug mode its working). The error is that there are several "duplicate symbols for architecture arm64" and all are "duplicate symbol __TMRbBp". Whats that?
It seems to be a bug in Swift. See
discussion on Apple developers portal
It is said to be fixed in Xcode version that is about to be released.
But for now there is temporary workaround:
Go to your target Build Settings and set Reflection Metadata Level flag to None
Don't double click Project.xcodeproj to start your xcode project. Instead, close your project and open the xcworkspace.
File -> Close Workspace
File -> Open -> Search your project folder for Project.xcworkspace
All my errors are gone.
I faced the same problem with archiving on Xcode 8.1.
X Code Version: Version 8.2.1 (8C1002)
The following fix worked on Mar 2019
1) Go to Project & Select your Project
2) Select Build Settings -
Search for "Enable Bitcode" Set option as "NO"
3) Most of version will fix this issue, for few other XCode version try this option also,
Search for "Reflection Metadata Level" Set option as "NONE"
I had similar issues with Version 9.2 (9C40b), the solution is
0) Close Xcode
1) Open project folder in terminal
2) pod update
3) open .
4) open project by clicking Project.xcworkspace
Surprisingly, in some occasions, simply cleaning the product worked for me.
Product/Clean (Shift+Cmd+K)
Product/Clean Build Folder (Alt+Shift+Cmd+K)
Quick fix to try before looking at other solutions.
1.Close your project:Completely quit Xcode.
2.Go to your project location:there you will find two files in you root folder with varying extensions:
Appname.xcodeproj and Appname.xcworkspace
Now open your project by Double clicking on file with the extensions xcworkspace.(***Appname.xcworkspace*)**
Yourproject will open in xcode.
Now run your project again.
If you pay close attention when installing your pods,firebase makes it clear to open your project with your-project.xcworkspace after installing pods
firebaseIOS Setup
$ cd your-project directory
$ pod init
Add to Podfile
pod 'Firebase/Core'
And finally:
$ pod install
$ open your-project.xcworkspace
Dont forget to add firebase to your AppDelegate
If you're using Ionic and the Push and Console plugins that's the problem. Remove the cordova console plugin (which is deprecated) and the error will disappear.
The linker error is saying that a library is duplicated which is, in fact, true because the console plugin is already in cordova-ios 4.5+
It took me a couple of hours to figure this out!
In my case
Select your project (In my case i have 2 targets)
Go to Build Phases
Compile Sources
Check if the number of items on each targets is the same (mine was different)
Add the missing file / Remove the duplicated file
Problem Solved
I ran into this problem recently creating a new project and adding some pods (AlamoFire specifically) to the project. Troubled with it a couple hours or so recreating the project (it was new) several times. Tried all the methods here and no luck.
Eventually I figured out that it was because XCode V10.1 was also opening the old project file along with the new pod-created workspace when I opened the workspace via command line "open myProject.xcworkspace" when I reopened the project after doing "pod install"
Closing all projects before exiting XCode before I did my "pod install" fixed everything for me.
close you project then open xcode go to file -> open search your project and open it . this worked for me
I got this error due to deletion of some files. For me simply cloning my project worked.
For those that can't get the Thorax's answer to work, what I did was I closed out Xcode, ran pod update on my command line and then reopened the .xcworkspace file. After doing that, I was able to build and run the project.
I am using the Firebase Cocoapod and Xcode version 9.1.
I had removed files from Compile Sources in Build Phases in Targets. I added main.m and it worked.
Had the same problem in Xcode 10.1 and was able to resolve it. In path Project Target > Build Setting > No Common Blocks, I changed it to No.
I had similar kind of problem when I added a framework to my project.
I have resolved the issue by removing the framework and again adding the framework to the project by dragging and dropping the framework file to the projects frameworks folder and selecting the Copy items if needed option.

Xcode custom shell scripts are slowing down the compiling time

Testing any changes to my Xcode project has become an exercise in patience whenever I build. After all the source files have compiled, I get the following message in the activity window at the top of Xcode:
"Running 3 of 3 Custom Shell Scripts"
I have not added any of my own custom shell scripts but I am using quite a few dependencies via Cocoapods and I am using 2 frameworks for the build environment, Crashlytics and Tapstream. Crashlytics requires you add a run script in the build phases, other than that I don't know where the other ones are coming from and they appear to be the bottleneck in my build time.
Can anyone enlighten me as to what is going on and how i possibly speed it up?
I can't enlighten you but I can tell you how I stopped mine from running. This also happened after installing Cocoapods. In my main project's Target, under Build Phases, I noticed two entries entitled Check Pods Manifest.lock and another called Copy Pods Resources.
Under both there was an unchecked option Run script only when installing. I checked both and at least for now my projects build and run fine without running the scripts.
This is kind of a crappy answer because I can't really give you any more information, and it might not even work for your case, so hopefully someone comes along and enlightens us.
POSSIBLE EXTERNAL BUNDLE ISSUES
So I just had a frustrating experience debugging an issue where a pod installed library's NSLocalized strings file weren't working. Turns out it was because I checked the option mentioned above. Pods-resources.sh, which had the lines to install the bundle, wasn't running in debug mode. It was only running when installing - of course! Something to watch out for.
More info in this question:
NSLocalizedStringFromTable not working in CocoaPod dependency
To fix the slow "Copy pods resources" problem I figured out a solution to only copy the resources if they haven't been copied before.
For this purpose we have to patch the *-resources.sh files that are created by cocoapods such that the copy procedure only happens if a generated file in the target directory doesn't exist (it is created upon first copy). As long as this target directory exists and includes this autogenerated file, the copy resources phase is skipped. This saves me about 30 seconds in my project (of course depends on your project size). To accomplish this do the following:
Create a patch file called 'copy_pod_resources_once.patch' in your project root dir with the following contents:
5a6,13
> NONCE_FILE="${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/copyresources-done.nonce"
> if [ -f "$NONCE_FILE" ]; then
> echo "already copied resources"
> exit 0
> else
> touch "$NONCE_FILE"
> fi
>
In the Podfile for your project add the following post install hook:
post_install do |installer_representation|
system('find "./Pods/Target Support Files" -name "*-resources.sh" | xargs -I{} patch -p0 {} -i ./copy_pod_resources_once.patch')
<other post install stuff>
end
For me, it was Crashlytics. There were some outstanding changes, as Crashlytics does auto-updating of its files. I reset/removed them and rebuilt and got past it.
So the general answer may be to check any third party components and make sure they're working properly.
As Ramsel has said in this answer,
https://stackoverflow.com/a/21318086/1752988
I also went to Build Phases and cleared out all the possible links to PODs, after trying most of the other solutions and the three build issues shown regarding Pods were cleared out.
But then one file which was not list under the XCode Project navigator was missing, but they were in the Downloaded Git Zip folder! Obviously, I copied it and put into the XCode project and try running it runs cleanly! :)
I had a similar issue in my project (however not using Cocoapods). It ended up being an issue with an application external to Xcode (Spritebuilder) somehow holding onto a resource within my Xcode project when it crashed. I forced the non-xcode application to close and now the issue is gone
Check your project folder name have any space.Because space creates problem in directory path like "SRCROOT".I removed spaces and project run fine.
I've found that this happens to me frequently. Exact cause unknown, but appears to be switching between git branches that have differences in what pods are being used. In my case simply touching the Pods-xxx-Resources.sh shell script file causes it to speed back up.
Probably not going to work for you, but cleaning the project fixed it for me (Product -> Clean)

xcode warning - directory following -L not found

I'm getting the following warning when I try to build my project:
Directory '(directory name)' following -L not found
The directory name refers to an SDK that I had added to my Resources folder, but have since removed. The problem is that I have no idea how to remove the reference to the directory that is causing the warning. I can't find any reference to it anywhere in my build settings.
Can anyone help me? I am using Xcode 3.2.5.
Thank you.