objective-c - stringWithContentsOfURL 是否使用系统代理设置?

标签 objective-c cocoa macos proxy system

我使用以下代码来获取网页的内容,但它需要遵循用户系统首选项中定义的所有网络规则等

    NSURL *url = [NSURL URLWithString:@"http://thetalkingcloud.com/static/ping_desktop_app.php?v=1.0"];
    NSError *theNetworkError;
    NSString *content = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&theNetworkError];

具体来说,stringWithContentsOfURL是否使用系统范围的代理设置进行连接?(如果有任何定义)

最佳答案

我刚刚使用 stringWithContentsOfURL 在 Safari 和 Obj-C 程序之间进行了一些 tcpdump。 Safari 尊重我的代理,而 stringWithContentsOfURL 则不然。

关于objective-c - stringWithContentsOfURL 是否使用系统代理设置?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1549810/

相关文章:

objective-c - 如果两个字符串不相等,如何比较它们

ios - 什么时候使用分配

iphone - 请解释这个 Objective-C 代码

macos - 基于 View 的 NSOutlineView 拖放突出显示不正确

objective-c - 如何在 Mac 中使用 AVCaptureStillImageOutput 捕获屏幕

python - 我如何告诉 python3 寻找正确的模块?

php - 如何在 Mac OsX 10.7.3 上安装和运行 wkhtmltopdf 以便在 PHP 应用程序中使用

iOS : Determine code based on console log

objective-c - WKWebView 的打印内容 (OS X)

python - Xcode更新中断了gcloud和gsutil