Giter Club home page Giter Club logo

directoryenumerator's Introduction

I'm attempting to use an NSDirectoryEnumerator created via NSFileManager's enumeratorAtURL method. The enumerator returned fails to enumerate any paths and crashes the app when it is released. I've reduced the code the following:

- (void)enumerateResources {
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSDirectoryEnumerator *enumerator  = [fileManager enumeratorAtURL:[[NSBundle mainBundle] resourceURL] 
                                           includingPropertiesForKeys:NULL 
                                                              options:NSDirectoryEnumerationSkipsSubdirectoryDescendants
                                                         errorHandler:nil];
    NSAssert(enumerator != nil, @"enumerator is nil");

    id pathname;
    for(pathname in enumerator) {
        NSLog(@"%@", pathname);
    }
}

When that method is run I get the following backtrace and the message, "GDB: Interrupted":

#0  0x022a3b00 in CFRelease ()
#1  0x000aef94 in -[NSURLDirectoryEnumerator dealloc] ()
#2  0x022a3acc in CFRelease ()
#3  0x022c8bcd in _CFAutoreleasePoolPop ()
#4  0x0000a99f in -[NSAutoreleasePool release] ()
#5  0x002baf84 in _UIApplicationHandleEvent ()
#6  0x02bf2afa in PurpleEventCallback ()
#7  0x0236ddc4 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ ()
#8  0x022ce737 in __CFRunLoopDoSource1 ()
#9  0x022cb9c3 in __CFRunLoopRun ()
#10 0x022cb280 in CFRunLoopRunSpecific ()
#11 0x022cb1a1 in CFRunLoopRunInMode ()
#12 0x002b3226 in -[UIApplication _run] ()
#13 0x002beb58 in UIApplicationMain ()
#14 0x00001fb4 in main (argc=1, argv=0xbfffef98) at /Users/wmoore/Source/DirectoryEnumerator/main.m:14

This project reproduces the problem.

If anyone has any suggestions they would be most welcome, otherwise I will submit a ticket to (open)radar. Its worth noting that using enumeratorAtPath works fine.

directoryenumerator's People

Contributors

wezm avatar

Stargazers

 avatar

Watchers

 avatar James Cloos avatar  avatar

directoryenumerator's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.