Application: openFiles: individual files by groups

I need my application to detect how many files have been dumped to the dock icon. For this, I use the application: openFiles: method

- (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames
{
  NSLog(@"%d",[filenames count]);
}

But, unfortunately, files are sometimes divided into groups. So, for example, I dragged 3 files onto the dock icon and got this output:

2
1

How could this be?

+2
source share
1 answer

Unfortunately, this life. If you really need to count the number of files received when you switch to the dock icon, you need to set a timer to combine the results obtained by the call application:openFiles:within a second (or a certain period of time).

+2
source

All Articles