문제

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