Sebastien Desemberg
Sebastien Desemberg

Reputation: 321

Retrieve UUID from core data and set UUID variable not working

I have a session variable saved in a Core Data table as a UUID field. I'm happy with that and it saves correct as I can print it as shown below. My problem is that I'm unable to set my UUID variable, it somehow return blank in my debug window and not sure what I'm doing wrong.

From my table view I select a row and retrieve the Core Data variables successfully which are all var = String():

PassNameSurname     = userAccountArray[indexPath.row].nameSurname!
PassCompanyOffice   = userAccountArray[indexPath.row].companyOffice!
PassEmployNo        = userAccountArray[indexPath.row].employeeNumber!
PassAccountPin      = userAccountArray[indexPath.row].accountPin!

My session variable is set to UUID() but returns blank in my debug window. I've tried each of the below lines, print does work so I know the Core Data field has a value:

PassSessionID = UUID(uuidString: userAccountArray[indexPath.row].sessionID.uuidString)!

PassSessionID = userAccountArray[indexPath.row].sessionID

print(userAccountArray[indexPath.row].sessionID)

PassSessionID in debug is empty. enter image description here

Upvotes: 0

Views: 480

Answers (1)

Blazej SLEBODA
Blazej SLEBODA

Reputation: 9915

NSManagedObject subclasses have @dynamic properties which are not resolved in the Xcode Debugger Variables View. There is more edge cases:

Solution

  • use po print(property) in Xcode Debugger Consol
  • select the entity in the variables view and then choose "Print Description to Console" from the contextual menu, you get a textual dump of the entity.

Extra informations

The Xcode debugging tools are integrated throughout the Xcode main window but are primarily located in the Debug area, the debug navigator, the breakpoint navigator, and the source editor. The debugging UI is dynamic; it reconfigures as you build and run your app. To customize how Xcode displays portions of the UI, choose Xcode Preferences > Behaviors.

The illustration below shows the default layout of the Xcode debugger with the app paused at a breakpoint.

enter image description here

Upvotes: 1

Related Questions