EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
- Subject: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
- From: Jean Suisse <email@hidden>
- Date: Sat, 22 Oct 2016 19:43:37 +0200
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 (email@hidden)
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:
This email sent to email@hidden