This seems to be a case of Apple doing the right thing in a weird way. The docs say not to call this function from the main thread, but from a background thread:
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/index.html#//apple_ref/occ/instm/NSFileManager/URLForUbiquityContainerIdentifier:
(Url quoted because the : is part of it and hn-auto-linking won't include it.)From that first screenshot however he is calling it from the main thread, and their test system likely is built to trap that with a crash.