Code Monkey home page Code Monkey logo

coredatahelper's People

Contributors

lobodart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

coredatahelper's Issues

SQLite error code:7, 'out of memory'

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.

capture d ecran 2017-01-24 a 15 56 18

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 ?

could not locate an entity named 'User' in this model.'

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?

Swift 2.3 in Xcode 8

I got an error when using Swift Xcode 2.3 on 8

Type ‘Self’ does not conform to protocol ‘NSFetchRequestResult’

captura de pantalla 2016-09-26 a la s 2 00 36 p m

Throw en exception if no more space in sqlite ?

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'

capture d ecran 2017-01-24 a 15 56 18

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.