OSUR 10.9中不推荐使用CFURLGetFSRef

kil*_*k52 6 macos finder

我正在尝试使用代码在Finder侧栏中添加带有图标的文件夹.

CFURLRef url = (__bridge CFURLRef)[NSURL fileURLWithPath:path];
IconRef iconRef;
FSRef fref;

CFURLRef iconURLRef = (__bridge CFURLRef)[NSURL fileURLWithPath:@"/pathTo/icon.icns"];
CFURLGetFSRef(iconURLRef, &fref);
RegisterIconRefFromFSRef('SSBL', 'ssic', &fref, &iconRef);

// Create a reference to the shared file list.
LSSharedFileListRef favoriteItems = LSSharedFileListCreate(NULL,
                                                           kLSSharedFileListFavoriteItems, NULL);
if (favoriteItems) {
    //Insert an item to the list.
    LSSharedFileListItemRef item = LSSharedFileListInsertItemURL(favoriteItems,
                                                                 kLSSharedFileListItemBeforeFirst, NULL, iconRef,
                                                                 url, NULL, NULL);
    if (item){
        CFRelease(item);
    }
}

CFRelease(favoriteItems);
Run Code Online (Sandbox Code Playgroud)

但是警告显示:CFURLGetFSRef已被弃用:首先在OS X中弃用10.9
所以替代品是什么?