質問

I have Entity UserProfile with attribute uId. I receive users from web and add they in core data. I want that if there is a user with his id in my base - he will be replaced. I use tip https://github.com/magicalpanda/MagicalRecord/wiki/General-tips But How can I set that I want to use primary key?

役に立ちましたか?

解決

You need to first do a fetch request and check if there is a UserProfile with that uId.

If there is, then just update that UserProfile and save.

If not, then create a new UserProfile and save.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top