ActiveResourceKit  v1.2 (498.0)
 All Classes Files Functions Variables Typedefs Enumerator Properties Macros Pages
ARURLConnectionDelegate.h
Go to the documentation of this file.
1 // ActiveResourceKit ARURLConnectionDelegate.h
2 //
3 // Copyright © 2012, Roy Ratcliffe, Pioneering Software, United Kingdom
4 //
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the “Software”), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 //
12 // The above copyright notice and this permission notice shall be included in
13 // all copies or substantial portions of the Software.
14 //
15 // THE SOFTWARE IS PROVIDED “AS IS,” WITHOUT WARRANTY OF ANY KIND, EITHER
16 // EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO
18 // EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
19 // OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 // DEALINGS IN THE SOFTWARE.
22 //
23 //------------------------------------------------------------------------------
24 
25 #import <Foundation/Foundation.h>
26 
27 @class ARHTTPResponse;
28 
29 /*!
30  * @brief Implements a simple connection delegate designed for collecting the
31  * response, including the body data, and for working around SSL challenges.
32  */
33 @interface ARURLConnectionDelegate : NSObject
34 // Connection delegate is Data or non-Data according to platform. Mac OS X and
35 // iOS diverge with respect to URL connection delegate protocols. iOS divides up
36 // the protocol by inheritance whereas OS X combines all the delegate methods
37 // into one big protocol. On iOS, the connection "data" delegate protocol
38 // inherits from the connection delegate protocol. The Active Resource Kit
39 // connection delegate, used by delegated connections, implements both plain
40 // connection and data-oriented protocols. Adjust the definition according to
41 // target: either OS X or iOS.
42 #if __MAC_OS_X_VERSION_MIN_REQUIRED
43 <NSURLConnectionDelegate>
44 #endif
45 #if __IPHONE_OS_VERSION_MIN_REQUIRED
46 <NSURLConnectionDataDelegate>
47 #endif
48 
49 @property(copy) void (^completionHandler)(ARHTTPResponse *response, NSError *error);
50 @property(strong) NSURLResponse *response;
51 @property(strong) NSMutableData *data;
52 
53 @end