gpt4 book ai didi

xcode - Objective-C的SMB卷挂载fsmountservervolumesync

转载 作者:行者123 更新时间:2023-12-02 10:45:40 25 4
gpt4 key购买 nike

我试图用发现here的代码以编程方式安装该卷

编译时出现此错误。

Ld /Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Products/Debug/SambaTestApp normal x86_64
cd "/Users/alex/Documents/Xcode Projects/SambaTestApp"
setenv MACOSX_DEPLOYMENT_TARGET 10.7
/Developer/usr/bin/clang -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.7.sdk -L/Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Products/Debug -F/Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Products/Debug -filelist /Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Intermediates/SambaTestApp.build/Debug/SambaTestApp.build/Objects-normal/x86_64/SambaTestApp.LinkFileList -mmacosx-version-min=10.7 -fobjc-arc -framework Foundation -o /Users/alex/Library/Developer/Xcode/DerivedData/SambaTestApp-bthesiirajzqwebkatfdkbgalpwc/Build/Products/Debug/SambaTestApp

Undefined symbols for architecture x86_64:
"_FSMountServerVolumeSync", referenced from:
_main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我的代码是:
#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{

@autoreleasepool {

NSString * user = @"user";
NSString * password = @"pass";
NSURL * url = [NSURL URLWithString: @"smb://lemon"];
NSURL * mountDir = [NSURL URLWithString: @"/review"];
OptionBits flags = 0;
OSStatus err = FSMountServerVolumeSync (
(__bridge CFURLRef) url,
(__bridge CFURLRef) mountDir,
(__bridge CFStringRef) user,
(__bridge CFStringRef) password,
NULL,
flags);

if(err != noErr)
NSLog( @"some kind of error in FSMountServerVolumeSync - %d", err );
}
return 0;
}

最佳答案

您需要链接到CoreServices框架。

关于xcode - Objective-C的SMB卷挂载fsmountservervolumesync,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10521945/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com