문제

I have NSSet containing NSManagedObjects from NSManagedObjectContextDidSaveNotification notification.
The problem is that: I want to get the type of NSManagedObject in NSSet.
For example, is it Album, User or any other NSManagedObject.

도움이 되었습니까?

해결책

Say you have a managed object called entity, then use the following code to retrieve the name of the managed object:

NSManagedObjectID *objectID = [entity objectID];
NSEntityDescription *entityDescription = [objectID entity];
NSString *name = [entityDescription name];

For clarity I've declared variables on each line, but of course you could also write [[[entity objectID] entity] name]

I hope this is what you're looking for.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top