Note that there are some explanatory texts on larger screens.

plurals
  1. POCore Data malfunctioning
    primarykey
    data
    text
    <p>This is a strange problem im getting every now and then. Im parsing a JSON and storing it into CoreData using several Entities. I save the data from the JSON and then I pull it to show it on a screen. The app works perfectly fine when it's launched from XCode, always. But when I open it any other time from the iPhone it sometimes, it only happens roughly once every 20 times, it doesnt show the data saved from the JSON, I beleive the problem is that the info saved in CoreData is corrupted some how, the dates specifically, sometimes I can get to see that the dates are null on screen.</p> <p>Here's how I save the dates</p> <pre><code>[event setValue:[df dateFromString:(NSString *)[key objectForKey:@"startSaleDate"]] forKey:@"dateStartSale"]; [event setValue:[df dateFromString:(NSString *)[key objectForKey:@"finishSaleDate"]] forKey:@"dateEndSale"]; </code></pre> <p>If I relauch the app, that is killing the app and launching it again, it all works perfectly again. The JSON is always correct, apparently it does the funky thing after some hours being installed in the phone. Does that make sense?</p> <p>Thanks.</p> <p>[UPDATE]</p> <p>I did some more testing. This is a difficult bug to catch because it only happens after several hours in the background. Figure out that the only problem is actually storing NSDates. Not the rest of data. After some time in the background it fails to save the NSDate, even though the JSON has a valid Date it stores null. And everytime I refresh it keeps on storing null. If I kill and launch the app it stores correctly the date. I tried using models but it happens the same thing.</p> <p>Any ideas? Im quite lost now.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload