有没有办法以编程方式连接到远程服务器从Cocoa? [英] Is there a way to programmatically connect to a remote server from Cocoa?

查看:208
本文介绍了有没有办法以编程方式连接到远程服务器从Cocoa?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个Coca / obj-C API调用来模仿Finder中的连接到服务器操作?这可能与Automater,所以似乎Finder有一个钩子在某个地方。

Is there an Coca/obj-C API call to mimic the "Connect to Server" action in Finder? It's possible with Automater, so it seems like Finder has a hook somewhere.

推荐答案

发现有一个旧的Carbon函数(找不到Cocoa等效函数) FSMountServerVolumeSync 这是我所寻找的。您可以提供 smb:// 网址和登录凭据。

Turns out there's an old Carbon function (can't find a Cocoa equivalent) called FSMountServerVolumeSync which does what I was looking for. You can supply and smb:// URL and login credentials.

文件管理器参考

OSStatus FSMountServerVolumeSync (
  CFURLRef url,
  CFURLRef mountDir,
  CFStringRef user,
  CFStringRef password,
  FSVolumeRefNum *mountedVolumeRefNum,
  OptionBits flags
);

这篇关于有没有办法以编程方式连接到远程服务器从Cocoa?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆