Dear All,

Running the code below, I get EXC_BAD_INSTRUCTION error. My questions are:

1. Why ?
2. How can I prevent it ?

Best regards,
Jean

CODE
====
        let directoryURL = URL(fileURLWithPath: "/.DocumentRevisions-V100/")
        let manager              = FileManager.default

        let keys = [URLResourceKey.nameKey, URLResourceKey.isDirectoryKey, 
URLResourceKey.isSymbolicLinkKey,
                    URLResourceKey.isVolumeKey, 
URLResourceKey.isPackageKey,URLResourceKey.isSystemImmutableKey,
                    URLResourceKey.isUserImmutableKey, 
URLResourceKey.isHiddenKey, URLResourceKey.volumeURLKey,
                    URLResourceKey.fileSizeKey, 
URLResourceKey.fileAllocatedSizeKey, URLResourceKey.totalFileSizeKey,
                    URLResourceKey.totalFileAllocatedSizeKey, 
URLResourceKey.contentModificationDateKey,
                    URLResourceKey.isAliasFileKey, 
URLResourceKey.creationDateKey]
        {
                url, error -> Bool in
                print(error.localizedDescription)
                return true
        }

        while let file = enumerator?.nextObject() as? URL       // 
EXC_BAD_INSTRUCTION HERE 
        {
                // ...
        }


ERROR
=====

The error occurs on the line:

        while let file = enumerator?.nextObject() as? URL

STACK TRACE
===========

0 static DateComponents._unconditionnalyBridgeFromObjectiveC(NSDateComponents?) 
-> DateComponents
1 thunk
2 -[NSURLDirectoryEnumerator nextObject]
3 AppDelegate.applicationDidFinishLaunching(Notification) -> () 


EXAMPLE APP
===========

Just past the code in a Swift Cocoa App in applicationDidFinishLaunching and 
run.




_______________________________________________

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

Reply via email to