Closed edwardgroberski closed 8 years ago
Hi @edwardgroberski ,
I'm getting same issue as you, may I know how do you fix this in the end, please?
Thanks.
Hey @WecanWang, actually I did not mean to close this issue. I temporarily got over the issue by setting my project target to iOS 10 and setting AlecrimCoreData target to iOS 10 as well (this will get overridden with pod update). @vmartinelli is there something we can do to fix this?
I thought you had found a solution and I was curious to know what it was.
I could not push compatible Swift 3 versions via CocoaPods even with the @available
before the indicated error lines.
For now I think using the framework as a git submodule (or copying it directly) and adding it to the workspace may work. Can you test if this alternative works for you?
Thanks.
Thanks for the reply guys. @vmartinelli , I'm trying to copy it directly in my project but remains to get rid of the old dataContext and fix other errors at the moment, I'll let you know once I fixed all the issues and get the project working ok.
Thanks.
Hi @vmartinelli, sorry for getting back so late.I just finished migrated my app to swift 3. After I copy it directly in my project it works fine, but there's 2 warnings like below:
I'm not sure if this will cause any issues or not, but it works for me so far, will keep on testing.
Thanks again for creating this amazing framework!
@WecanWang Hi ! I have the same problem, I tried to copy PersistentContainer.swift to my project, but shows the same errors. Can you please tell me what you did ?? Please
Hi @CristianCardosoA , I don't think I can provide too much help on this but I'll try. Previously I use Pod to install AlecrimCoreData and got same errrors as yours, and then I remove it from Podfile and drag the files inside Source folder into my project manually and it works. Hope that helps to solve your problem.
Thanks @WecanWang but I only added those tags, apparently works correctly.
`import Foundation import CoreData
// MARK: - @available(iOS 10.0, ) @available(macOSApplicationExtension 10.12, iOSApplicationExtension 10.0, tvOSApplicationExtension 10.0, watchOSApplicationExtension 3.0, ) internal class NativePersistentContainer: NSPersistentContainer, UnderlyingPersistentContainer {
private let contextType: NSManagedObjectContext.Type
private let _viewContext: NSManagedObjectContext
internal override var viewContext: NSManagedObjectContext { return self._viewContext }
internal required init(name: String, managedObjectModel model: NSManagedObjectModel, contextType: NSManagedObjectContext.Type) {
self.contextType = contextType
self._viewContext = self.contextType.init(concurrencyType: .mainQueueConcurrencyType)
super.init(name: name, managedObjectModel: model)
self._viewContext.persistentStoreCoordinator = self.persistentStoreCoordinator
}
internal override func newBackgroundContext() -> NSManagedObjectContext {
let context = self.contextType.init(concurrencyType: .privateQueueConcurrencyType)
if let parentContext = self.viewContext.parent {
context.parent = parentContext
}
else {
context.persistentStoreCoordinator = self.persistentStoreCoordinator
}
return context
}
@available(*, unavailable)
internal override func performBackgroundTask(_ block: @escaping (NSManagedObjectContext) -> Void) {
fatalError()
}
internal var alc_persistentStoreDescriptions: [PersistentStoreDescription] {
get { return self.persistentStoreDescriptions }
set {
guard let newValue = newValue as? [NSPersistentStoreDescription] else {
fatalError("Unexpected persistent store description type.")
}
self.persistentStoreDescriptions = newValue
}
}
internal func alc_loadPersistentStores(completionHandler block: @escaping (PersistentStoreDescription, Error?) -> Void) {
self.loadPersistentStores(completionHandler: block)
}
internal func configureDefaults(for context: NSManagedObjectContext) {
context.automaticallyMergesChangesFromParent = true
context.mergePolicy = NSMergeByPropertyObjectTrumpMergePolicy
}
}
// MARK: - @available(iOS 10.0, ) @available(macOSApplicationExtension 10.12, iOSApplicationExtension 10.0, tvOSApplicationExtension 10.0, watchOSApplicationExtension 3.0, ) extension NSPersistentStoreDescription: PersistentStoreDescription {
}`
@CristianCardosoA , I think you might not using the same copy as mine, if you check the link below you'll find out the file uses #available instead of @available .
@WecanWang I posted the "NativePersistentContainer.swift" file !
CristianCardosoA , sorry about that. In that case I've no idea what's causing the problem.Maybe try to do a clean build?
Thank you guys. Apparently CocoaPods does not understand what is iOSApplicationExtension 10.0
and needs iOS 10.0
to be the first item in the list of the @available
and #available
clauses.
With your help discussing this subject, I was finally able to upload a new version via CocoaPods.
Please check to see if ACD can run normally using the 5.0-beta.5
release.
@WecanWang In what lines of code these NSError
warnings appear? Do they still appear in the latest release?
@vmartinelli Now works normally ... Thanks !
@CristianCardosoA Cool!
I really don’t know if it is a CocoaPods related issue (like I’ve been saying) as I’m not using ACD 5.0 for any iOS 9 target. Maybe the previous errors were related do Swift compiler or Xcode version. The important thing is that it works now.
My target is IOS 9.0 & 10.0 and now works. Probably as you say it's CocoaPods issue.
Now we can close this issue. Thank you !
@vmartinelli After I using the latest version via CocoaPods those warnings are gone, thanks.
Hello, I have installed the new AlecrimCoreData (5.0) and my project target is iOS 9. Every time I try to build the project I get an error in the AlecrimCoreData/NativePersistentContainer file saying: 'NSPersistentContainer' is only available on iOS 10.0 or newer. Am I doing something wrong or how can I get around this?