Core data, how to get NSManagedObject's ObjectId when NSFetchRequest returns NSDictionaryResultType?

前端 未结 5 1238
闹比i
闹比i 2020-12-07 12:48

I have an NSFetchRequest which is returning the objects\' properties in an NSDictionaryResultType. Is it possible to also get the objects\' ObjectI

5条回答
  •  遥遥无期
    2020-12-07 13:29

    Nick Hutchinson's answer in Swift:

        let idDescription = NSExpressionDescription()
        idDescription.name = "objectID"
        idDescription.expression = NSExpression.expressionForEvaluatedObject()
        idDescription.expressionResultType = .objectIDAttributeType
    

    I can't comment on it because I don't have enough rep :(

提交回复
热议问题