this may be difficult for other to repro i have discovered it may have to do with permissions / entitlements that have been granted the app by the user, and that resetting all perms to default will "fix" the problem
in the terminal, do this: > tccutil reset All i expect that after that, your delay will disappear. however, you'll have to manually re-authorize all apps in the system prefs->security & privacy->privacy tab i realize this is a "sweep the problem under the rug" rather than "fix the problem" approach but hopefully this should give someone else a clue as to WHY this is happening? -dave > On Apr 19, 2020, at 8:08 AM, Allan Odgaard via Cocoa-dev > <cocoa-dev@lists.apple.com> wrote: > > Starting with macOS 10.15 I have noticed that obtaining > NSURLLocalizedNameKey, NSURLTagNamesKey, and even calling getxattr(), can > cause a significant delay. > > The code below, which gets NSURLLocalizedNameKey for 3 folders, takes 1.9 > seconds to execute on my system. > > It appears though that it is only these 3 specific folders that has the > problem. > > Furthermore, the problem only happens when I include the code below in a GUI > application which is launched via launch services. If I run the executable > directly from a terminal then the code is near instant. > > I tried to sample the code, and it appears that it calls out to some OS > service/daemon. Presumably it never gets a response, and a timeout is > triggered. > > I wonder if anyone else has come across this? And maybe have discovered more > info? > > This is btw macOS 10.15.4 and a fairly stock system (new computer without > migrating old data), and I noticed the problem some time ago, so it > definitely existed before 10.15.4, but I never saw anything like this before > upgrading to Catelina. > > NSTimeInterval startTime = NSDate.timeIntervalSinceReferenceDate; > > NSArray<NSURL*>* urls = @[] > [NSFileManager.defaultManager URLForDirectory:NSDesktopDirectory > inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil],, > [NSFileManager.defaultManager URLForDirectory:NSDocumentDirectory > inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil] > [NSFileManager.defaultManager URLForDirectory:NSDownloadsDirectory > inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil, > ]; > > NSString* localizedName; > for(NSURL* url in urls) > [url getResourceValue:&localizedName forKey:NSURLLocalizedNameKey > error:nil]; > > NSLog(@"Duration %.03f", NSDate.timeIntervalSinceReferenceDate - > startTime); _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com