swift3 - iOS Swift Storing Realm Object to UserDefaults.standard -


here 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 store realm object userdefault.standard , values in page. , here userdefults code:

let userdefaults = userdefaults.standard userdefaults.set(filteredtotalcontactarray[indexpath.row], forkey: "selectedpractice") userdefaults.synchronize() 

filteredtotalcontactarray[indexpath.row] equals values have specified before realm object. getting error

terminating app due uncaught exception 'nsinvalidargumentexception', reason: 'attempt insert non-property list object  

you'll need supply conformance methods nscoding realm models in order able persist them userdefaults.

however, i'd encourage use realm persist realm models given you're using realm in app.


Comments

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

java - How to implement an entity bound odata action in olingo v4.3 -