Realm on iPhone Exception on read

@Michael_Granberry As a fellow programmer getting acquainted with this system, I would suggest making sure that users actually contains data before dereferencing it with an array subscript.

if users?.count > 0 {
     nameLabel.text = users?[0].name
}

I suspect that the difference between the simulator and the actual phone is the Realm data for users has not finished downloading to the phone at the time you are dereferencing it.

Typically, one has to set up a notification handler on the query on the Realm in question, to check when the data has actually downloaded to the device. It is explained here.

I hope this was useful.

Richard Krueger

1 Like