NSFILEMANAGER let group = "group.me.kimmett.pushthebutton" let manager = NSFileManager.defaultManager() if let dir = manager.containerURLForSecurityApplicationGroupIdentifier(group) { // do something with dir }
CORE DATA if let dir = manager.containerURLForSecurityApplicationGroupIdentifier(group) { let url = dir.URLByAppendingPathComponent(“Database.sqlite”) let coordinator = … coordinator.migratePersistentStore(store, toURL: url, options: nil, withType: NSSQLiteStoreType, error: &error) }
ONE WEIRD TRICK... “…you have to begin – and end, after two seconds – an empty background task right at the beginning of the delegate method.” — http://www.fiveminutewatchkit.com/blog/2015/3/11/one-weird- trick-to-fix-openparentapplicationreply
ONE WEIRD TRICK... var bogusTask: UIBackgroundTaskIdentifier bogusTask = application.beginBackgroundTaskWithExpirationHandler { application.endBackgroundTask(bogusTask) } let time = dispatch_time(DISPATCH_TIME_NOW, Int64(2 * Double(NSEC_PER_SEC))) dispatch_after(time, dispatch_get_main_queue(), { UIApplication.sharedApplication().endBackgroundTask(bogusTask) }) // do your actual work
REFERENCES ▸ “Core Data Relationships Data Loss Bug” by Michael Tsai http://mjtsai.com/blog/2014/11/22/core-data-relationships-data- loss-bug/ ▸ “Tap Distance” by David Smith http://david-smith.org/blog/2015/02/03/ailw-tap-distance/
REFERENCES ▸ “One weird trick to “fix” openParentApplication:reply:” by Brian Gilham http://www.fiveminutewatchkit.com/blog/2015/3/11/one-weird- trick-to-fix-openparentapplicationreply