NSMutableURLRequest

setTimeoutInterval:

Sets the receiver’s timeout interval, in seconds.

- (void)setTimeoutInterval:(NSTimeInterval) timeoutInterval
Parameters
timeoutInterval

The timeout interval, in seconds. If during a connection attempt the request remains idle for longer than the timeout interval, the request is considered to have timed out. The default timeout interval is 60 seconds.

Availability
  • Available in iOS 2.0 and later.


setHTTPMethod:

Sets the receiver’s HTTP request method.

- (void)setHTTPMethod:( NSString *) method
Parameters
method

The new HTTP request method. The default HTTP method is “GET”.



setCachePolicy:

Sets the cache policy of the receiver.

- (void)setCachePolicy:(NSURLRequestCachePolicy) policy
Parameters
policy

The new cache policy.


/*!

    @enum NSURLRequestCachePolicy


    @discussion The NSURLRequestCachePolicy enum defines constants that

    can be used to specify the type of interactions that take place with

    the caching system when the URL loading system processes a request.

    Specifically, these constants cover interactions that have to do

    with whether already-existing cache data is returned to satisfy a

    URL load request.


    @constant NSURLRequestUseProtocolCachePolicy Specifies that the

    caching logic defined in the protocol implementation, if any, is

    used for a particular URL load request. This is the default policy

    for URL load requests.


    @constant NSURLRequestReloadIgnoringLocalCacheData Specifies that the

    data for the URL load should be loaded from the origin source. No

    existing local cache data, regardless of its freshness or validity,

    should be used to satisfy a URL load request.


    @constant NSURLRequestReloadIgnoringLocalAndRemoteCacheData Specifies that

    not only should the local cache data be ignored, but that proxies and

    other intermediates should be instructed to disregard their caches

    so far as the protocol allows.  Unimplemented.


    @constant NSURLRequestReloadIgnoringCacheData Older name for

    NSURLRequestReloadIgnoringLocalCacheData.


    @constant NSURLRequestReturnCacheDataElseLoad Specifies that the

    existing cache data should be used to satisfy a URL load request,

    regardless of its age or expiration date. However, if there is no

    existing data in the cache corresponding to a URL load request,

    the URL is loaded from the origin source.


    @constant NSURLRequestReturnCacheDataDontLoad Specifies that the

    existing cache data should be used to satisfy a URL load request,

    regardless of its age or expiration date. However, if there is no

    existing data in the cache corresponding to a URL load request, no

    attempt is made to load the URL from the origin source, and the

    load is considered to have failed. This constant specifies a

    behavior that is similar to an "offline" mode.


    @constant NSURLRequestReloadRevalidatingCacheData Specifies that

    the existing cache data may be used provided the origin source

    confirms its validity, otherwise the URL is loaded from the

    origin source.  Unimplemented.

*/

enum

{

    NSURLRequestUseProtocolCachePolicy = 0,


    NSURLRequestReloadIgnoringLocalCacheData = 1,

    NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4, // Unimplemented

    NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData,


    NSURLRequestReturnCacheDataElseLoad = 2,

    NSURLRequestReturnCacheDataDontLoad = 3,


    NSURLRequestReloadRevalidatingCacheData = 5, // Unimplemented

};

typedef NSUInteger NSURLRequestCachePolicy;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值