Move datamodel to new project - iphone

I have re-created my iphone app project from scratch. I added my source and datamodel files into the new project. I have the new project compiling and working.
Now I notice that the app created by my new project is not 'compatible' with my old app. If I have an existing database on the device/simulator, the new app does not recognize the datamodel, it thinks things have changed. I get errors:'Can't merge models with two different entities named 'Event'
How do I properly move my datamodel from old project to new project in a way that everything still works? I have been simply adding in the projectName.xcdatamodelId source files and compiling. Is there something else that I need to do?
At first I thought that this was happening because I had renamed the files to match the new project name, but I have tried without renaming and am seeing the same problem.
Thanks for any help you can provide!
UPDATE:
OK, maybe it was the renaming. I cleaned up and rebuilt fresh and it seems to be working again. It looks like the first time I tried the failure messed things up on the existing database. Can anyone confirm that renaming is problematic, or explain how this can be done correctly?

Related

I can't log in to a project in Unity

What to do I'm doing a project with a friend and I'm throwing him the project files, he opens the project and shows this error in Unity Hub, this did not happen before, and after one moment it began to appear, I don't have such an error, the Internet is almost empty about it. What to do?
nice error
I solved the problem, I just needed to create a new folder for projects
I solved the problem, I just needed to create a new folder for projects
There are some solutions online eg. here
It seems like one possible solution is related to the Crash Handler or related to git VC.
One simple common solution is
One interim test solution is to try copying the Assets/ and ProjectSettings/ and Packages/ file to a brand new directory somewhere, then try opening that.

File name used twice Xcode

Error
I'm trying to use the CoreData functionality but when Xcode creates the two files (xx+CoreDataClass.swift and xx+CoreDataProperties.swift) Xcode gives me this error. The problem is: there's xx+CoreDataClass.swift is in the project's directory and in another directory that it creates when it compiles... so this error persist even if I delete the second one.
What should I do??
This is most often bugs in Xcode where it gets confused about generated files (I literally ran into this exact problem this morning....)
The solution generally is to close Xcode, delete DerivedData, and reopen Xcode.
DerivedData is in ~/Library/Developer/Xcode/DerivedData/. You can remove the whole directory, or just the subdirectory related to your project.
"Delete DerivedData" is an incredibly common solution to Xcode problems, and has been for years. Most of us have some kind of alias to simplify it. This is mine:
alias cdd='cd ~/Library/Developer/Xcode/DerivedData/'
This kind of error generated some times because of your codegen property of Managed Class. You have to change your codegen to Manual/None from attributor.

Xcode indexing frequently and searching in framework files/takes time when loading project

I am having a weird problem with Xcode where it keep indexing and takes long time to do that. Search functionality also does not work properly. It searches in all framework/library files instead of project files. I tried with my other project but that project has no problem. So I guess it is something wrong with my project...But I am not able to find out. Can anyone help?
Found out answer to my own question... I deleted workspace file in .xcodeproject package. Then When I opened the project in xcode, it still took time because it has whole "Application" folder under the project. I removed the reference to it and reopened it and now it works fine. It didn't affect the git repository for me.

iPhone "_OBJC_CLASS_" compilation error

I am trying to compile my project in Xcode. But i am getting the following error.
"_OBJC_CLASS_$_InfrastructureBenchmarkingViewController", referenced from:
objc-class-ref-to-InfrastructureBenchmarkingViewController in RootViewController.o
4 more of similar type.
Can't understand the meaning of this error?
Small Clarification: Actually the _InfrastructureBenchmarkingViewController was a module in another project. The files pertaining to that I have copied into the new application.
Sometimes it happens when the project definition file (.xcodeproj/project.pbxproj) is somehow messed-up, eg. because of XCode crash or project is taken from someone else, etc.
So try removing InfrastructureBenchmarkingViewController (Delete the file, then choose "Delete reference", so it is not deleted physically from disc) and then again add this file to project (Add > Existing file from the project context menu).
It worked for me several times.
you need to link in whatever framework _InfrastructureBenchmarkingViewController is a part of. Try going to the project window, right click on frameworks and choose add existing framework ....
you should be able to find the framework including _InfrastructureBenchmarkingViewController there.
Seems you have some object files that are not valid anymore. Use the clean option from menu and build it again. That should solve it.

Core Data No Longer Updating Sqlite Schema

I am using core data for my app and I never had any problems adding or removing columns until recently. But now even if I make changes to my xcdatamodel and generate new and updated entity h/m files, sqlite doesn't seem to be picking up the changes. I actually went over to the documents folder and inspected the create statement for the relevant tables in sqlite3 and I was able to confirm that the columns I added were missing.
I removed and redeployed the app several times to no avail. Is it possible to do something to the app to make it disregard any schema changes being made through xcdatamodel? I guess another thing I should mention is I recently started putting my entire projects folder in CVS so I wonder if something got messed up in the checkin and check out process.
Sorry. I feel like an idiot. A combination of "Reset Content and Settings" on the Simulator and a "Clean All Targets" in xcode seems to have fixed it.