Sunday, November 8, 2026
HomeiOS Developmentios - Core knowledge not persisting knowledge on app clear from recents?

ios – Core knowledge not persisting knowledge on app clear from recents?

[ad_1]

On clear app from recents…values not persisting/saved domestically.

 func updateIsLiked(isLiked: Bool)
    {
        let managedContext = appDelegate.persistentContainer.viewContext
        let request : NSFetchRequest<NSFetchRequestResult> = NSFetchRequest.init(entityName: "DisplayHelper")
        do{
            request.predicate = NSPredicate(format: "sid = (array2[currentIndex].sid)")
            
            let outcomes = strive? managedContext.fetch(request)
           var obj = outcomes![0] as! NSManagedObject
            if isLiked
            {
                obj.setValue("sure", forKey: "isLiked")
              }
            else{
                obj.setValue("no", forKey: "isLiked")
            }
           
            strive? managedContext.save()
            strive? context.save()
            
            
        }catch{
            print("error fetching knowledge from context : (error.localizedDescription)")
        }
       
    }

As in gif i hooked up, I’ve preferred 3 audios. As soon as i clear an app, all preferred audios not there. All different knowledge was there, however up to date knowledge not there.

As in gif i attached, I have liked 3 audios. Once i clear an app, all liked audios not there. All other data was there, but updated data not there.

Thanks upfront.

[ad_2]

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments