Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 如何访问cocoa中的finder侧边栏共享内容_Macos_Cocoa_Shared Libraries_Finder - Fatal编程技术网

Macos 如何访问cocoa中的finder侧边栏共享内容

Macos 如何访问cocoa中的finder侧边栏共享内容,macos,cocoa,shared-libraries,finder,Macos,Cocoa,Shared Libraries,Finder,我想访问mac中finder左侧边栏的共享内容,以便将系统列表连接到同一网络。我可以访问喜爱的内容,但无法成功访问 我正在使用此代码访问finder最喜欢的内容 UInt32 seed; LSSharedFileListRef sflRef = LSSharedFileListCreate(NULL, kLSSharedFileListFavoriteItems,

我想访问mac中finder左侧边栏的共享内容,以便将系统列表连接到同一网络。我可以访问喜爱的内容,但无法成功访问

我正在使用此代码访问finder最喜欢的内容

UInt32 seed;
LSSharedFileListRef sflRef = LSSharedFileListCreate(NULL,
                                                    kLSSharedFileListFavoriteItems,
                                                    NULL);
CFArrayRef items = LSSharedFileListCopySnapshot( sflRef, &seed );
for( size_t i = 0; i < CFArrayGetCount(items); i++ )
{
    LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(items, i);
    if( !item )
        continue;
    CFURLRef outURL = NULL;
    LSSharedFileListItemResolve( item, kLSSharedFileListNoUserInteraction, (CFURLRef*) &outURL, NULL );
    if( !outURL )
        continue;
    //The actual path string of the item
    CFStringRef itemPath = CFURLCopyFileSystemPath(outURL,kCFURLPOSIXPathStyle);
    // TODO: Do whatever you want to do with your path here!!!!
    CFRelease(outURL);
    CFRelease(itemPath);
}
CFRelease(items);
CFRelease(sflRef);


Since i want to access systems available in shared network i change the key according to the key in the header file 

您可以使用kLSSharedFileListRecentServerItems获取最近连接的网络卷。

尝试过任何编码吗?是的,我通过使用/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSSharedFileList.h头文件中的任何可用键来获取收藏夹内容,但不提供有关的信息共享内容请在问题中显示您的代码
But i get nothing for shared content.

Can anyone help me for accessing this.
Thanks for your time to help me in advance.