• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/


  • Subject: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • From: Jean Suisse <email@hidden>
  • Date: Sat, 22 Oct 2016 21:15:21 +0200

I forgot the code:

	NSURL* directoryURL = [NSURL URLWithString:@"/.DocumentRevisions-V100/"];
	NSFileManager* manager = [NSFileManager defaultManager];
	NSArray* keys = @[NSURLNameKey, NSURLIsDirectoryKey];

	NSDirectoryEnumerator* enumerator = [manager enumeratorAtURL:directoryURL includingPropertiesForKeys:keys options:NSDirectoryEnumerationSkipsSubdirectoryDescendants errorHandler:^BOOL(NSURL *url, NSError *error){return true; }];

	for (NSURL* file in enumerator)
	{

	}


> On 22 Oct 2016, at 21:11, Jean Suisse <email@hidden> wrote:
>
> 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 <email@hidden <mailto:email@hidden>> wrote:
>>
>>
>>> On Oct 22, 2016, at 11:42 AM, Jean Suisse <email@hidden <mailto:email@hidden>> 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 (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


References: 
 >EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Jean Suisse <email@hidden>)
 >Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Quincey Morris <email@hidden>)
 >Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Jean Suisse <email@hidden>)
 >Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Jens Alfke <email@hidden>)
 >Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Jean Suisse <email@hidden>)
 >Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Jean Suisse <email@hidden>)
 >Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Jens Alfke <email@hidden>)
 >Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/ (From: Jean Suisse <email@hidden>)

  • Prev by Date: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • Next by Date: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • Previous by thread: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • Next by thread: Re: EXC_BAD_INSTRUCTION when enumerating /.DocumentRevisions-V100/
  • Index(es):
    • Date
    • Thread