The DirectoryMonitor update block retains self, meaning that there's a retain cycle. We need to break this retain cycle to ensure that directory monitors automatically stop and are cleaned up when they go out of scope. Unfortunately, it seems that EonilFSEventStream doesn't retain it's self reference before calling its completion block, meaning that the newly released self can disappear before calling the callback block, leading to a crash.
The
DirectoryMonitor
update block retainsself
, meaning that there's a retain cycle. We need to break this retain cycle to ensure that directory monitors automatically stop and are cleaned up when they go out of scope. Unfortunately, it seems thatEonilFSEventStream
doesn't retain it's self reference before calling its completion block, meaning that the newly released self can disappear before calling the callback block, leading to a crash.