[NSManagedObjectContext delete:]: unrecognized selector sent to instance

前端 未结 2 948
说谎
说谎 2021-01-19 12:57

core data getting on my nerves. i\' m deleting old data and want to insert new data received from server.

now the deleting part gives a \"sigabort\":

相关标签:
2条回答
  • 2021-01-19 13:17

    do it like this for deleting an object permanently

    for (TEventContact *tmpCon in allCons)
    {
        [context deleteObject:tmpCon] /// for deleting object in context
    }    
    [context save]; /// to reflect changes in database you need to save that context
    

    without saving the context it doesn't reflect on data base and that may cause DIRTY_READ for another context

    0 讨论(0)
  • 2021-01-19 13:21

    Use

     [context deleteObject:tmpCon];
    

    It will solve the problem

    0 讨论(0)
提交回复
热议问题