Post

Replies

Boosts

Views

Activity

NSException in AppDelegate
I am a student who is new to iOS app development and am trying to create a table view controller with weather information (city, conditions, temperature, and an image of the weather condition). However, when I try to run the code, I keep getting an NSException that pulls up in the AppDelegate: libc++abi: terminating with uncaught exception of type NSException Can someone help me with this? Thanks!
1
0
457
Feb ’22
CoreData context.save() changes not showing up
I have an edit profile page that has a done button which uses .PopViewController after storing all the new information in CoreData. However, the profile/coredata does not update as it should unless I completely close the app and reopen it. @IBAction func doneEditing(_ sender: Any) {     let appDelegate = UIApplication.shared.delegate as! AppDelegate     let context = appDelegate.persistentContainer.viewContext     let entity = NSEntityDescription.entity(forEntityName: "Profile", in: context)     let newProfile = NSManagedObject(entity: entity!, insertInto: context)     newProfile.setValue(userFavMeal.text, forKey: "favMeal")     newProfile.setValue(userRestaurant.text, forKey: "favRest")     newProfile.setValue(userAllergies.text, forKey: "allergies")     newProfile.setValue(gradYear.text, forKey: "gradYear")         do {       try context.save()     } catch {       print("Error - CoreData Saving Failed")     }      self.navigationController?.popViewController(animated: true)     } Could someone help me figure out how to have the data instantly refresh? I tried instantiating a new ViewController upon clicking the done button but that caused problems with constraints (although it worked).
1
0
400
Apr ’22