- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我在官方文档中看到,NSURLSessionConfiguration 和 NSURLRequest 共享一些相同或相似的属性。比如NSURLRequestCachePolicy、networkServiceType、timeOurInterval等等,怎么来的?哪一边的优先级更高?
最佳答案
根据 Apple Documentation :
An
NSURLSessionConfiguration
object defines the behavior and policies to use when uploading and downloading data using an NSURLSession object. When uploading or downloading data, creating a configuration object is always the first step you must take. You use this object to configure the timeout values, caching policies, connection requirements, and other types of information that you intend to use with yourNSURLSession
object.
重要的是:
NOTE
In some cases, the policies defined in this configuration may be overridden by policies specified by an
NSURLRequest
object provided for a task. Any policy specified on the request object is respected unless the session’s policy is more restrictive. For example, if the session configuration specifies that cellular networking should not be allowed, theNSURLRequest
object cannot request cellular networking.
所以,本质上,NSURLSessionConfiguration
设置了 NSURLSession
的属性,它可以被 NSURLRequest
对象覆盖。
关于ios - NSURLSessionConfiguration 和 NSURLRequest 的相同属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33316705/
我正在使用 NSURLRequest 发送帖子。 NSURL *url = [NSURL URLWithString:someUrlString]; NSMutableURLRequest *theR
当我从后台打开应用程序时,我需要访问服务器来获取一些数据。当我这样做时,我收到如下警报: "Request timed out" (nserror's localised description) 我
我遇到了一个奇怪的问题。我在我的设备上运行 iOS 4.3.2。在 Xcode 4 中编译,但我没有使用 iOS 5 beta SDK。 我的应用程序从服务器获取一个 plist 文件,该 plist
作为一名 iOS 开发新手,我正在尝试了解一些与 iOS 中回调机制相关的概念。 我的模型通过 NSURLRequest 向后端休息服务发出 HTTP 请求。该模型有几个与服务中的方法相对应的方法。
关闭。这个问题需要更多focused 。目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 8 年前。 Improve this qu
我正在使用 php 和 mysql 数据库开发 iOS 网络应用程序,我的问题是 nsurl 请求获取 php 文件的值没有响应并且不工作但是,我正在命令提示符 url 中打印并复制 url 粘贴并转
我正在尝试设置一个 NSURLRequest 来下载一个简单的 index.html 及其 externa style.css 表,但我不太确定该怎么做。我只是将请求的 URL 格式化为我想要的文件.
这个问题在这里已经有了答案: Managing multiple asynchronous NSURLConnection connections (13 个答案) 关闭 9 年前。
我有一个用 swift 编写的应用程序,它使用 PHP 与我的服务器通信。在我的整个测试过程中,该应用程序运行完美,直到我开始同时在多个设备上进行测试。当我尝试同时加载两个设备时,它会偶尔(不是 10
我创建了一个 NSURLRequest 和一个 NSURLConnection 对象,并在 NSMutableData 实例中收集数据。然后,我根据下载的数据创建一个 NSString 并获取如下所示
通常 http 用户代理是这样的: Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18
我正在使用 NSURLRequest 和 CachePolicy 在 NSData 中下载一个 plist。当我更改我的 plist 的内容时,我的应用程序忽略了这一点并仍然显示缓存的内容。缓存持续多
Cocoa 中的NSURLRequest 类(iOS docs,OS X docs)有一个timeoutInterval 属性。文档状态 If during a connection attempt
我对 NSURLRequest(和伴奏)实现进行了尝试和测试,这对给定 URL 的 GET 和 POST 非常有效。 但是,我现在想在不更改应用程序使用的 URL 的情况下移动 URL 的目标,因此我
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 已关闭 9 年前。 此问题似乎偏离主题,因为缺乏足够的信息来诊断问题。更详细地描述您的问题或 include
当使用NSURLRequest时在 iPhone 上,各种设备之间的实际性能差异是什么 NSURLRequestCachePolicy设置?我特别感兴趣的是缓存策略对用户对 UIWebView 页面显
我关注了A Cocoa application driven by HTTP data博客文章,并已能够成功使用以下 URL 获取 HTML 以在我的示例应用程序中使用: http://www.arg
我想要使用 HTTP POST 方法来与 ASPX 页面进行通信。我需要通过表单变量传递值。 如何在 Objective-C 上实现它? 最佳答案 http://www.cimgf.com/2010/
大家早上好, 我一直在尝试编写一个应用程序,从需要身份验证的远程 Web 服务执行一些 GET 操作。我的主要问题是大多数远程服务器(而且有很多)没有有效的证书。我有code to accept th
我在 iOS 应用程序中有一个 Angular Web 构建,并且想要 POST使用一些 JSON 向 native 层请求我可以用它来构建一些 native 功能。我正在使用旧的 UIWebView
我是一名优秀的程序员,十分优秀!