0xced / iOS-Artwork-Extractor

Extract iOS artwork and emoji symbols into png files, generate glossy buttons png files

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exception with Xcode 6 Beta

aentan opened this issue · comments

commented

Trying to extract iOS 8 assets. Doesn't quite work.

App will open in iOS Simulator Version 8.0 (541), but it crashes as soon as you tap any save button.

Quick fix because -[AppDelegate homeDirectory] isn't working properly and it looks like the simulator stops you trying to write outside of potential iOS sandbox. Just replace this in AppDelegate.m:

- (NSString *) saveDirectory:(NSString *)subDirectory
{
    NSString *saveDirectory = NSProcessInfo.processInfo.environment[@"ARTWORK_DIRECTORY"];

    if (!saveDirectory)
    {
        saveDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
    }
    if (subDirectory)
        saveDirectory = [saveDirectory stringByAppendingPathComponent:subDirectory];

    if (![[NSFileManager defaultManager] fileExistsAtPath:saveDirectory])
    {
        NSError *error = nil;
        BOOL created = [[NSFileManager defaultManager] createDirectoryAtPath:saveDirectory withIntermediateDirectories:YES attributes:nil error:&error];
        if (!created)
            NSLog(@"%@\n%@", error, error.userInfo);
    }

    NSLog(@"Saving to: %@", saveDirectory);

    return saveDirectory;
}

It logs the directory where it saves to so you can find it.