Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

The persistent store container: Swift

Hello so I'm building my first app using core data and have project setup questions, I've already followed along to a video and am trying to build a similar app as the demo I watched.

I manually created the core data stack and am not sure how to approach completing the persistentContainer.

I've searched and i am not sure how to log the error to start ( Any place in particular I could look to figure this out)? Secondly I know I need to notify the user if an error occurs and was thinking of approaching the situation as follows:

In the launchScreenViewController file (I'm referring to the first view controller that will appear on the screen for the app opens.

  1. embedding the view controller in a navigation controller
  2. importing the UserNotifications framework
  3. making the launchScreenViewController class conform to the UNUserNotificationCenterDelegate
  4. Adding a variable stored property inside the VC class to hold the access status of the notifications
  5. inside view did load requesting authorization as soon as thew app view is loaded

My thought process is this, in order to send an alert/ notification about the persistent store container not working I need to first get access from the user to send notifications correct????

When setting up error handling should I create an enum with all the error options that may occur while trying to initialize the persistent store container? In the app demo we called fatal error but was told not to ship an application this way.

am I heading in the right direction with my though process and set up ?