Core Data code generation is not supported for Swift 2.3 - ios

I am using CoreData in my application. I was using it in Xcode 8 before it works fine but suddenly its throwing me this error. I tried searching for answer but not getting anything and took a look at a Error: Core Data Code generation is not supported for Swift 2.3 this answer but not solved my problem. If anyone could help. Thank you.

In Data Model Inspector change the Module to Current Product Module and Codegen to Manual/None. This solved my problem.

Try to set Codegen to Manual/None in Utilities area for your Model.xcdatamodeld file.

Related

What is a clean approach in Xcode 12.2 to add a Core Data file to an older Xcode project?

Update: I fixed this by adding title and date attributes to the Data Model, and also a timestamp attribute required by the persistence class. Compiling I found other errors, that I am currently fixing. Xcode 12 introduces a different structure of the PersistenceController, that I think that simplifies the use, but older code needs a bit of refactoring. I am leaving the post here if it can be of any help.
I am using the most recent Xcode on Big Sur to add CoreData to extend a project that didn't have it, and I am getting this error:
/Users/myroot/Desktop/Development/myapp/app/AppDelegate.swift:61:45: Argument passed to call that takes no arguments
When I try to copy the content of an Xcode 12.2 Persistence.swift example project in my old application project AppDelegate.swift, I get the error in the PersistenceController, in this block of code that includes:
let newItem = Item(context: viewContext)
Has anyone solved how to update a project using AppDelegate.swift with an Xcode 12.2 Core Data code that didn't use it?
Thanks.

Convert to Current Swift Syntax Failed - "No such module" (Swift 4, Xcode 9)

In Xcode 9, I am trying to do the automatic conversion to Swift 4.
It fails with the following message:
Convert to Current Swift Syntax Failed
Please ensure that all selected targets build successfully with the currently configured Swift version before attempting a migration.
It's complaining of a missing module. But when I do a regular build there are no issues. Not sure if this is relevant, but the module (which Xcode is complaining is missing) was already converted to Swift 4 earlier (in it's own project).
Note: No Cocoapods / Carthage used here.
Note: Two solutions tried (and worked) but do not address the underlying issue.
One solution is to do the conversion manually (change Swift version to 4 in build setting and apply Fix-Its one by one until no more build errors).
Another solution is to disable the third party framework (comment out all code where it's used), do the auto-migration, and then re-enable the framework. This could get pretty difficult with bigger projects.
I can't find any solution yet.
For now I fix manually setting Swift Language Version
After changing from 3.2 to 4.0 I compile and fix errors and warnings manually.
I'm waiting for a better solution!
I also got this problem while converting my project to Swift 4.0. Looks like problem appears when you try to convert target which imports a framework which is already in Swift 4.0. At your screenshot you try to convert 'RecipeTextParser' which imports 'SovaTools' which is already Swift 4.0.
I found dirty, but working solution. You can use older(Swift 3.2) version of 'SovaTools' when converting. You should NOT check it's mark in target selection window of conversion tool. Then, when 'RecipeTextParser' will be successfully converted you can use Swift 4.0 'SovaTools' version again.
I got this error and in my case one of my Pods(the one Xcode was complaining about) was a Swift 4 target and the rest were Swift 3.2. Looking at the build logs it looks like Xcode built that framework in one location and was searching for it in another. When I reverted that Pod to an older version(that used Swift3.2) the problem went away. Obviously a Xcode bug. HTH
Just update your pod and it will resolve the issue.
To update pod:
open terminal and go to your project directory
type pod update
This resolved my issue.
Xcode (Xcode 9) language migration feature is not as much accurate that it can migrate your complete code/project from one swift version to another with zero tolerance. It skips few code migration for us (developers). It may be bug or inaccuracy of tool. But you need to put some manual effort also, to completely migrate swift language version for your project/code.
Now, according to your snapshot, Xcode is showing and error for 'RecipeTextParser' framework. I think this is an external/third party framework. Another point to note, you've integrated this framework using CocoaPods:
Any one of following can be reason for failure of code migration:
CocoaPods locks framework (files) for editing. So language migration process may not be able to migrate (or identify) code for external/thirdparty framework.
In general terms, Framework is package of code files, so framework itself may not allow file/source code editing.
Suggestion as solution:
Update your cocoa pods as well as all frameworks integrated using cocoa pods compatible to latest swift language version.
If you've manually integrated/added external/third party frameworks, then you need to update/replace those also.
Some manual effort is required to completely migrate code between swift languages. I tried swift migration with above options and my all projects are now compatible with swift 4.

Error preparing CoreML model: "<something>" is not supported for CoreML code generation

I am modifying the code from this tutorial and I'm getting this error:
Error preparing CoreML model "Resnet50.mlmodel" for code generation:
Target's predominant language "Swift Interface" is not supported for
CoreML code generation. Please set COREML_CODEGEN_LANGUAGE to
preferred language
The project used to compile before with the "Places205-GoogLeNet" model.
Anyone else experiencing the same?
In the project settings view for your app target, Change the setting COREML_CODEGEN_LANGUAGE to Swift.
The default setting Automatic is not working correctly in all cases in Xcode 9 beta.
This issue was also mentioned on the apple developer lists here.
So basically if you have got more than one model XCode does not autogenerate the code automatically and complains with an error.
Removing the previous model from the resource folder solved the issue.
It looks like that an App can have only one model installed.

Many errors after update to swift 3

Hello i'm working on swift 2 with parse then i just updated to swift 3
and i got many errors the app was working perfect. Here is some errors i would get help with:
Another swift file
other errors:
How cannot assign that object into nsarray and it was working good.
so how could i fix them, any help will be appreciate.
You should read Swift 3.0 Migration Guide. It covers everything you need to know about new Swift 3 API changes. Since standard library changed a lot, it is common for third party frameworks to not work fully since they all use standard library as an underlying framework.

TBXML in an iOS 8 extension fails to build

In my iOS app I use TBXML for xml processing, it's not officially updated but it still working fine for me.
I'm trying to create a Today extension for iOS 8 and when I add TBXML as a Compile Source I get the following:
TBXML.h
Before adding the extension, I didn't have any build issue with TBXML.
Any ideas of how can I resolve this?
Thanks
Fixed by adding #import <Foundation/Foundation.h> at the beggining of TBXML.h.
Seems that when working with extension, this file is not imported or is imported later
I always want to know WHY. Why would it work before without the include of foundation and not now? What changed? So I dug a little deeper and found the answer: Prefix headers. Xcode 5 must had automatically added a prefix header as a convenience or something. And the new one doesn't. That old prefix header automatically included Foundation, Availability, and UIKit.
Who knows why they changed it. Maybe it has something to do with swift.
A more detailed answer is at: Unknown type name 'NSError' and others

Resources