Created
January 11, 2018 08:57
-
-
Save Lancewer/2232101a89a33bd226b62d3c9cad88c9 to your computer and use it in GitHub Desktop.
[GetManagedObjectID] get managedObjectID created by CoreData #CoreData #iOS #ID #swift #ObjectID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shows how to get all managedID from a entiry preserved by CoreData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let itemIDsFetchRequest = NSFetchRequest<NSManagedObjectID>(entityName: "ClothItem") | |
itemIDsFetchRequest.resultType = .managedObjectIDResultType | |
do { | |
let ids = try managedContext!.fetch(itemIDsFetchRequest) | |
print(ids.first!.uriRepresentation().absoluteString) | |
}catch let error as NSError { | |
print("Fetch item failed:\(error), \(error.userInfo)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment