I need to know the source of the changed coredata objects returned from NSManagedObjectContextObjectsDidChange. I have some shared objects, and want to send a notification if the source is other than me. But when I change an object, it comes through the same as objects changed by other users. Is there any way to tell the difference?
1 Answer
I found a way to do this. Not as easy as I hoped, but not too bad. I fetch the CKRecord from CloudKit for the changed object, and it has a modifiedUser property that tells me if it was modified by me.
lastModifiedUserRecordID?.recordName == CKCurrentUserDefaultName
2 Comments
HangarRash
But wouldn't the same user appear on all of a given user's devices?
Elijah
Yes. Which is good, so I don't send a notification to myself no matter what device I'm on. I only want to send notifications when the change came from someone I've shared the object with.