Coredata performBlock then return the new value

前端 未结 2 892
时光说笑
时光说笑 2021-01-14 23:33

How to return the new object saved in coredata if I am using performBlock to save a managedObjectContext?

The requirement is, add an entry in coredata,

2条回答
  •  猫巷女王i
    2021-01-15 00:04

    I did some research and found that was not too difficult to fix this issue:

    I replaced performBlock with performBlockAndWait and it worked.

    Reason is straightforward: performBlock is asynchronous, while performBlockAndWait is synchronous.

提交回复
热议问题