The problem with your image only, image is nil, So I have modified this method:
- (void)scaleIcons:(NSString *)outputPath :(NSURL *)nomeImmagine
{
//NSImage *image = [NSImage imageNamed:[NSString stringWithFormat:@"%@",nomeImmagine]]; commented this part
//start modification
NSImage *image = [[NSImage alloc] initWithContentsOfFile:[[nomeImmagine path] autorelease]];
if (!image)
image = [[NSWorkspace sharedWorkspace] iconForFile:[nomeImmagine path]];
//end modification
NSSize outputSize = NSMakeSize(512.0f,512.0f);
NSImage *anImage = [self scaleImage:image toSize:outputSize];
NSString *finalPath = [outputPath stringByAppendingString:@"/icon_512x512.png"];
NSData *imageData = [anImage TIFFRepresentation];
NSBitmapImageRep *rep = [NSBitmapImageRep imageRepWithData:imageData];
NSData *dataToWrite = [rep representationUsingType:NSPNGFileType properties:nil];
[dataToWrite writeToFile:finalPath atomically:NO];
}
Try This , it worked for me..