2013-07-31 19 views
1

我想在mac中訪問查找器左邊欄的共享內容,這樣我就可以將系統列表連接到同一網絡。我可以訪問最喜歡的內容,但無法成功訪問。如何訪問可可中的查找器側邊欄共享​​內容

我正在使用此代碼訪問取景器的最愛內容。

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 

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.fram ework /頭/ 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. 
+0

任何編碼嘗試? – Raptor

+0

是的,我通過使用來自http://stackoverflow.com/questions/10751199/how-to-get-finder-sidebar-favorites-content-cocoa的信息獲得收藏夾內容,但是/ System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSSharedFileList.h頭文件不提供有關共享內容的信息 – Surjeet

+0

在問題中顯示您的代碼請 – Raptor

回答

0

您可以使用kLSSharedFileListRecentServerItems獲取最近連接的網絡容量。