I recently got a new hard drive and reinstalled Mac OS X on it. I copied my entire folder with all my Xcode projects over. However when I tried booting up one by clicking the project file, Xcode opens up with only the project file present. All of the files with actual code on them are not appearing.
I tried to add files but even that would leave most of the files with code on them greyed out in the finder.
Question, what is the proper way of transferring these projects specifically in Xcode 7? I have not been able to find anything concrete.
So, the only way I know of to do this efficiently is to load up the project file XML in your favorite editor and go manually fixup the paths. I don't recommend this.
Unfortunately, the way to do it through the UI is for each file, you need to open the Utilities Bar on the right, select the file, then update the path via the little folder icon in the Identity and Type section. Here's an illustration:
Then repeat for every file in your project. Sorry.
i had this same issue i mean you could always manually transfer code through word documents or notes, but for me i had copied the entire project folder and the document transferred just fine just make sure you transfer all of the files with it and not just the one file for the project itself
delete the xcode application and reinstall it from the Mac App Store.
Related
I have facing this issue when I was changing project name and copying my project from one mac to another. There are some red texts indicate the missing files from the project source codes(But I have all files in Project folder) I have used cocoapods in this project. How to avoid these?
Here I have shown my project screen shot.
As per your description... you must be having some issue in your project.pbxproj file. Please check that file. Common issue happens in that file when you try to merge different branches having conflicts in project structure.
There could be different reasons of this:
It may happen because the xcode is open and the source folder is not available.
It may happen when source path is not found in your system and xcode shows that.
For resolving this, quiet xcode and reopen your source from .xcodeproj again, will resolve the problem.
Click on the file, then on the far top right of Xcode look under Identity and Type Check and see if the path to the file is correct. In my case is was not so I had to click on the small folder icon (not the arrow icon) and select the folder in finder.
Okay, here's a little bit of context:
I have just added a Mac OS Core Data Command Line Tool target to my iOS project. It's purpose is to simply use my iOS app's Core Data model and a JSON file (which I am adding default data to as I go) to create an SQLite database which I am going to use as the default database for my iOS app. The idea is to have this command line tool ready in my project so that when I add some default data to my JSON file, I just:
Run the command line tool
Go to products in the file navigator on the left
Control click the command line tool product and hit show in finder
Drag the .sqlite database that has been displayed along with all the other bundled files for my command line tool and drop it into my iOS app's resources
But, I can't do this because the command line tool product is showing red in the navigator window because Xcode is looking for it at this path:
/Users/kylejm/Library/Developer/Xcode/DerivedData/MyiOSApp-ggjlxrqiijmbqkgkucdargamkwld/Build/Products/Debug-iphoneos/
Where as the it is actually in:
/Users/kylejm/Library/Developer/Xcode/DerivedData/MyiOSApp-ggjlxrqiijmbqkgkucdargamkwld/Build/Products/Debug/
I have been inspecting the Build Locations in the Build Settings but all the resolved paths are correct for both my iOS app and the command line tool respectively.
What do I need to do to make Xcode look in the right place?
Thanks so much for any help in advance.
I just clarified my scenario/problem for the answer by bauerMusic like so:
Thanks for your answer but I don't think you quite understand my scenario or problem. The Command Line Tool (CLT) target is a part of my project, and therefore has a executable product in the product folder (shown in red until first build and run). When I run this command line tool, it's product in the products folder remains red because Xcode is looking for the product in the wrong place for it.
I've put it in the description so you all understand my question as clearly as possible.
You usually never add files to a project outside of Xcode, (meaning, simply place it in the folder) unless you want to have these sort of issues.
Try to remove it, restart the project (build and see that it has no broken links warnings), and drag the file to the navigator's folder in your open Xcode project.
Edit: Just to be clear, add through Xcode, not the Finder. Xcode should prompt you to either copy resource or not (check box).
I was going to suggest you Clean the project, but I then noticed how you actually added the file.
I'm now developing my first iOS app, and I found that two of my classes (hence, four files) are located outside of my MyApp/.
So in my filesystem, here's the current situation:
My App
- ClassA.h
- ClassA.m
- ClassB.h
- ClassB.m
MyApp/
MyApp.xcodeproj/
MyAppTests/
Other than the two classes, all of my class files are located in MyApp subdirectory. The other resources, such as Core Data model file or images are saved in the same directory.
However, why are the two classes, and only the two classes, located in the outside of MyApp subdirectory? When I move those files to the supposedly correct location, those files are no more "valid" in Xcode with the color of the file name is converted to red.
So here's my question:
Why are those two files located there?
Do they have any issues if they remain to be located there?
Should I fix this issue and save it correctly? I think I haven't had any issues so far with the Simulator and the actual iPhone...
I use iOS 7 and Xcode 5.
•Why are those two files located there?
A: When you have created these files or imported from external directory, you may have not taken care of the group/folder these files are getting created/imported into. Hence they are inside the main app folder in the file system.
•Do they have any issues if they remain to be located there?
A: No, this is certainly not an issue in the correct functioning of your app, but it is always good to manage your files under groups/folders for better file structure and it is easier to find files when they become large in number.
•Should I fix this issue and save it correctly? I think I haven't had any issues so far with the Simulator and the actual iPhone...
A : This depends on you. If you like to keep your files in folders and like everythin arranged in some pattern, then yes you can divide the app into different folders. When you move the files in a folder, the reference of those in XCODE should change as well, and thats why you see those files in red in XCode. No worries. Just delete the files and add them again. Make sure you uncheck the option "Copy files under detsination group's folder".
Now, you may seem the option of creating New Groups inside XCode. But it is good to be aware that these groups do not create separate folders inside file system. These are just for Xcode refernce. So, a neat way is to create folders outside of XCode, and then import these folders(can be empty) in Xcode. Now when you add any file in these imported folders, even from XCode, it will go inside the correct folder in file system.
I am sorry I am not on my MAC right now, so cannot paste actual images, showing how to do it. Feel free to comment, if I have instead of solving the issue, have rather confused you more:D
You can put your source files wherever you want, as long as Xcode knows where to find them. You can leave them here, or organize it in another way, as you seem to be willing to do.
So, if you want to move these files in your Myapp/ subfolder, just move them there, and when Xcode complains it can't find them, highlight all those files in red in the navigator, and in the "File inspector" pane (right hand side of the window), click on the little Folder icon to browse to the new location. If you selected all files you don't need to do that 4 times, Xcode will find it out by itself.
I am trying to add the shareKit files like in the photo:
...but Xcode will only let me do the drag and drop only for single files! How can I solve this?
What you need to do is simple:
1) Right click the sharekit folder in the first project and you will see show in finder. Click that.
2) That will lead to the folder in your directory.
3) Next pull the whole directory into second project. Make sure you copy the files over.
Hope this helps...
In Xcode 4 it is different than older Xcode you have in the screenshot. To copy between projects, you have to open them in the same workspace (the same window). So
open the first project
drag the second one from finder to the same Xcode workspace
now drag the files you need
remove the second project from your workspace.
Lakesh's approach might have a risk in fact, that sometimes file structure you see in xcode might differ from what is actually on filesystem.
You might want to try ShareKit 2.0, it is already packaged as a static lib and has updated sharers to match newest api's. If you decide to use it, make sure to follow install wiki guide literally.
I have created a rather large application in xcode and wish to move the files somewhere else on my computer.
Could this process be as simple as dragging the project folder to a different place in finder or will something mess up?
Moving the .xcodeproj files will not cause any issues as long as xcode is closed when you migrate the files and you delete the old files.
When xcode is next launched, if you browse and open the proj file from the new directory, all the references will be set to the correct destinations
on a side note it always pays to keep the old files in a .old folder when migrating projects to avoid issues.
As long as the files are kept in their respective folders, next time you run a build in xcode, the references to the new directory the proj file is in will be updated.
As another side note, i just tried to do this and it messed up for me. Typically, any references will switch over, but i had a linker error: ld. it was trying to link to an external library that was contained within the old folder. i had to go to build settings->search paths->library search paths and change that to the new folder location. that worked for me.