realmteam / coredatahelper Goto Github PK
View Code? Open in Web Editor NEWCoreDataHelper is a tiny Swift Framework that helps you to easily manage CoreData objects in the main context.
License: MIT License
CoreDataHelper is a tiny Swift Framework that helps you to easily manage CoreData objects in the main context.
License: MIT License
Hello Louis,
I found finally the problem. This is the snippet:
...
do {
try FileManager().moveItem(at: location, to: destinationUrl)
let data = NSData(contentsOf: destinationUrl)
DispatchQueue.main.async {
let soundSave : SelfieObject = SelfieObject.new()
soundSave.url = url.absoluteString
soundSave.path = destinationUrl.absoluteString
soundSave.data = data as? Data
soundSave.save()
}
} catch let error as NSError {
Log("An error occurred (step2): \(error.localizedDescription).")
}
...
Crash occurres in soundSave.save() because the phone is out of memory.
Tutti flirty(1578,0x3bda0fc0) malloc: *** mach_vm_map(size=499712) failed (error code=3)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
2017-01-24 15:54:00.649652 Tutti flirty[1578:314845] [error] error: (7) I/O error for database at /var/mobile/Containers/Data/Application/0569E2D2-D595-4A93-ABAC-DB03CB49FC56/Documents/SingleViewCoreData.sqlite. SQLite error code:7, 'out of memory'
CoreData: error: (7) I/O error for database at /var/mobile/Containers/Data/Application/0569E2D2-D595-4A93-ABAC-DB03CB49FC56/Documents/SingleViewCoreData.sqlite. SQLite error code:7, 'out of memory'
2017-01-24 15:54:00.661997 Tutti flirty[1578:314845] [error] error: -executeRequest: encountered exception = I/O error for database at /var/mobile/Containers/Data/Application/0569E2D2-D595-4A93-ABAC-DB03CB49FC56/Documents/SingleViewCoreData.sqlite. SQLite error code:7, 'out of memory' with userInfo = {
NSFilePath = "/var/mobile/Containers/Data/Application/0569E2D2-D595-4A93-ABAC-DB03CB49FC56/Documents/SingleViewCoreData.sqlite";
NSSQLiteErrorDomain = 7;
}
CoreData: error: -executeRequest: encountered exception = I/O error for database at /var/mobile/Containers/Data/Application/0569E2D2-D595-4A93-ABAC-DB03CB49FC56/Documents/SingleViewCoreData.sqlite. SQLite error code:7, 'out of memory' with userInfo = {
NSFilePath = "/var/mobile/Containers/Data/Application/0569E2D2-D595-4A93-ABAC-DB03CB49FC56/Documents/SingleViewCoreData.sqlite";
NSSQLiteErrorDomain = 7;
Do you have any advice, how can I catch this error from CDHelperEntity.swift class ?
I now tried to implement this helper twice and both times I got this error when I try to make a new User
'NSInternalInconsistencyException', reason: '+entityForName: could not locate an entity named 'User' in this model.'
I initiate in application did load using
CDHelper.initializeWithMainContext(self.persistentContainer.viewContext) // New XCode 8/Swift 3 template
I have the model swift class for User
Core data works fine but not with this helper :( any ideas?
how I access relations? exists?
Not yet released version 2.0.0?
Hello,
I would suggest to add a feature getting the lib able manage the lack of free space on the phone for saving. The idea is to catch this exception not in the library but in the code calling the library function (//HERE comment in the next snippet).
...
do {
try FileManager().moveItem(at: location, to: destinationUrl)
let data = NSData(contentsOf: destinationUrl)
DispatchQueue.main.async {
let soundSave : SelfieObject = SelfieObject.new()
soundSave.url = url.absoluteString
soundSave.path = destinationUrl.absoluteString
soundSave.data = data as? Data
soundSave.save() // HERE
}
} catch let error as NSError {
Log("An error occurred : \(error.localizedDescription).")
}
...
2017-01-24 15:54:00.649652 [1578:314845] [error] error: (7) I/O error for database at /var/mobile/Containers/Data/Application/0569E2D2-D595-4A93-ABAC-DB03CB49FC56/Documents/SingleViewCoreData.sqlite. SQLite error code:7, 'out of memory'
CoreData: error: (7) I/O error for database at /var/mobile/Containers/Data/Application/0569E2D2-D595-4A93-ABAC-DB03CB49FC56/Documents/SingleViewCoreData.sqlite. SQLite error code:7, 'out of memory'
For the moment I do this Entity.findAll().First
is this correct?
Or there is a way to add a method something like this Entity.first()
do we have swift package manage for it? and support swift 5.x?
When the new version is approximately released?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.