Ahmed Karmous
Ahmed Karmous

Reputation: 373

ios save data on offline mode

I m working on a doctor application that have a web part and an iOS part I have patients and for each patient i have consultations I have made a one to many relationship in mysql database in the web part that include putting the id of the patient in the consultation table so each patient have many consultations and each consultation have only one patient the problem is in my iOS application in the first view i parse the patients from the database put them in a table view and when i clic on each patient i go to another view where i fetch his consultation by his id

here is where the problem come

when i add a patient from the application and i m offline so it been added on the core data sqllite his id is equal to 0 so when i want to add him consultation by his id i cant

i have to send it via a web service so he can get an id an then i can add him consultation i need to find a way to add him an id and don't get confused with the id mysql base from the web part !!

i hope that there is someone who understood my problem :)

Upvotes: 0

Views: 208

Answers (1)

Chris
Chris

Reputation: 8020

I know I'm not supposed to post a link, but I'm gonna go out on a limb and do it anyway. Andrew Culver talks about this exact issue in this iOSonRails conference talk from 2013. At about 27:30 he starts talking about offline mode. Hope this helps https://www.youtube.com/watch?v=t3URYsv9nVY#t=1661 . Basically you assign them with a local ID that your web-app then assigns a proper ID to.

Upvotes: 1

Related Questions