简体   繁体   English

从OS X App挂载网络卷

[英]Mounting a network volume from OS X App

I'm trying to mount a network volume in a OS X App. 我正在尝试在OS X App中挂载网络卷。

I get it to work using the FSMountServerVolume function which is deprecated. 我使用不推荐使用的FSMountServerVolume函数来使其工作。 The documentation says "To mount a network volume, use NetFSMountURLAsync instead". 该文档说“要挂载网络卷,请改用NetFSMountURLAsync”。 But when I try to use this function I get the following error message: 但是,当我尝试使用此功能时,出现以下错误消息:

dyld: lazy symbol binding failed: Symbol not found: _NetFSMountURLSync  
Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/AppName-ammmlfwhvlfxkdburfmzioformdn/Build/Products/Debug/AppName.app/Contents/MacOS/AppName
Expected in: /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS

dyld: Symbol not found: _NetFSMountURLSync
Referenced from: /Users/username/Library/Developer/Xcode/DerivedData/AppName-ammmlfwhvlfxkdburfmzioformdn/Build/Products/Debug/AppName.app/Contents/MacOS/AppName
Expected in: /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS

Did I forget anything? 我忘记了什么吗? I imported the NetFS Framework. 我导入了NetFS Framework。

OK, it looks like NetFSMountURLSync() etc where introduced in 10.8. 好的,看起来像10.8中引入的NetFSMountURLSync()等。

From NetFS Changes : NetFS更改

Added AsyncRequestID
Added NetFSMountURLAsync()
Added NetFSMountURLBlock
Added NetFSMountURLCancel()
Added NetFSMountURLSync()
Added #def kNAUIOptionAllowUI
Added #def kNAUIOptionForceUI
Added #def kNAUIOptionKey
Added #def kNAUIOptionNoUI
Added #def kNetFSMountAtMountDirKey

Therefore you are going to have to use the "old way" in 10.7 and below and the "new way" in 10.8 and above. 因此,您将不得不在10.7和更低版本中使用“旧方法”,并在10.8和更高版本中使用“新方法”。 This means making the NetFS.framework optional rather than required and the need to perform various runtime checks to see which API you need to use. 这意味着使NetFS.framework 可选的而非必需的 ,并且需要执行各种运行时检查以查看需要使用哪个API。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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