Archive error with CoreData, Xcode 8, iOS 10, Swift 3

I am transitioning my code to:

XCode Version 8.0 (8A218a)

iOS 10.0.2
Swift 3


The project is tested on device. When trying to Archive

got an error.


Steps:

1) trashed ~XCode/DerivedData

2) Build for Generic iOS Device - OK

3) Archive:

1 error:

many issues of the type:


<unknown>:0: error: no such file or directory: '/Users/***/Library/Developer/Xcode/DerivedData/MyApp-dxhexvukddacvtavnotizpcmsscd/Build/Intermediates/ArchiveIntermediates//MyApp/IntermediateBuildFilesPath//MyApp.build/Release-iphoneos//MyApp.build/DerivedSources/CoreDataGenerated//MyApp/TcDBUsageCounters+CoreDataProperties.swift'


Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1


What is wrong?

Replies

If this helps here how I solved the issue.


I was able to Archive.


On Each Entity:

1) Module:Current Product Module

2) Codegen: Manual/None

Then Editor->Create NSManagedObject Subclass->Swift.


There is another bug: in each Class there is an "include" with nothing after it which

couses an error when compiling. Needed to remove it in all generated classes.



Automatic Class Definition does not works when trying to Archive.

I changed the Code Gen from "Category / Extension" to Manual / None, but I am still getting an error for each of my entities:
<unknown>:0: error: no such file or directory: ''/Users/mark/Library/Developer/Xcode/DerivedData/.../.Account+CoreDataProperties.swift'

Each case has a . (dot) prefix before the entity name: .Account+CoreDataProperties.swift.


The thing is, even though I did a clean and clean directory, an delelete the DerivedData directory, there is an actual file there, just without the dot prefix.


This is very confusing. Can anyone explain it?

Hello,


I am having the same issue and tried multiple times but no luck so far.

All the coredata autogenrated filesa are already there on the defined path but still getting error for one or other of the files present there in that folder that the file is not found. This is ridiculous bug as I am not able to upload the app to app store and I am so upset on xcode.


Please let me know if you were able to resolve this issue.

Long shot here. Try adding that file to the Xcode project ticking copy items if needed.


Then delete the file in project navigator and selecting remove reference. Clean, build and see what happens. I had a similar issue which wasn't related to coredata which I understand is handling files differently, but it might just work in this case too.

This is a Apple bug the occurs when the module of an entity is set to "Current Product Module" (e.g. to be within the Swift namespace, rather than the global Objective-C namespace). The workaround for this is:


- remove the customization of the "Module" field of the entity, so it has the default value of "Global namespace" (in light gray text).

- change Codegen to Class Definition

- Clean Project and Derived Data

I am getting the same error. Has anyone had success fixing this error? This is very frustrating

This heinous bug is not specific to Core Data code generation. I get the same errors when archiving only my Swift framework. See:


https://forums.developer.apple.com/thread/75338