我使用下一代码在didFinishLaunchingWithOptions
(iOS应用)和awakeWithContext
(WatchKit)方法中设置CoreDataStack
lazy var sharedAppGroupDirectory: String = {
let fm = NSFileManager.defaultManager()
let appGroupName = "group.***"
let groupContainerURL = fm.containerURLForSecurityApplicationGroupIdentifier(appGroupName)
return groupContainerURL!.filePathURL!.absoluteString!
}()
var path = self.sharedAppGroupDirectory
path = "\(path)DataBase.sqlite"
MagicalRecord.setupCoreDataStackWithAutoMigratingSqliteStoreNamed(path)
但是为iOS应用程序调用Entity.MR_findAll()会返回我的行,但是我的WatchKit返回0 values
的方法相同
有人知道我做错了吗?