WatchKit与MagicalRecord共享数据

时间:2015-04-07 09:16:49

标签: ios magicalrecord watchkit apple-watch

我使用下一代码在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的方法相同 有人知道我做错了吗?

0 个答案:

没有答案