Questions tagged [nsmanagedobjectid]

Compact, universal identifier for a managed object.

From Apple doc class reference

An NSManagedObjectID object is a compact, universal identifier for a managed object (NSManagedObject). This forms the basis for uniquing in the Core Data Framework. A managed object ID uniquely identifies the same managed object both between managed object contexts in a single application, and in multiple applications (as in distributed systems). Identifiers contain the information needed to exactly describe an object in a persistent store (like the primary key in the database), although the detailed information is not exposed. The framework completely encapsulates the “external” information and presents a clean object oriented interface.

22 questions
6
votes
2 answers

NSManagedObjectID vs custom UUID identifier attribute - fetch performance

I would really like to avoid using NSManagedObjectID as a way to connect my model structs to their CoreData objects. I mean something like this: Say I have a Book entity in CoreData and then I have a model struct like this representing it for my…
SwiftedMind
  • 3,701
  • 3
  • 29
  • 63
2
votes
3 answers

Notification error: Adding notification request failed with error

Attempting to create a local notification fails with the following error: Adding notification request failed with error: Error Domain=NSCocoaErrorDomain Code=4097 "connection to service named com.apple.usernotifications.usernotificationservice"…
Matt
  • 4,261
  • 4
  • 39
  • 60
2
votes
1 answer

Core data object id format

I have these permanent object ids that I got by fetching the same object in different contexts: The GUID part…
Zsolt
  • 3,648
  • 3
  • 32
  • 47
2
votes
1 answer

Thread safety of NSManagedObjectID

Can an NSManagedObjectId instance itself be safely shared between threads? I know I could drop a level down and grab its URIRepresentation, but if I can avoid that I will. Thanks!
QED
  • 9,803
  • 7
  • 50
  • 87
2
votes
1 answer

Getting managedObject with all values nil, using objectWithID

I am working with core data. I want to update a managed object on few events of my application. That managed object is either created or fetched (if exist) on app launch. I know that managed object is not thread safe so I am not storing the managed…
2
votes
0 answers

CoreData: error: batched fetch request asked to fetch 1 objects but received 2 objects

I use two persistent stores: first is read-only for default (built-in) app's data, second is read-write for user data. The issue occurs once user add any data in second store. In this case during execution of performFetch: method of…
2
votes
1 answer

Store ManagedObjectID in a NSDictionary

I am working on local notifications and in order to identify each notification it needs to get a NSDictionary with the ManagedObjectID from the Core Data model as key of that dictionary. The problem is thatwhen I do this I get the following…
Sjaak Rusma
  • 1,424
  • 3
  • 23
  • 36
1
vote
2 answers

Swift, CoreData and many-to-many-relationship: how to access order of subitems?

I've the following relationship: Playlist may have one-to-many songs, and Song may belong to one-to-many playlists. My problem consists in getting the order of a song in a specific playlist - for example, in Playlist 1, the order maybe 3, in…
1
vote
2 answers

Save a NSManagedObjectID in a plist file

I'm developing an app that uses CoreData. For the purpose of my app, I would like to save the managedObjectId of an object (in a plist file) in order to retrieve this object on the next app launch. Following some reseaches, I tried : myDictionary…
Maxime Capelle
  • 887
  • 7
  • 16
1
vote
0 answers

How to deal with deleted entities on a background thread?

I'm having an issue related to objectIDs used in a multi-threaded context. I am using objectIDs to pass an entity a completion block that's called by a background thread, like so : NSManagedObjectID *entityID = [entity objectID]; [self.queue…
Toop
  • 11
  • 1
0
votes
1 answer

objectID many to many relationship

I need some help with my Swift rookie programming... In a many-to-many relationship, I have a NSManagedObjectID that I`ve segued from another view controller. To retrive data from it I have used this: var elevid :NSManagedObjectID? let person =…
Petter
  • 1
  • 1
0
votes
1 answer

managedObjectID throwing "Unresolved Identifier" Error

I'm trying to fetch a specific Item from the CoreData store, so that I can edit particular values for keys. The editing takes place in a different ViewController to where the entity to edit is picked. I have prepare(for segue:) in the original View…
boywithaxe
  • 286
  • 1
  • 12
0
votes
0 answers

Handling Temporary NSManagedObjectID of Core Data`

I'm trying to retrieve the object ID of a Core Data entity. I've two Core Data contexts: main(mainQueueConcurrency) and child(privateQueueConcurrency) - I know, it's not the best solution but I'm still learning Core Data so hopefully my next…
Can
  • 4,516
  • 6
  • 28
  • 50
0
votes
1 answer

My NSManagedObjectID is still temporary after saving. But why?

I saved my managedObjects. But my NSManagedObjectID is still temporary after saving. Why? dispatch_async(privateQueue, ^{ __block NSMutableArray *ids = [NSMutableArray array]; [[[LPAppDelegate instance] privateContext]…
Voloda2
  • 12,359
  • 18
  • 80
  • 130
0
votes
2 answers

Profile screen by using core data

Hey first of just to let you all know i'm new to Core-Data so be essay with me, Ok I have a very basic login system which I have an entity named "Account" and 2 attribute named: "email", "password". Let's start from the problem and move on from…
1
2