nsfilecoordinator

Load file in Today extension

a 夏天 提交于 2019-12-14 03:42:40
问题 I've been trying to create a Today extension that needs access to a .plist file in the documents directory. I have setup the App group for both the app and the extension. While I have seen examples for NSUserDefaults , I couldn't find anything for accessing files. I tried accessing the file like this (which works in the app itself) let paths = NSSearchPathForDirectoriesInDomains( .DocumentDirectory, .UserDomainMask, true) let documentsDirectory = paths[0] as String let filePath = "\

NSFilePresenter -presentedSubitemDidAppearAtURL: method never gets called

为君一笑 提交于 2019-12-04 17:45:29
问题 I have an object which conforms to NSFilePresenter protocol that represents my document-based application document package. When a new file is created inside the package, either programmatically using NSFileManager with proper NSFileCoordination methods or via Finder i only got -presentedSubitemDidChangeAtURL: event, but not seeming so obvious in this case -presentedSubitemDidAppearAtURL: . Is this an expected behavior or i am doing something wrong? The comments on