Greg Titus on NSFileCoordination and Extensions
Update 2014-12-01: TN-2408 explicitly says you shouldn’t use NSFileCoordination for app↔extension coordination:
Using file coordination in an app extension to access a container shared with its containing app may result in a deadlock. This is usually the case if a process is suspended mid coordinated I/O. This can be more prevalent on iOS where most apps will be suspended after a short period of time after being moved to the background. Extensions should use alternatives to file coordination.
NSFileCoordination does work for write/write app + extensions, btw, but you have to be extremely careful with add/remove file presenter.
— Greg Titus (@gregtitus) September 16, 2014
Extensions don't get viewWillDisappear when containing app is suspended so MUST remove file presenter before this happens or you'll hang app
— Greg Titus (@gregtitus) September 16, 2014
So in extension: add presenter/read-write/remove presenter within same run loop. This will coordinate with main app correctly.
— Greg Titus (@gregtitus) September 16, 2014