小编hma*_*ass的帖子

FinderSync扩展 - 永远不会调用requestBadgeIdentifierForURL

我已经测试了Xcode中提供的模板来制作FinderSync扩展.一切都很好,除了两件事:

a)当监视文件夹时,系统永远不会调用requestBadgeIdentifierForURL方法,因此不会设置标记.这里出了什么问题?我是正确的假设当我在Finder中移动或滚动受监视的文件夹时应该调用此方法?顺便说一句,在此上下文中正确调用beginObservingDirectoryAtURL和endObservingDirectoryAtURL方法.

#import "FinderSync.h"

@interface FinderSync ()

@property NSURL *myFolderURL;

@end

@implementation FinderSync

- (instancetype)init {
    self = [super init];

    NSLog(@"%s launched from %@ ; compiled at %s", __PRETTY_FUNCTION__, [[NSBundle mainBundle] bundlePath], __TIME__);

    // Set up the directory we are syncing.
    self.myFolderURL = [NSURL fileURLWithPath:@"/Users/hmaass/Downloads"];
    [FIFinderSyncController defaultController].directoryURLs = [NSSet setWithObject:self.myFolderURL];

    // Set up images for our badge identifiers. For demonstration purposes, this uses off-the-shelf images.
    [[FIFinderSyncController defaultController] setBadgeImage:[NSImage imageNamed: NSImageNameColorPanel] label:@"Status One" forBadgeIdentifier:@"One"];
    [[FIFinderSyncController defaultController] setBadgeImage:[NSImage imageNamed: NSImageNameCaution] label:@"Status Two" …
Run Code Online (Sandbox Code Playgroud)

xcode objective-c osx-yosemite findersync osx-extensions

4
推荐指数
1
解决办法
1139
查看次数