Jens, The code below doesn’t crash. To refine, what difference is there between ObjC’s for (NSURL* file in enumerator)
and swift’s while let file = enumerator?.nextObject() as? URL ? Jean > On 22 Oct 2016, at 20:55, Jens Alfke <j...@mooseyard.com> wrote: > > >> On Oct 22, 2016, at 11:42 AM, Jean Suisse <jean.li...@gmail.com> wrote: >> >> To add a little more information: it happens when encountering any directory >> that the user can’t read. >> My app should get an access denied error (the enumerator should be nil for >> instance). It shouldn’t crash. > > Try writing the same code in Objective-C and see what happens. (That could be > a workaround: implement this piece of functionality in Obj-C and then call > into it from your main Swift code.) > > —Jens > _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com