deleted xcode file not opening - ios

I accidentally deleted my xCode project and when I tried to open it back up I was getting this weird message. I am new to xCode and should have used version control first thing. I think it might have something to do with a .app instead of .xcodeproj file type but why would in turn into this in the first place?
https://i.stack.imgur.com/FzxwNm.png
I would have used these images but my reputation is not high enough.

Related

Xcode files in Red - but file still there

I've been working on an Xcode project on my desktop, and I was trying to save it to GitHub, so I could access it on the road. I've saved it to GitHub before, without issues, and the local Desktop version was working fine. After saving it to GitHub, I tried downloading it on the laptop, to make sure everything was fine, and one file was in red. It doesn't look like it was saved or even exists. I get a "Build Input File can't be found" error.
I went back to the Desktop version - that file is there and everything works. I thought, maybe I messed up with GitHub, so I tried to save it to iCloud, and then emailed myself a zip copy - same thing. Every other version, but the desktop version, had that one missing file in red.
I've looked at other posts for those with similar problems, and all the answers seem to say the same thing - the file was moved or deleted; however, it is still there on my original desktop working version. Any thoughts as to what is going on or what I should do are welcome.
I'm working on XCode 13.1, on a Mac running iOS 12.1
Follow up - locked files:
As some of you suggested, the file could be locked. It didn't appear so, and I thought it unlikely, as I don't know how to lock them. I copied the one file over, added it, and it is running, however, I got this warning when I tried to save and close it:
Locked file warning
I went through the steps to unlock it, and curiously, finder says it is not unlocked. Not locked but I'm getting the warning
Everyone has permission too
Any ideas as to why this might be? I'm stumped. I did try locking and then unlocking it, but no dice. I still get the error I don't have permission because it is a locked file.
Probably the file is not inside the project folder. This can easily happen with resources such as images and sound files that you copy to the project navigator. The project works fine but it has an external reference to the file. If the project folder is copied, eg zipped, the file is missing because it was not part of what was copied.
This generally occurs when you moved or deleted that file within Finder.
So try to delete that file from your project in Xcode and then re-add that file to your project folder in Xcode. Then your file would be working fine.
first: get your file from the current full path and cony it to any location on your mac enter image description here
Second: delete the red file from Xcode
third: drag file from the new location to Xcode don't forget to check on copy if you needed :)

The document “ViewController.swift” could not be saved. The file doesn’t exist

When I move ViewController.swift file another group X-code show popup and I click re-save. after all when I try to close my project Xcode show this message The document “ViewController.swift” could not be saved. The file doesn’t exist.
This happens quite often when moving files around.
What I do:
Locate the file in your project folder and drag to desktop
In xcode delete the file
Close Xcode, you may have to force quit if it keeps showing the The document “ViewController.swift” could not be saved. The file doesn’t exist. alert.
Reopen xcode and drag the file from your desktop to the folder in
xcode project where you want it to be.
Build and the message should have gone.
Make a zip of that project and delete the original project. After that force quit the system. Then start the system again and unzip the zipped project.
Thank-You
This issue occurred to me when I tried to move an xib file to a group.
I reverted my work and still the error occurred although the project was running normally.
I switched to a different git branch and ran my code it ran normally with no error message, then I returned to my branch again and ran the project and the error message disappeared.

Xcode puts old data file in bundle, not the new version of it

Xcode keeps resurrecting an old version of a bundled data file despite my best efforts to replace it with an updated version of the file.
I put a data file into my iOS document-based app project, did a build, and when run then app found the file in its main bundle as expected. Then I decided to change the data file by replacing it with a newer one. I deleted the old file from the project (reference removed and file deleted). I dragged the new file into Xcode project navigator just as before. I cleaned the build. When I rebuilt, the old file was still being put into the build output folder (the Build/Products/Debug-iphonesimulator/myproduct.app package). The original version of file does not exist anywhere on the system. I'd even emptied the Trash.
Anyone know what's going on? Is there some cache Xcode keeps that's outside the build folder structure and is not cleaned?
This isn't even anything to do with simulators or test devices. The build output is just plain wrong right on the Mac. (The app fails of course: it opens the data file but it's got the wrong, old data in it.) I've tried product cleaning, deleting the file from the project and on disk, putting the master file into Xcode under a new name, even deleting ~/Library/Developer/Xcode/DerivedData/(my project)-(alpha junk).
I'm using Xcode 10.3 on macOS Mojave 10.14.6.
The answer is to change the file type in the File Inspector of Xcode. It was "Default - Data" and should be "Data". My file is a byte stream from a NSKeyedArchiver. Apparently Xcode mangles this by trying to wrap the contents in XML.

Xcode 6.1 keeps telling me some PartialInfo.plist couldn't be opened

After I upgraded to Xcode 6.1, it kept throwing this exception when I tried to build my existing application. I tried to remove 'MyController' and add back again. But it would throw the same exception with different controller.
could not read data from '/Users/macbookpro/Library/Developer/Xcode/DerivedData/MyApp-
dmhwkhbfbxprhycwjeunwtbbtsxj/Build/Intermediates/MyApp.build/DEV-iphoneos/MyApp.build/MyController-
PartialInfo.plist': The file “MyController-PartialInfo.plist” couldn’t be opened because there is no
such file.
I found the answer. I have to replace all xib files' IBCocoaTouchPlugin to newer version.
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6244"/>
You can solve it by deleting the content in the DerivedData folder. If you're worried about deleting too many folders, then delete only the folders that start with the name of your current project that you're trying to problem-solve for.
Remember to close XCode before you delete the data
Library/Developer/Xcode/DerivedData/
For me (with Xcode 6.3) this was happening with a file that happened to end in ~iPhone.xib. I changed it end in the all lower-case ~iphone.xib, and problem solved.
This is generally happens when you open old version xibs
nothing to do only click on the xib in file panel its version will automatically changed/updated with newer version.
so also you not need to remember it.
I encountered this problem when I moved my .plist file to a new folder. You have to go into the Targets list (select the top bar on the left vertical menu of Xcode, the one that has the name of your project, and then select Targets on the vertical menu second from the left) and find the Identity section. From there, select the button that lets you specify the new path of the .plist file.
If that doesn't work, then try deleting your project's folder in ~/Library/Developer/Xcode/DerivedData/ and building again.
Several of you have come up with the partial answer.
I believe this issue is related to Apple's "fix" for when XIBs were loading slowly when they referenced custom fonts. They now store the custom font info in a xibnamePartialInfo.plist file in your derivedData folder.
Now if your app contains xibname~iPhone.xib AND xibname.xib, only the PartialInfo.plist file for xibname~iPhone.xib gets created and you see the error. Opening the xib in InterfaceBuilder had the side-effect of creating this file which is why the problem appeared to go away (until the next clean).
So the solution is to rename all ~iPhone files to something else (dash works as a replacement for tilde). Apparently its the tilde that is hindering the creation of the PartialInfo.plist file for the root XIB
Common answer for most of question... Restart Xcode. It works for me.

How can I avoid having to clean the project after replacing files?

Xcode 4.5.2, using cocos2d-iphone 1.0.1 for game development.
Recently, I have realized that every time I replace an image file with one of the same name, the project in my device will continue using the old one when I create a CCSprite with such file.
This can be fixed by simply cleaning the project.
However, now the project is rather large, and compiling after cleaning takes quite an annoying amount of time.
Is it possible to replace files and make Xcode use the correct files instead of having to clean the project?
Another simple fix is to give a different name to the new file and delete the old, then change the CCSprite to use the new file name. Of course, this is ridiculous so I'd like to avoid doing it.
I believe that it also happens even when I just delete the app from the device - it seems I do have to clean the project.
Open Organizer in your Xcode. Goto the Projects tab.
you can see Derived data options. Click Delete near to that option, to clean your project

Resources