dimanche 12 avril 2015

Use core data in today widget


Vote count:

0




I'm building an app which also includes a today widget. This today widget should be able to read data from core data. I found a tutorial (http://weblog.invasivecode.com/post/108082269360/sharing-data-between-apps-and-their-extenstions) in the internet. Now I replaced this var:


lazy var applicationDocumentsDirectory: NSURL = { // The directory the application uses to store the Core Data store file. This code uses a directory named "Name.AppName" in the application's documents Application Support directory. let urls = NSFileManager.defaultManager().URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask) return urls[urls.count-1] as NSURL


for this var:



lazy var applicationDocumentsDirectory: NSURL? = {
lazy var applicationDocumentsDirectory: NSURL? = {
return NSFileManager.defaultManager().containerURLForSecurityApplicationGroupIdentifier("group.com.domain.appName") ?? nil
}()


I don't know why but now I get a few errors. The tutorial says it's all I have to do. But for me it's not working. Does someone of you guys know what I've done wrong and would like to help me?



asked 47 secs ago







Use core data in today widget

Aucun commentaire:

Enregistrer un commentaire