views:

19

answers:

1

I need that my application detect how many files has been dropped to it dock icon. For this i use application:openFiles: method

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

But unfortunately files sometimes separates by group. So, for example i dragged 3 files to dock icon and get this output:

2
1

How could it be?

A: 

Unfortunately that's life. If you really need to count the number of files received in a drop to the Dock icon, you need to set up a timer to combine the results received by the call application:openFiles: within a second (or some appropriate length of time.)

Yuji