xcode: missing file xcdatamodeld after changing the path of file - ios

I added a data model to my project and found a bundle users.xcdatamodeld in my project directory. after that I moved under a sub directory of the project. also moved physically. and after that when I compiled, xcode shows missing file error.
Any help on this will be thankful.

Delete the file from the file list in xcode (it should be in red text) then go to add File->Add File to "Project" and add the file back to your project.

Related

why I got error Build input file cannot be found when I remove the file from my download folder?

I have GoogleService-info.plist file in my project file of my app. The way I copy that file to my project is like this
I download the GoogleService-info.plist from Firebase site to my download folder on my Mac. and then I copy by dragging that file from download folder to Xcode by using this
and my problem is ....
when I delete the GoogleService-info.plist from the download folder on my mac, it will cause error on my Xcode project, the file is also dissappear from my project like this
Build input file cannot be found:
'/Users/dev.adsapps/Downloads/GoogleService-Info.plist'
what went wrong in here ?
I have tried to search the answer like in this thread Problems after upgrading to Xcode 10: Build input file cannot be found but it seems the problem is little bit different
do I have the wrong way when copying the file to my project ?
I am using Xcode 10.
Look for Added folder options while adding GoogleService-Info.plist. You should select the first radio button Create groups instead of Create folder references and it will not be removed when you remove it from the other location, for now you are just referencing the item while adding it to the workspace.
Hope it helps.

Error while importing a file from another folder in the same project

I am getting this error while importing a file from another folder in the same project:
Unable to resolve ./src/components/Header" from ".//App.js: could not resolve `/Users/abhinav/myProject/src/components/Header' as a file nor as a folder","name":"UnableToResolveError","type":"UnableToResolveError","errors":[{}]},"type":"bundling_error"}"*
The file is already present in the required location
Just remove that file reference from XCode(not from project folder of system)
After that, From project navigator right click the folder where you want to add the file. And Select option "Add file to " and select same file, which is available in you project folder.
It's reference issue, mostly happening in XCode 9.

Getting error after changing project folder name in XCode

When I created my project, I called it "Project1". Then, later I've changed it to "Project2" from the Xcode. I changed all "Project1" to "Project2", but now, when I compile my project, it looks for files in Project2/Project1/myFile.swift and I get the next error:
<unknown>:0: error: no such file or directory: '/Users/myusername/Copy/Projects/Project2/Project1/myFile.swift'
I need to make that it will look at
/Users/myusername/Copy/Projects/Project2/myFile.swift
without Project1 in the path.
How can I solve this problem? Also, I changed from Xcode Identity and Type section Location of my project.
Today I had the same problem when I renamed the folder containing the Xcode project and some parent folders of it.
In my case there where a .swift file shown with it's name in red in the list of files of Xcode (Navigator area). I think that this means that Xcode was not capable to find that file.
I selected that file (actually it's not a real file but a representation of it).
Then, in the File Inspector (Utility area), I clicked on the Folder icon and chose the file on Finder.
This worked for me.
Renaming projects in xcode in one of the most annoying things in iOS development. I assume you want to rename your app. I faced this problem once and figured out a simple, clean way to do it.
Go back to the point where everything worked.
Open project in xcode and click on the project icon in the project structure( first file)
Go to the info tab
Search for Bundle Name. Most probably it will automatically be set to $(PRODUCT_NAME) which is a shell variable that will set your app name the same as the project name.
Set it to whatever you want your app name to be
Done
Note : If you use custom URL Schemes this might produce an error when redirecting.
ALWAYS use git or some other SVN in your projects. This will come in handy in this kind of situations
Change you folder name in you finder "Project1" to "Project2"
Remove "myFile.swift" file from project (copy on Desktop)
Restart Xcode. Copy "myFile.swift" in project select "Copy file to folder" hope this will help.

Name Change Issue - Xcode trying to build from old file name

I've changed the name of my project from "BSV22" to "BSVC". I renamed the project by going to project navigator and double-clicking the title. I accepted changes to all the file names. When I then run the project I get the following error:
could not read data from '/Users/bobpreston/Desktop/BSV22/BSV22/BSV22-Info.plist':
The file “BSV22-Info.plist” couldn’t be opened because there is no such file.
it's pretty obvious why Xcode can't find the old file "BSV22-Info.plist"...because it was renamed when Xcode changed all the file names during the project rename. my question is why is Xcode still trying to build from that old file? it should be compiling from the new filename "BSVC-Info.plist" - and also how do i fix the issue? what else do i have to do?
In your target Build Settings, check the Packaging section for the row called Info.plist File. Make sure it has been updated to use the new filename.
While renaming the project name from old name below are the steps:-
1) Changing the name from testing to testing123 and enter.
2) After that it will show the below window. So just click on the rename button
3) After that clean your build and run.

Is it possible to Add .pch File in project?

I Download Project for learning purpose. But in this project i got error that is display in MY Screen Shot . i know that Prefix headers are compiled and stored in a cache, and then automatically included in every file during compilation. This can speed up compilation, and lets you include a file without adding an import statement to every file using it. They are not required, and actually slow compilation whenever you change them.
Screenshot
My Question is that is it possible in my case to add .pch file or not ??? if possible then please explain it.
Thanks in Advance.
The screenshot shows that you do not have the pch file added to the physical folder or it is removed somehow from there even though it is added to the project. You need to add that file again and build to remove this error. You can remove the reference from project before doing that and add it as a new file to this project once you have added it in your physical folder.
A red file name in project as shown in screenshot normally represents a missing file from the project folder structure.

Resources