Duplicate of files shown in Project Navigator in Xcode [duplicate] - xcode9.4

This question already has an answer here:
Duplicate target after "pod install"
(1 answer)
Closed 4 years ago.
All files for my workspace appear twice in the Project Navigator (Xcode 9.4.1) but if I delete one from the project (only deleting the reference), both disappear and if I add a file it gets added twice.
I have not found a question with the same issue. I may have to create a complete new workspace but I would like to avoid that.

This post is similar: Duplicate target after "pod install"
In Finder, if you Show package contents of your .xcworkspace file and then view contents.xcworkspacedata, you'll see a duplicate in that file.
To fix, delete your .xcworkspace, podfile.lock and pods folder and do "pod install" again...

Related

Copied Xcode Project won't build

OS X Version 10.10.5
Xcode version 7.2.1
Very simple steps, yet Xcode can't fathom what to do when you duplicate a folder that contains an Xcode project.
Start with Xcode CLOSED.
Start with an Xcode project that builds and runs perfectly.
Go to Finder window and right click on the directory that contains the buildable Xcode project and hit "Duplicate"
New directory is created, called "SomeProject copy"
Go into this new directory and double-click on the SomeProject.xcodeproj file to open it in Xcode.
Bam... enjoy your build errors.
In my case, it's complaining about an enum.
Tried deleting derived data folder (did so directly using finder)
Tried super-cleaning the build folder by holding down the option key.
Tried removing and re-adding complained about file that contains errors.
Tried changing path to file in Xcode File Inspector from "Relative To Group" to "Absolute Path"
I should also point out that either Finder -> Duplicate doesn't actually do what it says it does. Neither does Finder -> Copy, ~OR~ Xcode for some reason has now adopted not only the original source location as where to get its build files, but also the new location, hence the "Redefinition" error. I noticed that if I open the "copied" project and edit a file, then go back to my original project in an entirely different folder, the file is changed THERE.
And my paths (according to Xcode File Inspector), are RELATIVE TO THE PROJECT IN QUESTION. So in other words, ProjectAAA's files are pointed to the path under ProjectAAA's directory, and the same with copied project, ProjectBBB's files.
So somehow, the copy/duplicate is refusing to actually copy/duplicate.
Any ideas how to solve this?
Per John Elemans comment, moving my original project then revealed in the copied Xcode project a number of build paths and issues that needed resolving. I fixed those, and it worked as expected.
I solved this issue as follows:
After duplicating the root folder of the project, open the podfile of the duplicated project:
Podfile
then comment all the previously added pods by adding "#":
Commented Pods
hit CTRL + S in order to save the changes
Open the terminal and change the directory to the folder of the duplicated project and then perform: "pod install". Yes it will delete all the pods but don't worry we will install again in the next step
Pods deletion
Open again podfile and uncomment the previously commented pods:
Uncommented pods
hit CTRL + S to save the changes
Open the terminal and change the directory to the folder of the duplicated project and then perform "pod install". it will install again all the pods:
Pods installation
Finally, run the Project and it should run without any problem.

XCode 6.0.1 error when creating project: The file "exclude" doesn't exist

When I create a new project in XCode 6.0.1, I got this error message: The file "exclude" doesn't exist
It seems to only impact the versioning of the files i.e. the generated stub files are not committed into github after the project is created.
What can cause this problem?
For me the issue was caused because I had previously created a project with the same name, and Xcode still had record of that.
To clear it out,
go to Window -> Organizer in the menu bar
Remove all of the repositories highlighted in red
To add your repository (if it's not being tracked for some reason),
Click the + (still in Window -> Organizer from the steps above)
Enter the path of your file
Make sure to change to Git from Subversion (if Xcode has Subversion set as default - it did for me.
I usually get this error if I initialize an Xcode project with a git repository, delete it and try to recreate it with the same name (casing doens't appear to make it sufficiently 'different'). Turns out, "Well I'll just start over" can leave some issues as well.
Hope this helps.
I had this issue as well, and I tracked it down to the .git-template folder included with Thoughtbot's dotfiles. Basically, Xcode expects its template folder to have info/exclude, and Thoughtbot's dotfiles don't. Creating that directory and file fixed the problem, as so (in the Terminal):
cd ~/.git_template
mkdir info
cd info
touch exclude
If you're getting this issue without Thoughtbot's dotfiles, you could probably look at ~/.gitconfig and use whatever templatedir is getting set as instead of ~/.git_template in the first command.

How to rename project in RubyMine

I'm running Rubymine 5.4.x on Windows 7 (but that shouldn't really matter for this question) and I have managed to delete projects and seemingly rename them before, but I am stuck this time.
In the past, this is what I've done:
rename all instances of your old project name in all the files in the .idea folder in your project directory.
rename all instances of your old project name in all the files in the RubyMine config folder and subfolders (on windows, for RM 5.x - %USERPROFILE%\.RubyMine50\config)
rename all instances of your old project name in all the files in the RubyMine system folder and subfolders (on windows, for RM 5.x - %USERPROFILE%\.RubyMine50\config)
rename all FILES that contain your old project name to the new project name, a few examples - rename:
your actual project directory which would probably have the same name as the project to the new project name
the .idea/<your_project_name>.iml file
In Summary:
By deleting or modifying these files/folders I have managed to delete or rename the projects that appear in my "project list" in that startup screen/Create Project/Open Project Modal for RubyMine, and in the ReOpen Projects menu.
However, this time around I can't get the name of this particular project rename... that is it appears with the correct path in these lists, but the incorrect name.
Furthermore, the incorrect name appears in my Project ToolWindow once the IDE is launch, although directly to the right of it in parenthesis is the correct path.
Any thoughts? tia
To rename a project edit .idea/.name file manually.
There is a feature request to add Rename Project action to a File menu, please vote.
Updated answer done on RubyMine 6.3.3 when I wanted to rename the project directory:
Close RubyMine
Rename project directory to desired name
Delete the .idea folder
Reopen renamed project directory in RubyMine
I found this to be easier than combining the steps listed on the question and the accepted answer
OK... I just figured it out... IN ADDITION to everything above... you need to rename the .name file (it's just one line with the name of your project) in the .idea directory in the root directory of your project
In addition to modifying the .idea/.name file, there is also a .idea/<project name>.iml file. Open this, do a find/replace with <project name> and <new project name>, then rename this file as well.
Quit RubyMine, and reopen it. This will update everything. In your source control you'll notice a lot of other files which automatically got updated as well.
The .name does no longer exist in my version of RubyMine (2019.3)
The File|Rename project.. will automatically pick up the folder name change (if you changed it outside of RubyMine when it was closed)
Additionally, I had to rename the <project name>.mlt file in the .idea folder and change the references to it in idea/modules.xml (search and replace old project name to new project name)
<module fileurl="file://$PROJECT_DIR$/.idea/<PROJECT NAME>.iml" filepath="$PROJECT_DIR$/.idea/<PROJECT NAME>.iml" />

XCode Project files red after renaming project

I have recently renamed my XCode project. In doing so, all my project files became red. Stupidly, I have re imported the project files and deleted the red files. Now, my XCode project will not run. Within 'products' the Appacus.app is still red and cannot be deleted.
How do I go about fixing a problem like this?
Appreciate any help,
Matt
Sure you are using versioning, right? Just go back in your git history.
git checkout <previous commit>
and try again.
You can use "git log" to check the previous version number. Follow by "git checkout " to revert back to last commit.
I am using this script to rename my iOS project. https://github.com/ytbryan/rename
After you rename it, remember to update your Xcode scheme too.

Xcode looking in wrong folder

Xcode 4.2 is looking in my tags folder when I build. This is causing duplicate interface errors, since it believe I have defined classes twice. My folder structure is:
tags
trunk
My current build is in trunk and Xcode is also looking in tags. How can I make it stop doing that?
After editing the pbxproj file, I found references into the other folder. I then removed those files via Xcode and added them back from the correct location. Problem solved.