objective-ccocoansfilecoordinator

NSFilePresenter -presentedSubitemDidAppearAtURL: method never gets called


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 -presentedSubitemDidAppearAtURL: in NSFilePresenter state it clear:

Be notified that a file or directory contained by the directory has been added. If this method is not implemented but -presentedItemDidChange is, and the directory is actually a file package, then the file coordination machinery will invoke -presentedItemDidChange instead.


Solution

  • After struggling with this exact issue for quite a while, I opened a technical support issue with Apple. Their response was that this is a bug, and the only thing we can do right now is to do everything through -presentedSubitemDidChangeAtURL:.

    I would encourage anyone encountering this issue to file a bug (https://bugreport.apple.com) to encourage Apple to get this problem fixed as soon as possible.