Here is my Realm Object:
PracticeAreaEntity {
id = 0;
c_id = 21871;
c_number = C.C/1/2016;
c_title = Title Here;
date = 2017-04-07T00:00:00.000Z;
description2 = ;
object = {"id":205039,"c_id":21871,"name":"07-04-2017","s_time":"2017-04-07T00:00:00.000Z","e_time":"2017-04-08T00:00:00.000Z","creator":"system","created_by_id":null,"description":null,"c_at":"2017-03-26T00:11:52.134Z","u_at":"2017-04-07T01:00:27.396Z","judge":null,"phearing":null,"google_event_id":null,"is_completed":false,"business":null,"last_notified":"2017-04-07T01:00:27.382Z","ng_date":null,"b_date":null,"b_d_available":false};
p_id = 205039;
subject = 07-04-2017;
type = Event;
}
I need to store this realm object to UserDefault.standard and get values back in another page. And here is my UserDefults code:
let userDefaults = UserDefaults.standard
userDefaults.set(filteredtotalContactArray[indexPath.row], forKey: "SelectedPractice")
userDefaults.synchronize()
filteredtotalContactArray[indexPath.row] equals to values that I have specified before as Realm Object. But I am getting error as
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Attempt to insert non-property list object