简体   繁体   中英

Fetch from core data and display it in tableview in swift 5

How to fetch saved data from core data? How to debug it? I have called the fetch from view will appear.. 在此处输入图像描述

在此处输入图像描述

How to fetch saved data from core data? How to debug it? I have called the fetch from view will appear.. 在此处输入图像描述

在此处输入图像描述

As per your comments on Ashish's response, it seems like you are not saving the managed object context after inserting the records.

Insertion process:

  1. Fresh launch app, initialize core data and insert data in DB
  2. Call managedObjectContext.save and check if the save operation is successful or got failure.

Then notify the view controller to refresh the weather list using NSNotification on the main thread or some other mechanism as per your suitability.

And then try to fetch weathers from viewContext for UI rendering.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM