简体   繁体   中英

Mounting a network volume from OS X App

I'm trying to mount a network volume in a OS X App.

I get it to work using the FSMountServerVolume function which is deprecated. The documentation says "To mount a network volume, use NetFSMountURLAsync instead". 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.

OK, it looks like NetFSMountURLSync() etc where introduced in 10.8.

From NetFS Changes :

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. 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.

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