简体   繁体   中英

how to get mac share folder path on iOS

我正在开发一个应用程序,现在我使用openssh查找并可以访问我的mac的文件系统,我可以访问应用程序中的每个文件夹。这对我的计算机很危险,我想知道有什么方法只能获取我的应用程序中的共享文件夹,而不是每个文件夹。就像使用mac连接其他人的共享文件夹一样,只获取共享文件夹。我应该怎么做,我在想获取共享文件夹路径并将其用作参数,是对不对

You can use

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSSharedPublicDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [documentsDirectory stringByAppendingPathComponent:@"Playlist"];

if you want path of Documents directory replace first line by this

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM