Clone repo from github to xcode issues
Asked Answered
F

4

7

I have tried following a few tutorials on cloning a github repo and opening it up on xcode. I first connected my github account to xcode and then I selected a project to clone. I then placed it into my folder where all my projects are stored. Then I went to xcode to open an existing project but when I try to select the project I cloned I get this message:

Could not open file. (/Users/username/Documents/Dev/Linked-Lists)

I am not sure what the issue is. Here is the url I am trying to clone: https://github.com/wwolfgang11/Linked-Lists

From what I found online, once I clone an existing repository and save it either my desktop or some folder, then Xcode should automatically open up the project. In my case that does not happen and I have no idea why.

Flavoprotein answered 17/1, 2019 at 19:25 Comment(0)
W
3

SmileyCreations identified the problem (the repo doesn't have an Xcode project), so here's how to solve it:

1) Create a new "macOS" project and set it to be a command line tool: 1 create new project 2) Choose the C++ language. 2 choose the C++ language 3) Drag in the .cpp and .h files from the repo: 3 drag in source files

Waxplant answered 21/1, 2019 at 22:6 Comment(1)
also, on line 194 of DoubleLinkedList.h you'll need to add "noexcept" (as in "DoubleLinkedList<T>::~DoubleLinkedList() noexcept") and I changed the template code on line 207 of that file from SingleLinkedList to DoubleLinkedList.Waxplant
P
3

This is because the folder is not an Xcode project. Xcode project files are folders(bundles) and Xcode will think that the folder is a project and fail to open it. And the repository doesn't contain any .xcodeproj files.

Pudendas answered 21/1, 2019 at 19:47 Comment(2)
I see, do you know how I could fix this. I go back and forth from different machines to work on projects.Flavoprotein
First upload the project folder to GitHub (include the .xcodeproj file). Now you can commit as usual. And do not forget to commit when you add a file or change something in the project. You can use git pull to pull changes. Also push and pull when you switch machines.Pudendas
W
3

SmileyCreations identified the problem (the repo doesn't have an Xcode project), so here's how to solve it:

1) Create a new "macOS" project and set it to be a command line tool: 1 create new project 2) Choose the C++ language. 2 choose the C++ language 3) Drag in the .cpp and .h files from the repo: 3 drag in source files

Waxplant answered 21/1, 2019 at 22:6 Comment(1)
also, on line 194 of DoubleLinkedList.h you'll need to add "noexcept" (as in "DoubleLinkedList<T>::~DoubleLinkedList() noexcept") and I changed the template code on line 207 of that file from SingleLinkedList to DoubleLinkedList.Waxplant
P
1

As you asked how you can do it here is how you can do it.
Run git commit and git push when you do the following things:
1. Change machines
2. Edit the project
3. Add, edit or delete files.
Run git pull when you do the following things:
1. When you start to work on a another machine.

Pudendas answered 21/1, 2019 at 20:40 Comment(6)
What do you mean change machines?Flavoprotein
okay could you provide an example like you did here for when I want to open a github project given a url on xcode and what to do from there?Flavoprotein
First you should have an .xcodeproj file as the project file. It should me located in a folder that is the name of your project. Now add the folder that the .xcodeproj file is in to the repository. Here is an example repository. github.com/smileycreations15/Example-repository-1. If you need help ask in the comments.Pudendas
Do I just create a new one. My apologies that I am not understanding but I have a number of Github projects that have been created on a Windows machine using microsoft visual c++. So some of them will not have a .xcodeprojFlavoprotein
No, you don't need to create a new one. If you can, create a folder containing all the projects (any project file). Then upload it into a repository that you want. You can use the instructions that is in this answer after you uploaded every project.Pudendas
Let us continue this discussion in chat.Pudendas
M
0

you have to open ios folder which is inside you application then it will work.

example:- suppose you project name is myApp

then open xcode > file > open > myApp > ios

Marcelina answered 13/1, 2023 at 8:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.