How to create managedObjectContext using Swift 3 in Xcode 8?

前端 未结 5 2110
无人共我
无人共我 2020-11-27 03:13

Facing issue \"Value of type \'AppDelegate\' has no member \'managedObjectContext\' In new Xcode 8 (using Swift 3, iOS 10) when trying to create new context in View Controll

5条回答
  •  独厮守ぢ
    2020-11-27 03:31

    NSPersistentContainer has a viewContext property that is an NSManagedObjectContext type.

    As a side note, if you create a Master-Detail application in Xcode 8, Apple's sample code puts the managedObjectContext property in the MasterViewController.swift file and sets it by using said viewContext property in AppDelegate.

提交回复
热议问题