diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/AFNetworking/AFHTTPClient.h b/AFNetworking/AFHTTPClient.h deleted file mode 100755 index 72bc6c3..0000000 --- a/AFNetworking/AFHTTPClient.h +++ /dev/null @@ -1,595 +0,0 @@ -// AFHTTPClient.h -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -#import - -/** - `AFHTTPClient` captures the common patterns of communicating with an web application over HTTP. It encapsulates information like base URL, authorization credentials, and HTTP headers, and uses them to construct and manage the execution of HTTP request operations. - - ## Automatic Content Parsing - - Instances of `AFHTTPClient` may specify which types of requests it expects and should handle by registering HTTP operation classes for automatic parsing. Registered classes will determine whether they can handle a particular request, and then construct a request operation accordingly in `enqueueHTTPRequestOperationWithRequest:success:failure`. - - ## Subclassing Notes - - In most cases, one should create an `AFHTTPClient` subclass for each website or web application that your application communicates with. It is often useful, also, to define a class method that returns a singleton shared HTTP client in each subclass, that persists authentication credentials and other configuration across the entire application. - - ## Methods to Override - - To change the behavior of all url request construction for an `AFHTTPClient` subclass, override `requestWithMethod:path:parameters`. - - To change the behavior of all request operation construction for an `AFHTTPClient` subclass, override `HTTPRequestOperationWithRequest:success:failure`. - - ## Default Headers - - By default, `AFHTTPClient` sets the following HTTP headers: - - - `Accept-Language: (comma-delimited preferred languages), en-us;q=0.8` - - `User-Agent: (generated user agent)` - - You can override these HTTP headers or define new ones using `setDefaultHeader:value:`. - - ## URL Construction Using Relative Paths - - Both `-requestWithMethod:path:parameters:` and `-multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:` construct URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`. Below are a few examples of how `baseURL` and relative paths interact: - - NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; - [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo - [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz - [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo - [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo - [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/ - [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/ - - Also important to note is that a trailing slash will be added to any `baseURL` without one, which would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash. - - ## NSCoding / NSCopying Conformance - - `AFHTTPClient` conforms to the `NSCoding` and `NSCopying` protocols, allowing operations to be archived to disk, and copied in memory, respectively. There are a few minor caveats to keep in mind, however: - - - Archives and copies of HTTP clients will be initialized with an empty operation queue. - - NSCoding cannot serialize / deserialize block properties, so an archive of an HTTP client will not include any reachability callback block that may be set. - */ - -#ifdef _SYSTEMCONFIGURATION_H -typedef enum { - AFNetworkReachabilityStatusUnknown = -1, - AFNetworkReachabilityStatusNotReachable = 0, - AFNetworkReachabilityStatusReachableViaWWAN = 1, - AFNetworkReachabilityStatusReachableViaWiFi = 2, -} AFNetworkReachabilityStatus; -#else - #warning SystemConfiguration framework not found in project, or not included in precompiled header. Network reachability functionality will not be available. -#endif - -#ifndef __UTTYPE__ - #if __IPHONE_OS_VERSION_MIN_REQUIRED - #warning MobileCoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available. - #else - #warning CoreServices framework not found in project, or not included in precompiled header. Automatic MIME type detection when uploading files in multipart requests will not be available. - #endif -#endif - -typedef enum { - AFFormURLParameterEncoding, - AFJSONParameterEncoding, - AFPropertyListParameterEncoding, -} AFHTTPClientParameterEncoding; - -@class AFHTTPRequestOperation; -@protocol AFMultipartFormData; - -@interface AFHTTPClient : NSObject - -///--------------------------------------- -/// @name Accessing HTTP Client Properties -///--------------------------------------- - -/** - The url used as the base for paths specified in methods such as `getPath:parameters:success:failure` - */ -@property (readonly, nonatomic, strong) NSURL *baseURL; - -/** - The string encoding used in constructing url requests. This is `NSUTF8StringEncoding` by default. - */ -@property (nonatomic, assign) NSStringEncoding stringEncoding; - -/** - The `AFHTTPClientParameterEncoding` value corresponding to how parameters are encoded into a request body. This is `AFFormURLParameterEncoding` by default. - - @warning Some nested parameter structures, such as a keyed array of hashes containing inconsistent keys (i.e. `@{@"": @[@{@"a" : @(1)}, @{@"b" : @(2)}]}`), cannot be unambiguously represented in query strings. It is strongly recommended that an unambiguous encoding, such as `AFJSONParameterEncoding`, is used when posting complicated or nondeterministic parameter structures. - */ -@property (nonatomic, assign) AFHTTPClientParameterEncoding parameterEncoding; - -/** - The operation queue which manages operations enqueued by the HTTP client. - */ -@property (readonly, nonatomic, strong) NSOperationQueue *operationQueue; - -/** - The reachability status from the device to the current `baseURL` of the `AFHTTPClient`. - - @warning This property requires the `SystemConfiguration` framework. Add it in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). - */ -#ifdef _SYSTEMCONFIGURATION_H -@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; -#endif - -///--------------------------------------------- -/// @name Creating and Initializing HTTP Clients -///--------------------------------------------- - -/** - Creates and initializes an `AFHTTPClient` object with the specified base URL. - - @param url The base URL for the HTTP client. This argument must not be `nil`. - - @return The newly-initialized HTTP client - */ -+ (instancetype)clientWithBaseURL:(NSURL *)url; - -/** - Initializes an `AFHTTPClient` object with the specified base URL. - - @param url The base URL for the HTTP client. This argument must not be `nil`. - - @discussion This is the designated initializer. - - @return The newly-initialized HTTP client - */ -- (id)initWithBaseURL:(NSURL *)url; - -///----------------------------------- -/// @name Managing Reachability Status -///----------------------------------- - -/** - Sets a callback to be executed when the network availability of the `baseURL` host changes. - - @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`. - - @warning This method requires the `SystemConfiguration` framework. Add it in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). - */ -#ifdef _SYSTEMCONFIGURATION_H -- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block; -#endif - -///------------------------------- -/// @name Managing HTTP Operations -///------------------------------- - -/** - Attempts to register a subclass of `AFHTTPRequestOperation`, adding it to a chain to automatically generate request operations from a URL request. - - @param operationClass The subclass of `AFHTTPRequestOperation` to register - - @return `YES` if the registration is successful, `NO` otherwise. The only failure condition is if `operationClass` is not a subclass of `AFHTTPRequestOperation`. - - @discussion When `enqueueHTTPRequestOperationWithRequest:success:failure` is invoked, each registered class is consulted in turn to see if it can handle the specific request. The first class to return `YES` when sent a `canProcessRequest:` message is used to create an operation using `initWithURLRequest:` and do `setCompletionBlockWithSuccess:failure:`. There is no guarantee that all registered classes will be consulted. Classes are consulted in the reverse order of their registration. Attempting to register an already-registered class will move it to the top of the list. - */ -- (BOOL)registerHTTPOperationClass:(Class)operationClass; - -/** - Unregisters the specified subclass of `AFHTTPRequestOperation` from the chain of classes consulted when `-requestWithMethod:path:parameters` is called. - - @param operationClass The subclass of `AFHTTPRequestOperation` to register - */ -- (void)unregisterHTTPOperationClass:(Class)operationClass; - -///---------------------------------- -/// @name Managing HTTP Header Values -///---------------------------------- - -/** - Returns the value for the HTTP headers set in request objects created by the HTTP client. - - @param header The HTTP header to return the default value for - - @return The default value for the HTTP header, or `nil` if unspecified - */ -- (NSString *)defaultValueForHeader:(NSString *)header; - -/** - Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header. - - @param header The HTTP header to set a default value for - @param value The value set as default for the specified header, or `nil - */ -- (void)setDefaultHeader:(NSString *)header - value:(NSString *)value; - -/** - Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header. - - @param username The HTTP basic auth username - @param password The HTTP basic auth password - */ -- (void)setAuthorizationHeaderWithUsername:(NSString *)username - password:(NSString *)password; - -/** - Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a token-based authentication value, such as an OAuth access token. This overwrites any existing value for this header. - - @param token The authentication token - */ -- (void)setAuthorizationHeaderWithToken:(NSString *)token; - - -/** - Clears any existing value for the "Authorization" HTTP header. - */ -- (void)clearAuthorizationHeader; - -///------------------------------- -/// @name Managing URL Credentials -///------------------------------- - -/** - Set the default URL credential to be set for request operations. - - @param credential The URL credential - */ -- (void)setDefaultCredential:(NSURLCredential *)credential; - -///------------------------------- -/// @name Creating Request Objects -///------------------------------- - -/** - Creates an `NSMutableURLRequest` object with the specified HTTP method and path. - - If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body. - - @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`. - @param path The path to be appended to the HTTP client's base URL and used as the request URL. If `nil`, no path will be appended to the base URL. - @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body. - - @return An `NSMutableURLRequest` object - */ -- (NSMutableURLRequest *)requestWithMethod:(NSString *)method - path:(NSString *)path - parameters:(NSDictionary *)parameters; - -/** - Creates an `NSMutableURLRequest` object with the specified HTTP method and path, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2 - - @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`. - @param path The path to be appended to the HTTP client's base URL and used as the request URL. - @param parameters The parameters to be encoded and set in the request HTTP body. - @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. This can be used to upload files, encode HTTP body as JSON or XML, or specify multiple values for the same parameter, as one might for array values. - - @discussion Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream. - - @return An `NSMutableURLRequest` object - */ -- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method - path:(NSString *)path - parameters:(NSDictionary *)parameters - constructingBodyWithBlock:(void (^)(id formData))block; - -///------------------------------- -/// @name Creating HTTP Operations -///------------------------------- - -/** - Creates an `AFHTTPRequestOperation`. - - In order to determine what kind of operation is created, each registered subclass conforming to the `AFHTTPClient` protocol is consulted (in reverse order of when they were specified) to see if it can handle the specific request. The first class to return `YES` when sent a `canProcessRequest:` message is used to generate an operation using `HTTPRequestOperationWithRequest:success:failure:`. - - @param urlRequest The request object to be loaded asynchronously during execution of the operation. - @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request. - @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred. - */ -- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; - -///---------------------------------------- -/// @name Managing Enqueued HTTP Operations -///---------------------------------------- - -/** - Enqueues an `AFHTTPRequestOperation` to the HTTP client's operation queue. - - @param operation The HTTP request operation to be enqueued. - */ -- (void)enqueueHTTPRequestOperation:(AFHTTPRequestOperation *)operation; - -/** - Cancels all operations in the HTTP client's operation queue whose URLs match the specified HTTP method and path. - - @param method The HTTP method to match for the cancelled requests, such as `GET`, `POST`, `PUT`, or `DELETE`. If `nil`, all request operations with URLs matching the path will be cancelled. - @param path The path appended to the HTTP client base URL to match against the cancelled requests. If `nil`, no path will be appended to the base URL. - - @discussion This method only cancels `AFHTTPRequestOperations` whose request URL matches the HTTP client base URL with the path appended. For complete control over the lifecycle of enqueued operations, you can access the `operationQueue` property directly, which allows you to, for instance, cancel operations filtered by a predicate, or simply use `-cancelAllRequests`. Note that the operation queue may include non-HTTP operations, so be sure to check the type before attempting to directly introspect an operation's `request` property. - */ -- (void)cancelAllHTTPOperationsWithMethod:(NSString *)method path:(NSString *)path; - -///--------------------------------------- -/// @name Batching HTTP Request Operations -///--------------------------------------- - -/** - Creates and enqueues an `AFHTTPRequestOperation` to the HTTP client's operation queue for each specified request object into a batch. When each request operation finishes, the specified progress block is executed, until all of the request operations have finished, at which point the completion block also executes. - - @param urlRequests The `NSURLRequest` objects used to create and enqueue operations. - @param progressBlock A block object to be executed upon the completion of each request operation in the batch. This block has no return value and takes two arguments: the number of operations that have already finished execution, and the total number of operations. - @param completionBlock A block object to be executed upon the completion of all of the request operations in the batch. This block has no return value and takes a single argument: the batched request operations. - - @discussion Operations are created by passing the specified `NSURLRequest` objects in `requests`, using `-HTTPRequestOperationWithRequest:success:failure:`, with `nil` for both the `success` and `failure` parameters. - */ -- (void)enqueueBatchOfHTTPRequestOperationsWithRequests:(NSArray *)urlRequests - progressBlock:(void (^)(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations))progressBlock - completionBlock:(void (^)(NSArray *operations))completionBlock; - -/** - Enqueues the specified request operations into a batch. When each request operation finishes, the specified progress block is executed, until all of the request operations have finished, at which point the completion block also executes. - - @param operations The request operations used to be batched and enqueued. - @param progressBlock A block object to be executed upon the completion of each request operation in the batch. This block has no return value and takes two arguments: the number of operations that have already finished execution, and the total number of operations. - @param completionBlock A block object to be executed upon the completion of all of the request operations in the batch. This block has no return value and takes a single argument: the batched request operations. - */ -- (void)enqueueBatchOfHTTPRequestOperations:(NSArray *)operations - progressBlock:(void (^)(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations))progressBlock - completionBlock:(void (^)(NSArray *operations))completionBlock; - -///--------------------------- -/// @name Making HTTP Requests -///--------------------------- - -/** - Creates an `AFHTTPRequestOperation` with a `GET` request, and enqueues it to the HTTP client's operation queue. - - @param path The path to be appended to the HTTP client's base URL and used as the request URL. - @param parameters The parameters to be encoded and appended as the query string for the request URL. - @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request. - @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred. - - @see -HTTPRequestOperationWithRequest:success:failure: - */ -- (void)getPath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; - -/** - Creates an `AFHTTPRequestOperation` with a `POST` request, and enqueues it to the HTTP client's operation queue. - - @param path The path to be appended to the HTTP client's base URL and used as the request URL. - @param parameters The parameters to be encoded and set in the request HTTP body. - @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request. - @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred. - - @see -HTTPRequestOperationWithRequest:success:failure: - */ -- (void)postPath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; - -/** - Creates an `AFHTTPRequestOperation` with a `PUT` request, and enqueues it to the HTTP client's operation queue. - - @param path The path to be appended to the HTTP client's base URL and used as the request URL. - @param parameters The parameters to be encoded and set in the request HTTP body. - @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request. - @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred. - - @see -HTTPRequestOperationWithRequest:success:failure: - */ -- (void)putPath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; - -/** - Creates an `AFHTTPRequestOperation` with a `DELETE` request, and enqueues it to the HTTP client's operation queue. - - @param path The path to be appended to the HTTP client's base URL and used as the request URL. - @param parameters The parameters to be encoded and appended as the query string for the request URL. - @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request. - @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred. - - @see -HTTPRequestOperationWithRequest:success:failure: - */ -- (void)deletePath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; - -/** - Creates an `AFHTTPRequestOperation` with a `PATCH` request, and enqueues it to the HTTP client's operation queue. - - @param path The path to be appended to the HTTP client's base URL and used as the request URL. - @param parameters The parameters to be encoded and set in the request HTTP body. - @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request. - @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred. - - @see -HTTPRequestOperationWithRequest:success:failure: - */ -- (void)patchPath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; -@end - -///---------------- -/// @name Constants -///---------------- - -/** - ### Network Reachability - - The following constants are provided by `AFHTTPClient` as possible network reachability statuses. - - enum { - AFNetworkReachabilityStatusUnknown, - AFNetworkReachabilityStatusNotReachable, - AFNetworkReachabilityStatusReachableViaWWAN, - AFNetworkReachabilityStatusReachableViaWiFi, - } - - `AFNetworkReachabilityStatusUnknown` - The `baseURL` host reachability is not known. - - `AFNetworkReachabilityStatusNotReachable` - The `baseURL` host cannot be reached. - - `AFNetworkReachabilityStatusReachableViaWWAN` - The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS. - - `AFNetworkReachabilityStatusReachableViaWiFi` - The `baseURL` host can be reached via a Wi-Fi connection. - - ### Keys for Notification UserInfo Dictionary - - Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification. - - `AFNetworkingReachabilityNotificationStatusItem` - A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification. - The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status. - - ### Parameter Encoding - - The following constants are provided by `AFHTTPClient` as possible methods for serializing parameters into query string or message body values. - - enum { - AFFormURLParameterEncoding, - AFJSONParameterEncoding, - AFPropertyListParameterEncoding, - } - - `AFFormURLParameterEncoding` - Parameters are encoded into field/key pairs in the URL query string for `GET` `HEAD` and `DELETE` requests, and in the message body otherwise. Dictionary keys are sorted with the `caseInsensitiveCompare:` selector of their description, in order to mitigate the possibility of ambiguous query strings being generated non-deterministically. See the warning for the `parameterEncoding` property for additional information. - - `AFJSONParameterEncoding` - Parameters are encoded into JSON in the message body. - - `AFPropertyListParameterEncoding` - Parameters are encoded into a property list in the message body. - */ - -///---------------- -/// @name Functions -///---------------- - -/** - Returns a query string constructed by a set of parameters, using the specified encoding. - - @param parameters The parameters used to construct the query string - @param encoding The encoding to use in constructing the query string. If you are uncertain of the correct encoding, you should use UTF-8 (`NSUTF8StringEncoding`), which is the encoding designated by RFC 3986 as the correct encoding for use in URLs. - - @discussion Query strings are constructed by collecting each key-value pair, percent escaping a string representation of the key-value pair, and then joining the pairs with "&". - - If a query string pair has a an `NSArray` for its value, each member of the array will be represented in the format `field[]=value1&field[]value2`. Otherwise, the pair will be formatted as "field=value". String representations of both keys and values are derived using the `-description` method. The constructed query string does not include the ? character used to delimit the query component. - - @return A percent-escaped query string - */ -extern NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *parameters, NSStringEncoding encoding); - -///-------------------- -/// @name Notifications -///-------------------- - -/** - Posted when network reachability changes. - This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability. - - @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). - */ -#ifdef _SYSTEMCONFIGURATION_H -extern NSString * const AFNetworkingReachabilityDidChangeNotification; -extern NSString * const AFNetworkingReachabilityNotificationStatusItem; -#endif - -#pragma mark - - -extern NSUInteger const kAFUploadStream3GSuggestedPacketSize; -extern NSTimeInterval const kAFUploadStream3GSuggestedDelay; - -/** - The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPClient -multipartFormRequestWithMethod:path:parameters:constructingBodyWithBlock:`. - */ -@protocol AFMultipartFormData - -/** - Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary. - - @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`. - @param name The name to be associated with the specified data. This parameter must not be `nil`. - @param error If an error occurs, upon return contains an `NSError` object that describes the problem. - - @return `YES` if the file data was successfully appended, otherwise `NO`. - - @discussion The filename and MIME type for this data in the form will be automatically generated, using `NSURLResponse` `-suggestedFilename` and `-MIMEType`, respectively. - */ -- (BOOL)appendPartWithFileURL:(NSURL *)fileURL - name:(NSString *)name - error:(NSError * __autoreleasing *)error; - -/** - Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary. - - @param data The data to be encoded and appended to the form data. - @param name The name to be associated with the specified data. This parameter must not be `nil`. - @param filename The filename to be associated with the specified data. This parameter must not be `nil`. - @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`. - */ -- (void)appendPartWithFileData:(NSData *)data - name:(NSString *)name - fileName:(NSString *)fileName - mimeType:(NSString *)mimeType; - -/** - Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary. - - @param data The data to be encoded and appended to the form data. - @param name The name to be associated with the specified data. This parameter must not be `nil`. - */ - -- (void)appendPartWithFormData:(NSData *)data - name:(NSString *)name; - -/** - Appends HTTP headers, followed by the encoded data and the multipart form boundary. - - @param headers The HTTP headers to be appended to the form data. - @param body The data to be encoded and appended to the form data. - */ -- (void)appendPartWithHeaders:(NSDictionary *)headers - body:(NSData *)body; - -/** - Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream. - - @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 32kb. - @param delay Duration of delay each time a packet is read. By default, no delay is set. - - @discussion When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, as of iOS 6, there is no definite way to distinguish between a 3G, EDGE, or LTE connection. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth. - */ -- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes - delay:(NSTimeInterval)delay; - -@end diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m deleted file mode 100755 index 903ee9b..0000000 --- a/AFNetworking/AFHTTPClient.m +++ /dev/null @@ -1,1265 +0,0 @@ -// AFHTTPClient.m -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import - -#import "AFHTTPClient.h" -#import "AFHTTPRequestOperation.h" - -#import - -#ifdef _SYSTEMCONFIGURATION_H - #import - #import - #import - #import - #import -#endif - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - #import -#endif - -#ifdef _SYSTEMCONFIGURATION_H -NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change"; -NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem"; - -typedef SCNetworkReachabilityRef AFNetworkReachabilityRef; -typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status); -#else -typedef id AFNetworkReachabilityRef; -#endif - -typedef void (^AFCompletionBlock)(void); - -static NSString * AFBase64EncodedStringFromString(NSString *string) { - NSData *data = [NSData dataWithBytes:[string UTF8String] length:[string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]]; - NSUInteger length = [data length]; - NSMutableData *mutableData = [NSMutableData dataWithLength:((length + 2) / 3) * 4]; - - uint8_t *input = (uint8_t *)[data bytes]; - uint8_t *output = (uint8_t *)[mutableData mutableBytes]; - - for (NSUInteger i = 0; i < length; i += 3) { - NSUInteger value = 0; - for (NSUInteger j = i; j < (i + 3); j++) { - value <<= 8; - if (j < length) { - value |= (0xFF & input[j]); - } - } - - static uint8_t const kAFBase64EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - NSUInteger idx = (i / 3) * 4; - output[idx + 0] = kAFBase64EncodingTable[(value >> 18) & 0x3F]; - output[idx + 1] = kAFBase64EncodingTable[(value >> 12) & 0x3F]; - output[idx + 2] = (i + 1) < length ? kAFBase64EncodingTable[(value >> 6) & 0x3F] : '='; - output[idx + 3] = (i + 2) < length ? kAFBase64EncodingTable[(value >> 0) & 0x3F] : '='; - } - - return [[NSString alloc] initWithData:mutableData encoding:NSASCIIStringEncoding]; -} - -static NSString * AFPercentEscapedQueryStringPairMemberFromStringWithEncoding(NSString *string, NSStringEncoding encoding) { - static NSString * const kAFCharactersToBeEscaped = @":/?&=;+!@#$()~'"; - static NSString * const kAFCharactersToLeaveUnescaped = @"[]."; - - return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, (__bridge CFStringRef)kAFCharactersToLeaveUnescaped, (__bridge CFStringRef)kAFCharactersToBeEscaped, CFStringConvertNSStringEncodingToEncoding(encoding)); -} - -#pragma mark - - -@interface AFQueryStringPair : NSObject -@property (readwrite, nonatomic, strong) id field; -@property (readwrite, nonatomic, strong) id value; - -- (id)initWithField:(id)field value:(id)value; - -- (NSString *)URLEncodedStringValueWithEncoding:(NSStringEncoding)stringEncoding; -@end - -@implementation AFQueryStringPair -@synthesize field = _field; -@synthesize value = _value; - -- (id)initWithField:(id)field value:(id)value { - self = [super init]; - if (!self) { - return nil; - } - - self.field = field; - self.value = value; - - return self; -} - -- (NSString *)URLEncodedStringValueWithEncoding:(NSStringEncoding)stringEncoding { - if (!self.value || [self.value isEqual:[NSNull null]]) { - return AFPercentEscapedQueryStringPairMemberFromStringWithEncoding([self.field description], stringEncoding); - } else { - return [NSString stringWithFormat:@"%@=%@", AFPercentEscapedQueryStringPairMemberFromStringWithEncoding([self.field description], stringEncoding), AFPercentEscapedQueryStringPairMemberFromStringWithEncoding([self.value description], stringEncoding)]; - } -} - -@end - -#pragma mark - - -extern NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary); -extern NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value); - -NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *parameters, NSStringEncoding stringEncoding) { - NSMutableArray *mutablePairs = [NSMutableArray array]; - for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { - [mutablePairs addObject:[pair URLEncodedStringValueWithEncoding:stringEncoding]]; - } - - return [mutablePairs componentsJoinedByString:@"&"]; -} - -NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) { - return AFQueryStringPairsFromKeyAndValue(nil, dictionary); -} - -NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) { - NSMutableArray *mutableQueryStringComponents = [NSMutableArray array]; - - if ([value isKindOfClass:[NSDictionary class]]) { - // Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries - NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(caseInsensitiveCompare:)]; - [[[value allKeys] sortedArrayUsingDescriptors:[NSArray arrayWithObject:sortDescriptor]] enumerateObjectsUsingBlock:^(id nestedKey, __unused NSUInteger idx, __unused BOOL *stop) { - id nestedValue = [value objectForKey:nestedKey]; - if (nestedValue) { - [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)]; - } - }]; - } else if ([value isKindOfClass:[NSArray class]]) { - NSArray *array = value; - [array enumerateObjectsUsingBlock:^(id nestedValue, __unused NSUInteger idx, __unused BOOL *stop) { - [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)]; - }]; - } else { - [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]]; - } - - return mutableQueryStringComponents; -} - -@interface AFStreamingMultipartFormData : NSObject -- (id)initWithURLRequest:(NSMutableURLRequest *)urlRequest - stringEncoding:(NSStringEncoding)encoding; - -- (NSMutableURLRequest *)requestByFinalizingMultipartFormData; -@end - -#pragma mark - - -@interface AFHTTPClient () -@property (readwrite, nonatomic, strong) NSURL *baseURL; -@property (readwrite, nonatomic, strong) NSMutableArray *registeredHTTPOperationClassNames; -@property (readwrite, nonatomic, strong) NSMutableDictionary *defaultHeaders; -@property (readwrite, nonatomic, strong) NSURLCredential *defaultCredential; -@property (readwrite, nonatomic, strong) NSOperationQueue *operationQueue; -#ifdef _SYSTEMCONFIGURATION_H -@property (readwrite, nonatomic, assign) AFNetworkReachabilityRef networkReachability; -@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; -@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock; -#endif - -#ifdef _SYSTEMCONFIGURATION_H -- (void)startMonitoringNetworkReachability; -- (void)stopMonitoringNetworkReachability; -#endif -@end - -@implementation AFHTTPClient -@synthesize baseURL = _baseURL; -@synthesize stringEncoding = _stringEncoding; -@synthesize parameterEncoding = _parameterEncoding; -@synthesize registeredHTTPOperationClassNames = _registeredHTTPOperationClassNames; -@synthesize defaultHeaders = _defaultHeaders; -@synthesize defaultCredential = _defaultCredential; -@synthesize operationQueue = _operationQueue; -#ifdef _SYSTEMCONFIGURATION_H -@synthesize networkReachability = _networkReachability; -@synthesize networkReachabilityStatus = _networkReachabilityStatus; -@synthesize networkReachabilityStatusBlock = _networkReachabilityStatusBlock; -#endif - -+ (instancetype)clientWithBaseURL:(NSURL *)url { - return [[self alloc] initWithBaseURL:url]; -} - -- (id)initWithBaseURL:(NSURL *)url { - NSParameterAssert(url); - - self = [super init]; - if (!self) { - return nil; - } - - // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected - if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) { - url = [url URLByAppendingPathComponent:@""]; - } - - self.baseURL = url; - - self.stringEncoding = NSUTF8StringEncoding; - self.parameterEncoding = AFFormURLParameterEncoding; - - self.registeredHTTPOperationClassNames = [NSMutableArray array]; - - self.defaultHeaders = [NSMutableDictionary dictionary]; - - // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 - NSString *preferredLanguageCodes = [[NSLocale preferredLanguages] componentsJoinedByString:@", "]; - [self setDefaultHeader:@"Accept-Language" value:[NSString stringWithFormat:@"%@, en-us;q=0.8", preferredLanguageCodes]]; - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 - [self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)]]; -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) - [self setDefaultHeader:@"User-Agent" value:[NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]]; -#endif - -#ifdef _SYSTEMCONFIGURATION_H - self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown; - [self startMonitoringNetworkReachability]; -#endif - - self.operationQueue = [[NSOperationQueue alloc] init]; - [self.operationQueue setMaxConcurrentOperationCount:NSOperationQueueDefaultMaxConcurrentOperationCount]; - - return self; -} - -- (void)dealloc { -#ifdef _SYSTEMCONFIGURATION_H - [self stopMonitoringNetworkReachability]; -#endif -} - -- (NSString *)description { - return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, defaultHeaders: %@, registeredOperationClasses: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.defaultHeaders, self.registeredHTTPOperationClassNames, self.operationQueue]; -} - -#pragma mark - - -#ifdef _SYSTEMCONFIGURATION_H -static BOOL AFURLHostIsIPAddress(NSURL *url) { - struct sockaddr_in sa_in; - struct sockaddr_in6 sa_in6; - - return [url host] && (inet_pton(AF_INET, [[url host] UTF8String], &sa_in) == 1 || inet_pton(AF_INET6, [[url host] UTF8String], &sa_in6) == 1); -} - -static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) { - BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0); - BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0); - BOOL isNetworkReachable = (isReachable && !needsConnection); - - AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown; - if (isNetworkReachable == NO) { - status = AFNetworkReachabilityStatusNotReachable; - } -#if TARGET_OS_IPHONE - else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { - status = AFNetworkReachabilityStatusReachableViaWWAN; - } -#endif - else { - status = AFNetworkReachabilityStatusReachableViaWiFi; - } - - return status; -} - -static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) { - AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); - AFNetworkReachabilityStatusBlock block = (__bridge AFNetworkReachabilityStatusBlock)info; - if (block) { - block(status); - } - - dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:[NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:status] forKey:AFNetworkingReachabilityNotificationStatusItem]]; - }); -} - -static const void * AFNetworkReachabilityRetainCallback(const void *info) { - return (__bridge_retained const void *)([(__bridge AFNetworkReachabilityStatusBlock)info copy]); -} - -static void AFNetworkReachabilityReleaseCallback(const void *info) { - if (info) { - CFRelease(info); - } -} - -- (void)startMonitoringNetworkReachability { - [self stopMonitoringNetworkReachability]; - - if (!self.baseURL) { - return; - } - - self.networkReachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [[self.baseURL host] UTF8String]); - - if (!self.networkReachability) { - return; - } - - __weak __typeof(&*self)weakSelf = self; - AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) { - __strong __typeof(&*weakSelf)strongSelf = weakSelf; - if (!strongSelf) { - return; - } - - strongSelf.networkReachabilityStatus = status; - if (strongSelf.networkReachabilityStatusBlock) { - strongSelf.networkReachabilityStatusBlock(status); - } - }; - - SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; - SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context); - SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), (CFStringRef)NSRunLoopCommonModes); - - /* Network reachability monitoring does not establish a baseline for IP addresses as it does for hostnames, so if the base URL host is an IP address, the initial reachability callback is manually triggered. - */ - if (AFURLHostIsIPAddress(self.baseURL)) { - SCNetworkReachabilityFlags flags; - SCNetworkReachabilityGetFlags(self.networkReachability, &flags); - dispatch_async(dispatch_get_main_queue(), ^{ - AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); - callback(status); - }); - } -} - -- (void)stopMonitoringNetworkReachability { - if (_networkReachability) { - SCNetworkReachabilityUnscheduleFromRunLoop(_networkReachability, CFRunLoopGetMain(), (CFStringRef)NSRunLoopCommonModes); - CFRelease(_networkReachability); - _networkReachability = NULL; - } -} - -- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block { - self.networkReachabilityStatusBlock = block; -} -#endif - -#pragma mark - - -- (BOOL)registerHTTPOperationClass:(Class)operationClass { - if (![operationClass isSubclassOfClass:[AFHTTPRequestOperation class]]) { - return NO; - } - - NSString *className = NSStringFromClass(operationClass); - [self.registeredHTTPOperationClassNames removeObject:className]; - [self.registeredHTTPOperationClassNames insertObject:className atIndex:0]; - - return YES; -} - -- (void)unregisterHTTPOperationClass:(Class)operationClass { - NSString *className = NSStringFromClass(operationClass); - [self.registeredHTTPOperationClassNames removeObject:className]; -} - -#pragma mark - - -- (NSString *)defaultValueForHeader:(NSString *)header { - return [self.defaultHeaders valueForKey:header]; -} - -- (void)setDefaultHeader:(NSString *)header value:(NSString *)value { - [self.defaultHeaders setValue:value forKey:header]; -} - -- (void)setAuthorizationHeaderWithUsername:(NSString *)username password:(NSString *)password { - NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", username, password]; - [self setDefaultHeader:@"Authorization" value:[NSString stringWithFormat:@"Basic %@", AFBase64EncodedStringFromString(basicAuthCredentials)]]; -} - -- (void)setAuthorizationHeaderWithToken:(NSString *)token { - [self setDefaultHeader:@"Authorization" value:[NSString stringWithFormat:@"Token token=\"%@\"", token]]; -} - -- (void)clearAuthorizationHeader { - [self.defaultHeaders removeObjectForKey:@"Authorization"]; -} - -#pragma mark - - -- (NSMutableURLRequest *)requestWithMethod:(NSString *)method - path:(NSString *)path - parameters:(NSDictionary *)parameters -{ - NSParameterAssert(method); - - if (!path) { - path = @""; - } - - NSURL *url = [NSURL URLWithString:path relativeToURL:self.baseURL]; - NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; - [request setHTTPMethod:method]; - [request setAllHTTPHeaderFields:self.defaultHeaders]; - - if (parameters) { - if ([method isEqualToString:@"GET"] || [method isEqualToString:@"HEAD"] || [method isEqualToString:@"DELETE"]) { - url = [NSURL URLWithString:[[url absoluteString] stringByAppendingFormat:[path rangeOfString:@"?"].location == NSNotFound ? @"?%@" : @"&%@", AFQueryStringFromParametersWithEncoding(parameters, self.stringEncoding)]]; - [request setURL:url]; - } else { - NSString *charset = (__bridge NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(self.stringEncoding)); - NSError *error = nil; - - switch (self.parameterEncoding) { - case AFFormURLParameterEncoding:; - [request setValue:[NSString stringWithFormat:@"application/x-www-form-urlencoded; charset=%@", charset] forHTTPHeaderField:@"Content-Type"]; - [request setHTTPBody:[AFQueryStringFromParametersWithEncoding(parameters, self.stringEncoding) dataUsingEncoding:self.stringEncoding]]; - break; - case AFJSONParameterEncoding:; - [request setValue:[NSString stringWithFormat:@"application/json; charset=%@", charset] forHTTPHeaderField:@"Content-Type"]; - [request setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:0 error:&error]]; - break; - case AFPropertyListParameterEncoding:; - [request setValue:[NSString stringWithFormat:@"application/x-plist; charset=%@", charset] forHTTPHeaderField:@"Content-Type"]; - [request setHTTPBody:[NSPropertyListSerialization dataWithPropertyList:parameters format:NSPropertyListXMLFormat_v1_0 options:0 error:&error]]; - break; - } - - if (error) { - NSLog(@"%@ %@: %@", [self class], NSStringFromSelector(_cmd), error); - } - } - } - - return request; -} - -- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method - path:(NSString *)path - parameters:(NSDictionary *)parameters - constructingBodyWithBlock:(void (^)(id formData))block -{ - NSParameterAssert(method); - NSParameterAssert(![method isEqualToString:@"GET"] && ![method isEqualToString:@"HEAD"]); - - NSMutableURLRequest *request = [self requestWithMethod:method path:path parameters:nil]; - - __block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:request stringEncoding:self.stringEncoding]; - - if (parameters) { - for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { - NSData *data = nil; - if ([pair.value isKindOfClass:[NSData class]]) { - data = pair.value; - } else if ([pair.value isEqual:[NSNull null]]) { - data = [NSData data]; - } else { - data = [[pair.value description] dataUsingEncoding:self.stringEncoding]; - } - - if (data) { - [formData appendPartWithFormData:data name:[pair.field description]]; - } - } - } - - if (block) { - block(formData); - } - - return [formData requestByFinalizingMultipartFormData]; -} - -- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ - AFHTTPRequestOperation *operation = nil; - NSString *className = nil; - NSEnumerator *enumerator = [self.registeredHTTPOperationClassNames reverseObjectEnumerator]; - while (!operation && (className = [enumerator nextObject])) { - Class op_class = NSClassFromString(className); - if (op_class && [op_class canProcessRequest:urlRequest]) { - operation = [(AFHTTPRequestOperation *)[op_class alloc] initWithRequest:urlRequest]; - } - } - - if (!operation) { - operation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; - } - - [operation setCompletionBlockWithSuccess:success failure:failure]; - - operation.credential = self.defaultCredential; - - return operation; -} - -#pragma mark - - -- (void)enqueueHTTPRequestOperation:(AFHTTPRequestOperation *)operation { - [self.operationQueue addOperation:operation]; -} - -- (void)cancelAllHTTPOperationsWithMethod:(NSString *)method - path:(NSString *)path -{ - NSString *URLStringToMatched = [[[self requestWithMethod:(method ?: @"GET") path:path parameters:nil] URL] absoluteString]; - - for (NSOperation *operation in [self.operationQueue operations]) { - if (![operation isKindOfClass:[AFHTTPRequestOperation class]]) { - continue; - } - - BOOL hasMatchingMethod = !method || [method isEqualToString:[[(AFHTTPRequestOperation *)operation request] HTTPMethod]]; - BOOL hasMatchingURL = [[[[(AFHTTPRequestOperation *)operation request] URL] absoluteString] isEqualToString:URLStringToMatched]; - - if (hasMatchingMethod && hasMatchingURL) { - [operation cancel]; - } - } -} - -- (void)enqueueBatchOfHTTPRequestOperationsWithRequests:(NSArray *)urlRequests - progressBlock:(void (^)(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations))progressBlock - completionBlock:(void (^)(NSArray *operations))completionBlock -{ - NSMutableArray *mutableOperations = [NSMutableArray array]; - for (NSURLRequest *request in urlRequests) { - AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:nil failure:nil]; - [mutableOperations addObject:operation]; - } - - [self enqueueBatchOfHTTPRequestOperations:mutableOperations progressBlock:progressBlock completionBlock:completionBlock]; -} - -- (void)enqueueBatchOfHTTPRequestOperations:(NSArray *)operations - progressBlock:(void (^)(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations))progressBlock - completionBlock:(void (^)(NSArray *operations))completionBlock -{ - __block dispatch_group_t dispatchGroup = dispatch_group_create(); - NSBlockOperation *batchedOperation = [NSBlockOperation blockOperationWithBlock:^{ - dispatch_group_notify(dispatchGroup, dispatch_get_main_queue(), ^{ - if (completionBlock) { - completionBlock(operations); - } - }); -#if !OS_OBJECT_USE_OBJC - dispatch_release(dispatchGroup); -#endif - }]; - - for (AFHTTPRequestOperation *operation in operations) { - AFCompletionBlock originalCompletionBlock = [operation.completionBlock copy]; - __weak AFHTTPRequestOperation *weakOperation = operation; - operation.completionBlock = ^{ - dispatch_queue_t queue = weakOperation.successCallbackQueue ?: dispatch_get_main_queue(); - dispatch_group_async(dispatchGroup, queue, ^{ - if (originalCompletionBlock) { - originalCompletionBlock(); - } - - __block NSUInteger numberOfFinishedOperations = 0; - [operations enumerateObjectsUsingBlock:^(id obj, __unused NSUInteger idx, __unused BOOL *stop) { - if ([(NSOperation *)obj isFinished]) { - numberOfFinishedOperations++; - } - }]; - - if (progressBlock) { - progressBlock(numberOfFinishedOperations, [operations count]); - } - - dispatch_group_leave(dispatchGroup); - }); - }; - - dispatch_group_enter(dispatchGroup); - [batchedOperation addDependency:operation]; - } - [self.operationQueue addOperations:operations waitUntilFinished:NO]; - [self.operationQueue addOperation:batchedOperation]; -} - -#pragma mark - - -- (void)getPath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ - NSURLRequest *request = [self requestWithMethod:@"GET" path:path parameters:parameters]; - AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; - [self enqueueHTTPRequestOperation:operation]; -} - -- (void)postPath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ - NSURLRequest *request = [self requestWithMethod:@"POST" path:path parameters:parameters]; - AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; - [self enqueueHTTPRequestOperation:operation]; -} - -- (void)putPath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ - NSURLRequest *request = [self requestWithMethod:@"PUT" path:path parameters:parameters]; - AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; - [self enqueueHTTPRequestOperation:operation]; -} - -- (void)deletePath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ - NSURLRequest *request = [self requestWithMethod:@"DELETE" path:path parameters:parameters]; - AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; - [self enqueueHTTPRequestOperation:operation]; -} - -- (void)patchPath:(NSString *)path - parameters:(NSDictionary *)parameters - success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ - NSURLRequest *request = [self requestWithMethod:@"PATCH" path:path parameters:parameters]; - AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; - [self enqueueHTTPRequestOperation:operation]; -} - -#pragma mark - NSCoding - -- (id)initWithCoder:(NSCoder *)aDecoder { - NSURL *baseURL = [aDecoder decodeObjectForKey:@"baseURL"]; - - self = [self initWithBaseURL:baseURL]; - if (!self) { - return nil; - } - - self.stringEncoding = [aDecoder decodeIntegerForKey:@"stringEncoding"]; - self.parameterEncoding = [aDecoder decodeIntegerForKey:@"parameterEncoding"]; - self.registeredHTTPOperationClassNames = [aDecoder decodeObjectForKey:@"registeredHTTPOperationClassNames"]; - self.defaultHeaders = [aDecoder decodeObjectForKey:@"defaultHeaders"]; - - return self; -} - -- (void)encodeWithCoder:(NSCoder *)aCoder { - [aCoder encodeObject:self.baseURL forKey:@"baseURL"]; - [aCoder encodeInteger:(NSInteger)self.stringEncoding forKey:@"stringEncoding"]; - [aCoder encodeInteger:self.parameterEncoding forKey:@"parameterEncoding"]; - [aCoder encodeObject:self.registeredHTTPOperationClassNames forKey:@"registeredHTTPOperationClassNames"]; - [aCoder encodeObject:self.defaultHeaders forKey:@"defaultHeaders"]; -} - -#pragma mark - NSCopying - -- (id)copyWithZone:(NSZone *)zone { - AFHTTPClient *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL]; - - HTTPClient.stringEncoding = self.stringEncoding; - HTTPClient.parameterEncoding = self.parameterEncoding; - HTTPClient.registeredHTTPOperationClassNames = [self.registeredHTTPOperationClassNames copyWithZone:zone]; - HTTPClient.defaultHeaders = [self.defaultHeaders copyWithZone:zone]; -#ifdef _SYSTEMCONFIGURATION_H - HTTPClient.networkReachabilityStatusBlock = self.networkReachabilityStatusBlock; -#endif - return HTTPClient; -} - -@end - -#pragma mark - - -static NSString * const kAFMultipartFormBoundary = @"Boundary+0xAbCdEfGbOuNdArY"; - -static NSString * const kAFMultipartFormCRLF = @"\r\n"; - -static NSInteger const kAFStreamToStreamBufferSize = 1024 * 1024; //1 meg default - -static inline NSString * AFMultipartFormInitialBoundary() { - return [NSString stringWithFormat:@"--%@%@", kAFMultipartFormBoundary, kAFMultipartFormCRLF]; -} - -static inline NSString * AFMultipartFormEncapsulationBoundary() { - return [NSString stringWithFormat:@"%@--%@%@", kAFMultipartFormCRLF, kAFMultipartFormBoundary, kAFMultipartFormCRLF]; -} - -static inline NSString * AFMultipartFormFinalBoundary() { - return [NSString stringWithFormat:@"%@--%@--%@", kAFMultipartFormCRLF, kAFMultipartFormBoundary, kAFMultipartFormCRLF]; -} - -static inline NSString * AFContentTypeForPathExtension(NSString *extension) { -#ifdef __UTTYPE__ - NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL); - return (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType); -#else - return @"application/octet-stream"; -#endif -} - -NSUInteger const kAFUploadStream3GSuggestedPacketSize = 1024 * 16; -NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2; - -@interface AFHTTPBodyPart : NSObject -@property (nonatomic, assign) NSStringEncoding stringEncoding; -@property (nonatomic, strong) NSDictionary *headers; -@property (nonatomic, strong) id body; -@property (nonatomic, assign) unsigned long long bodyContentLength; -@property (nonatomic, readonly) NSInputStream *inputStream; - -@property (nonatomic, assign) BOOL hasInitialBoundary; -@property (nonatomic, assign) BOOL hasFinalBoundary; - -@property (nonatomic, readonly, getter = hasBytesAvailable) BOOL bytesAvailable; -@property (nonatomic, readonly) unsigned long long contentLength; - -- (NSInteger)read:(uint8_t *)buffer - maxLength:(NSUInteger)length; -@end - -@interface AFMultipartBodyStream : NSInputStream -@property (nonatomic, assign) NSUInteger numberOfBytesInPacket; -@property (nonatomic, assign) NSTimeInterval delay; -@property (nonatomic, readonly) unsigned long long contentLength; -@property (nonatomic, readonly, getter = isEmpty) BOOL empty; - -- (id)initWithStringEncoding:(NSStringEncoding)encoding; -- (void)setInitialAndFinalBoundaries; -- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart; -@end - -#pragma mark - - -@interface AFStreamingMultipartFormData () -@property (readwrite, nonatomic, copy) NSMutableURLRequest *request; -@property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream; -@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding; -@end - -@implementation AFStreamingMultipartFormData -@synthesize request = _request; -@synthesize bodyStream = _bodyStream; -@synthesize stringEncoding = _stringEncoding; - -- (id)initWithURLRequest:(NSMutableURLRequest *)urlRequest - stringEncoding:(NSStringEncoding)encoding -{ - self = [super init]; - if (!self) { - return nil; - } - - self.request = urlRequest; - self.stringEncoding = encoding; - self.bodyStream = [[AFMultipartBodyStream alloc] initWithStringEncoding:encoding]; - - return self; -} - -- (BOOL)appendPartWithFileURL:(NSURL *)fileURL - name:(NSString *)name - error:(NSError * __autoreleasing *)error -{ - NSParameterAssert(fileURL); - NSParameterAssert(name); - - if (![fileURL isFileURL]) { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"AFNetworking", nil) forKey:NSLocalizedFailureReasonErrorKey]; - if (error != NULL) { - *error = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; - } - - return NO; - } else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) { - NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedStringFromTable(@"File URL not reachable.", @"AFNetworking", nil) forKey:NSLocalizedFailureReasonErrorKey]; - if (error != NULL) { - *error = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; - } - - return NO; - } - - NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; - [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, [fileURL lastPathComponent]] forKey:@"Content-Disposition"]; - [mutableHeaders setValue:AFContentTypeForPathExtension([fileURL pathExtension]) forKey:@"Content-Type"]; - - AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; - bodyPart.stringEncoding = self.stringEncoding; - bodyPart.headers = mutableHeaders; - bodyPart.body = fileURL; - - NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:nil]; - bodyPart.bodyContentLength = [[fileAttributes objectForKey:NSFileSize] unsignedLongLongValue]; - - [self.bodyStream appendHTTPBodyPart:bodyPart]; - - return YES; -} - -- (void)appendPartWithFileData:(NSData *)data - name:(NSString *)name - fileName:(NSString *)fileName - mimeType:(NSString *)mimeType -{ - NSParameterAssert(name); - NSParameterAssert(fileName); - NSParameterAssert(mimeType); - - NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; - [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; - [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; - - [self appendPartWithHeaders:mutableHeaders body:data]; -} - -- (void)appendPartWithFormData:(NSData *)data - name:(NSString *)name -{ - NSParameterAssert(name); - - NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; - [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"]; - - [self appendPartWithHeaders:mutableHeaders body:data]; -} - -- (void)appendPartWithHeaders:(NSDictionary *)headers - body:(NSData *)body -{ - NSParameterAssert(body); - - AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; - bodyPart.stringEncoding = self.stringEncoding; - bodyPart.headers = headers; - bodyPart.bodyContentLength = [body length]; - bodyPart.body = body; - - [self.bodyStream appendHTTPBodyPart:bodyPart]; -} - -- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes - delay:(NSTimeInterval)delay -{ - self.bodyStream.numberOfBytesInPacket = numberOfBytes; - self.bodyStream.delay = delay; -} - -- (NSMutableURLRequest *)requestByFinalizingMultipartFormData { - if ([self.bodyStream isEmpty]) { - return self.request; - } - - // Reset the initial and final boundaries to ensure correct Content-Length - [self.bodyStream setInitialAndFinalBoundaries]; - - [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", kAFMultipartFormBoundary] forHTTPHeaderField:@"Content-Type"]; - [self.request setValue:[NSString stringWithFormat:@"%llu", [self.bodyStream contentLength]] forHTTPHeaderField:@"Content-Length"]; - [self.request setHTTPBodyStream:self.bodyStream]; - - return self.request; -} - -@end - -#pragma mark - - -@interface AFMultipartBodyStream () -@property (nonatomic, assign) NSStreamStatus streamStatus; -@property (nonatomic, strong) NSError *streamError; - -@property (nonatomic, assign) NSStringEncoding stringEncoding; -@property (nonatomic, strong) NSMutableArray *HTTPBodyParts; -@property (nonatomic, strong) NSEnumerator *HTTPBodyPartEnumerator; -@property (nonatomic, strong) AFHTTPBodyPart *currentHTTPBodyPart; -@end - -@implementation AFMultipartBodyStream -@synthesize streamStatus = _streamStatus; -@synthesize streamError = _streamError; -@synthesize stringEncoding = _stringEncoding; -@synthesize HTTPBodyParts = _HTTPBodyParts; -@synthesize HTTPBodyPartEnumerator = _HTTPBodyPartEnumerator; -@synthesize currentHTTPBodyPart = _currentHTTPBodyPart; -@synthesize numberOfBytesInPacket = _numberOfBytesInPacket; -@synthesize delay = _delay; - -- (id)initWithStringEncoding:(NSStringEncoding)encoding { - self = [super init]; - if (!self) { - return nil; - } - - self.stringEncoding = encoding; - self.HTTPBodyParts = [NSMutableArray array]; - self.numberOfBytesInPacket = NSIntegerMax; - - return self; -} - -- (void)setInitialAndFinalBoundaries { - if ([self.HTTPBodyParts count] > 0) { - for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { - bodyPart.hasInitialBoundary = NO; - bodyPart.hasFinalBoundary = NO; - } - - [[self.HTTPBodyParts objectAtIndex:0] setHasInitialBoundary:YES]; - [[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES]; - } -} - -- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart { - [self.HTTPBodyParts addObject:bodyPart]; -} - -- (BOOL)isEmpty { - return [self.HTTPBodyParts count] == 0; -} - -#pragma mark - NSInputStream - -- (NSInteger)read:(uint8_t *)buffer - maxLength:(NSUInteger)length -{ - if ([self streamStatus] == NSStreamStatusClosed) { - return 0; - } - NSInteger bytesRead = 0; - - while ((NSUInteger)bytesRead < MIN(length, self.numberOfBytesInPacket)) { - if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) { - if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) { - break; - } - } else { - bytesRead += [self.currentHTTPBodyPart read:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)]; - if (self.delay > 0.0f) { - [NSThread sleepForTimeInterval:self.delay]; - } - } - } - return bytesRead; -} - -- (BOOL)getBuffer:(__unused uint8_t **)buffer - length:(__unused NSUInteger *)len -{ - return NO; -} - -- (BOOL)hasBytesAvailable { - return [self streamStatus] == NSStreamStatusOpen; -} - -#pragma mark - NSStream - -- (void)open { - if (self.streamStatus == NSStreamStatusOpen) { - return; - } - - self.streamStatus = NSStreamStatusOpen; - - [self setInitialAndFinalBoundaries]; - self.HTTPBodyPartEnumerator = [self.HTTPBodyParts objectEnumerator]; -} - -- (void)close { - self.streamStatus = NSStreamStatusClosed; -} - -- (id)propertyForKey:(__unused NSString *)key { - return nil; -} - -- (BOOL)setProperty:(__unused id)property - forKey:(__unused NSString *)key -{ - return NO; -} - -- (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop - forMode:(__unused NSString *)mode -{} - -- (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop - forMode:(__unused NSString *)mode -{} - -- (unsigned long long)contentLength { - unsigned long long length = 0; - for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { - length += [bodyPart contentLength]; - } - - return length; -} - -#pragma mark - Undocumented CFReadStream Bridged Methods - -- (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop - forMode:(__unused CFStringRef)aMode -{} - -- (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop - forMode:(__unused CFStringRef)aMode -{} - -- (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags - callback:(__unused CFReadStreamClientCallBack)inCallback - context:(__unused CFStreamClientContext *)inContext { - return NO; -} - -#pragma mark - NSCopying - --(id)copyWithZone:(NSZone *)zone { - AFMultipartBodyStream *bodyStreamCopy = [[[self class] allocWithZone:zone] initWithStringEncoding:self.stringEncoding]; - - for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { - [bodyStreamCopy appendHTTPBodyPart:[bodyPart copy]]; - } - - [bodyStreamCopy setInitialAndFinalBoundaries]; - - return bodyStreamCopy; -} - -@end - -#pragma mark - - -typedef enum { - AFEncapsulationBoundaryPhase = 1, - AFHeaderPhase = 2, - AFBodyPhase = 3, - AFFinalBoundaryPhase = 4, -} AFHTTPBodyPartReadPhase; - -@interface AFHTTPBodyPart () { - AFHTTPBodyPartReadPhase _phase; - NSInputStream *_inputStream; - unsigned long long _phaseReadOffset; -} - -- (BOOL)transitionToNextPhase; -- (NSInteger)readData:(NSData *)data - intoBuffer:(uint8_t *)buffer - maxLength:(NSUInteger)length; -@end - -@implementation AFHTTPBodyPart -@synthesize stringEncoding = _stringEncoding; -@synthesize headers = _headers; -@synthesize body = _body; -@synthesize bodyContentLength = _bodyContentLength; -@synthesize hasInitialBoundary = _hasInitialBoundary; -@synthesize hasFinalBoundary = _hasFinalBoundary; - -- (id)init { - self = [super init]; - if (!self) { - return nil; - } - - [self transitionToNextPhase]; - - return self; -} - -- (void)dealloc { - if (_inputStream) { - [_inputStream close]; - _inputStream = nil; - } -} - -- (NSInputStream *)inputStream { - if (!_inputStream) { - if ([self.body isKindOfClass:[NSData class]]) { - _inputStream = [NSInputStream inputStreamWithData:self.body]; - } else if ([self.body isKindOfClass:[NSURL class]]) { - _inputStream = [NSInputStream inputStreamWithURL:self.body]; - } - } - - return _inputStream; -} - -- (NSString *)stringForHeaders { - NSMutableString *headerString = [NSMutableString string]; - for (NSString *field in [self.headers allKeys]) { - [headerString appendString:[NSString stringWithFormat:@"%@: %@%@", field, [self.headers valueForKey:field], kAFMultipartFormCRLF]]; - } - [headerString appendString:kAFMultipartFormCRLF]; - - return [NSString stringWithString:headerString]; -} - -- (unsigned long long)contentLength { - unsigned long long length = 0; - - NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary() : AFMultipartFormEncapsulationBoundary()) dataUsingEncoding:self.stringEncoding]; - length += [encapsulationBoundaryData length]; - - NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding]; - length += [headersData length]; - - length += _bodyContentLength; - - NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary() dataUsingEncoding:self.stringEncoding] : [NSData data]); - length += [closingBoundaryData length]; - - return length; -} - -- (BOOL)hasBytesAvailable { - // Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the avaiable buffer - if (_phase == AFFinalBoundaryPhase) { - return YES; - } - - switch (self.inputStream.streamStatus) { - case NSStreamStatusNotOpen: - case NSStreamStatusOpening: - case NSStreamStatusOpen: - case NSStreamStatusReading: - case NSStreamStatusWriting: - return YES; - case NSStreamStatusAtEnd: - case NSStreamStatusClosed: - case NSStreamStatusError: - return NO; - } -} - -- (NSInteger)read:(uint8_t *)buffer - maxLength:(NSUInteger)length -{ - NSInteger bytesRead = 0; - - if (_phase == AFEncapsulationBoundaryPhase) { - NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary() : AFMultipartFormEncapsulationBoundary()) dataUsingEncoding:self.stringEncoding]; - bytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)]; - } - - if (_phase == AFHeaderPhase) { - NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding]; - bytesRead += [self readData:headersData intoBuffer:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)]; - } - - if (_phase == AFBodyPhase) { - if ([self.inputStream hasBytesAvailable]) { - bytesRead += [self.inputStream read:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)]; - } - - if (![self.inputStream hasBytesAvailable]) { - [self transitionToNextPhase]; - } - } - - if (_phase == AFFinalBoundaryPhase) { - NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary() dataUsingEncoding:self.stringEncoding] : [NSData data]); - bytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[bytesRead] maxLength:(length - (NSUInteger)bytesRead)]; - } - - return bytesRead; -} - -- (NSInteger)readData:(NSData *)data - intoBuffer:(uint8_t *)buffer - maxLength:(NSUInteger)length -{ - NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length)); - [data getBytes:buffer range:range]; - - _phaseReadOffset += range.length; - - if (((NSUInteger)_phaseReadOffset) >= [data length]) { - [self transitionToNextPhase]; - } - - return (NSInteger)range.length; -} - -- (BOOL)transitionToNextPhase { - if (![[NSThread currentThread] isMainThread]) { - [self performSelectorOnMainThread:@selector(transitionToNextPhase) withObject:nil waitUntilDone:YES]; - return YES; - } - - switch (_phase) { - case AFEncapsulationBoundaryPhase: - _phase = AFHeaderPhase; - break; - case AFHeaderPhase: - [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; - [self.inputStream open]; - _phase = AFBodyPhase; - break; - case AFBodyPhase: - [self.inputStream close]; - _phase = AFFinalBoundaryPhase; - break; - case AFFinalBoundaryPhase: - default: - _phase = AFEncapsulationBoundaryPhase; - break; - } - _phaseReadOffset = 0; - - return YES; -} - -#pragma mark - NSCopying - -- (id)copyWithZone:(NSZone *)zone { - AFHTTPBodyPart *bodyPart = [[[self class] allocWithZone:zone] init]; - - bodyPart.stringEncoding = self.stringEncoding; - bodyPart.headers = self.headers; - bodyPart.bodyContentLength = self.bodyContentLength; - bodyPart.body = self.body; - - return bodyPart; -} - -@end diff --git a/AFNetworking/AFHTTPRequestOperation.h b/AFNetworking/AFHTTPRequestOperation.h deleted file mode 100755 index d6776b3..0000000 --- a/AFNetworking/AFHTTPRequestOperation.h +++ /dev/null @@ -1,133 +0,0 @@ -// AFHTTPRequestOperation.h -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import -#import "AFURLConnectionOperation.h" - -/** - `AFHTTPRequestOperation` is a subclass of `AFURLConnectionOperation` for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request. - */ -@interface AFHTTPRequestOperation : AFURLConnectionOperation - -///---------------------------------------------- -/// @name Getting HTTP URL Connection Information -///---------------------------------------------- - -/** - The last HTTP response received by the operation's connection. - */ -@property (readonly, nonatomic, strong) NSHTTPURLResponse *response; - -///---------------------------------------------------------- -/// @name Managing And Checking For Acceptable HTTP Responses -///---------------------------------------------------------- - -/** - A Boolean value that corresponds to whether the status code of the response is within the specified set of acceptable status codes. Returns `YES` if `acceptableStatusCodes` is `nil`. - */ -@property (nonatomic, readonly) BOOL hasAcceptableStatusCode; - -/** - A Boolean value that corresponds to whether the MIME type of the response is among the specified set of acceptable content types. Returns `YES` if `acceptableContentTypes` is `nil`. - */ -@property (nonatomic, readonly) BOOL hasAcceptableContentType; - -/** - The callback dispatch queue on success. If `NULL` (default), the main queue is used. - */ -@property (nonatomic, assign) dispatch_queue_t successCallbackQueue; - -/** - The callback dispatch queue on failure. If `NULL` (default), the main queue is used. - */ -@property (nonatomic, assign) dispatch_queue_t failureCallbackQueue; - -///------------------------------------------------------------ -/// @name Managing Acceptable HTTP Status Codes & Content Types -///------------------------------------------------------------ - -/** - Returns an `NSIndexSet` object containing the ranges of acceptable HTTP status codes. When non-`nil`, the operation will set the `error` property to an error in `AFErrorDomain`. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html - - By default, this is the range 200 to 299, inclusive. - */ -+ (NSIndexSet *)acceptableStatusCodes; - -/** - Adds status codes to the set of acceptable HTTP status codes returned by `+acceptableStatusCodes` in subsequent calls by this class and its descendants. - - @param statusCodes The status codes to be added to the set of acceptable HTTP status codes - */ -+ (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes; - -/** - Returns an `NSSet` object containing the acceptable MIME types. When non-`nil`, the operation will set the `error` property to an error in `AFErrorDomain`. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17 - - By default, this is `nil`. - */ -+ (NSSet *)acceptableContentTypes; - -/** - Adds content types to the set of acceptable MIME types returned by `+acceptableContentTypes` in subsequent calls by this class and its descendants. - - @param contentTypes The content types to be added to the set of acceptable MIME types - */ -+ (void)addAcceptableContentTypes:(NSSet *)contentTypes; - - -///----------------------------------------------------- -/// @name Determining Whether A Request Can Be Processed -///----------------------------------------------------- - -/** - A Boolean value determining whether or not the class can process the specified request. For example, `AFJSONRequestOperation` may check to make sure the content type was `application/json` or the URL path extension was `.json`. - - @param urlRequest The request that is determined to be supported or not supported for this class. - */ -+ (BOOL)canProcessRequest:(NSURLRequest *)urlRequest; - -///----------------------------------------------------------- -/// @name Setting Completion Block Success / Failure Callbacks -///----------------------------------------------------------- - -/** - Sets the `completionBlock` property with a block that executes either the specified success or failure block, depending on the state of the request on completion. If `error` returns a value, which can be caused by an unacceptable status code or content type, then `failure` is executed. Otherwise, `success` is executed. - - @param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request. - @param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request. - - @discussion This method should be overridden in subclasses in order to specify the response object passed into the success block. - */ -- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; - -@end - -///---------------- -/// @name Functions -///---------------- - -/** - Returns a set of MIME types detected in an HTTP `Accept` or `Content-Type` header. - */ -extern NSSet * AFContentTypesFromHTTPHeader(NSString *string); - diff --git a/AFNetworking/AFHTTPRequestOperation.m b/AFNetworking/AFHTTPRequestOperation.m deleted file mode 100755 index 091f05b..0000000 --- a/AFNetworking/AFHTTPRequestOperation.m +++ /dev/null @@ -1,369 +0,0 @@ -// AFHTTPRequestOperation.m -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "AFHTTPRequestOperation.h" -#import - -// Workaround for change in imp_implementationWithBlock() with Xcode 4.5 -#if defined(__IPHONE_6_0) || defined(__MAC_10_8) - #define AF_CAST_TO_BLOCK id -#else - #define AF_CAST_TO_BLOCK __bridge void * -#endif - -// We do a little bit of duck typing in this file which can trigger this warning. Turn it off for this source file. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wstrict-selector-match" - -NSSet * AFContentTypesFromHTTPHeader(NSString *string) { - if (!string) { - return nil; - } - - NSArray *mediaRanges = [string componentsSeparatedByString:@","]; - NSMutableSet *mutableContentTypes = [NSMutableSet setWithCapacity:mediaRanges.count]; - - [mediaRanges enumerateObjectsUsingBlock:^(NSString *mediaRange, __unused NSUInteger idx, __unused BOOL *stop) { - NSRange parametersRange = [mediaRange rangeOfString:@";"]; - if (parametersRange.location != NSNotFound) { - mediaRange = [mediaRange substringToIndex:parametersRange.location]; - } - - mediaRange = [mediaRange stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - - if (mediaRange.length > 0) { - [mutableContentTypes addObject:mediaRange]; - } - }]; - - return [NSSet setWithSet:mutableContentTypes]; -} - -static void AFGetMediaTypeAndSubtypeWithString(NSString *string, NSString **type, NSString **subtype) { - NSScanner *scanner = [NSScanner scannerWithString:string]; - [scanner setCharactersToBeSkipped:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; - [scanner scanUpToString:@"/" intoString:type]; - [scanner scanString:@"/" intoString:nil]; - [scanner scanUpToString:@";" intoString:subtype]; -} - -static NSString * AFStringFromIndexSet(NSIndexSet *indexSet) { - NSMutableString *string = [NSMutableString string]; - - NSRange range = NSMakeRange([indexSet firstIndex], 1); - while (range.location != NSNotFound) { - NSUInteger nextIndex = [indexSet indexGreaterThanIndex:range.location]; - while (nextIndex == range.location + range.length) { - range.length++; - nextIndex = [indexSet indexGreaterThanIndex:nextIndex]; - } - - if (string.length) { - [string appendString:@","]; - } - - if (range.length == 1) { - [string appendFormat:@"%lu", (long)range.location]; - } else { - NSUInteger firstIndex = range.location; - NSUInteger lastIndex = firstIndex + range.length - 1; - [string appendFormat:@"%lu-%lu", (long)firstIndex, (long)lastIndex]; - } - - range.location = nextIndex; - range.length = 1; - } - - return string; -} - -static void AFSwizzleClassMethodWithClassAndSelectorUsingBlock(Class klass, SEL selector, id block) { - Method originalMethod = class_getClassMethod(klass, selector); - IMP implementation = imp_implementationWithBlock((AF_CAST_TO_BLOCK)block); - class_replaceMethod(objc_getMetaClass([NSStringFromClass(klass) UTF8String]), selector, implementation, method_getTypeEncoding(originalMethod)); -} - -#pragma mark - - -@interface AFHTTPRequestOperation () -@property (readwrite, nonatomic, strong) NSURLRequest *request; -@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response; -@property (readwrite, nonatomic, strong) NSError *HTTPError; -@property (readwrite, nonatomic, copy) NSString *HTTPResponseString; -@property (readwrite, nonatomic, assign) long long totalContentLength; -@property (readwrite, nonatomic, assign) long long offsetContentLength; -@end - -@implementation AFHTTPRequestOperation -@synthesize HTTPError = _HTTPError; -@synthesize HTTPResponseString = _HTTPResponseString; -@synthesize successCallbackQueue = _successCallbackQueue; -@synthesize failureCallbackQueue = _failureCallbackQueue; -@synthesize totalContentLength = _totalContentLength; -@synthesize offsetContentLength = _offsetContentLength; -@dynamic request; -@dynamic response; - -- (void)dealloc { - if (_successCallbackQueue) { -#if !OS_OBJECT_USE_OBJC - dispatch_release(_successCallbackQueue); -#endif - _successCallbackQueue = NULL; - } - - if (_failureCallbackQueue) { -#if !OS_OBJECT_USE_OBJC - dispatch_release(_failureCallbackQueue); -#endif - _failureCallbackQueue = NULL; - } -} - -- (NSError *)error { - if (!self.HTTPError && self.response) { - if (![self hasAcceptableStatusCode] || ![self hasAcceptableContentType]) { - NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; - [userInfo setValue:self.responseString forKey:NSLocalizedRecoverySuggestionErrorKey]; - [userInfo setValue:[self.request URL] forKey:NSURLErrorFailingURLErrorKey]; - [userInfo setValue:self.request forKey:AFNetworkingOperationFailingURLRequestErrorKey]; - [userInfo setValue:self.response forKey:AFNetworkingOperationFailingURLResponseErrorKey]; - - if (![self hasAcceptableStatusCode]) { - NSUInteger statusCode = ([self.response isKindOfClass:[NSHTTPURLResponse class]]) ? (NSUInteger)[self.response statusCode] : 200; - [userInfo setValue:[NSString stringWithFormat:NSLocalizedStringFromTable(@"Expected status code in (%@), got %d", @"AFNetworking", nil), AFStringFromIndexSet([[self class] acceptableStatusCodes]), statusCode] forKey:NSLocalizedDescriptionKey]; - self.HTTPError = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadServerResponse userInfo:userInfo]; - } else if (![self hasAcceptableContentType]) { - // Don't invalidate content type if there is no content - if ([self.responseData length] > 0) { - [userInfo setValue:[NSString stringWithFormat:NSLocalizedStringFromTable(@"Expected content type %@, got %@", @"AFNetworking", nil), [[self class] acceptableContentTypes], [self.response MIMEType]] forKey:NSLocalizedDescriptionKey]; - self.HTTPError = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo]; - } - } - } - } - - if (self.HTTPError) { - return self.HTTPError; - } else { - return [super error]; - } -} - -- (NSString *)responseString { - // When no explicit charset parameter is provided by the sender, media subtypes of the "text" type are defined to have a default charset value of "ISO-8859-1" when received via HTTP. Data in character sets other than "ISO-8859-1" or its subsets MUST be labeled with an appropriate charset value. - // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.4.1 - if (!self.HTTPResponseString && self.response && !self.response.textEncodingName && self.responseData) { - NSString *type = nil; - AFGetMediaTypeAndSubtypeWithString([[self.response allHeaderFields] valueForKey:@"Content-Type"], &type, nil); - - if ([type isEqualToString:@"text"]) { - self.HTTPResponseString = [[NSString alloc] initWithData:self.responseData encoding:NSISOLatin1StringEncoding]; - } - } - - if (self.HTTPResponseString) { - return self.HTTPResponseString; - } else { - return [super responseString]; - } -} - -- (void)pause { - unsigned long long offset = 0; - if ([self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey]) { - offset = [[self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey] unsignedLongLongValue]; - } else { - offset = [[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length]; - } - - NSMutableURLRequest *mutableURLRequest = [self.request mutableCopy]; - if ([[self.response allHeaderFields] valueForKey:@"ETag"]) { - [mutableURLRequest setValue:[[self.response allHeaderFields] valueForKey:@"ETag"] forHTTPHeaderField:@"If-Range"]; - } - [mutableURLRequest setValue:[NSString stringWithFormat:@"bytes=%llu-", offset] forHTTPHeaderField:@"Range"]; - self.request = mutableURLRequest; - - [super pause]; -} - -- (BOOL)hasAcceptableStatusCode { - if (!self.response) { - return NO; - } - - NSUInteger statusCode = ([self.response isKindOfClass:[NSHTTPURLResponse class]]) ? (NSUInteger)[self.response statusCode] : 200; - return ![[self class] acceptableStatusCodes] || [[[self class] acceptableStatusCodes] containsIndex:statusCode]; -} - -- (BOOL)hasAcceptableContentType { - if (!self.response) { - return NO; - } - - // Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream". - // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec7.html - NSString *contentType = [self.response MIMEType]; - if (!contentType) { - contentType = @"application/octet-stream"; - } - - return ![[self class] acceptableContentTypes] || [[[self class] acceptableContentTypes] containsObject:contentType]; -} - -- (void)setSuccessCallbackQueue:(dispatch_queue_t)successCallbackQueue { - if (successCallbackQueue != _successCallbackQueue) { - if (_successCallbackQueue) { -#if !OS_OBJECT_USE_OBJC - dispatch_release(_successCallbackQueue); -#endif - _successCallbackQueue = NULL; - } - - if (successCallbackQueue) { -#if !OS_OBJECT_USE_OBJC - dispatch_retain(successCallbackQueue); -#endif - _successCallbackQueue = successCallbackQueue; - } - } -} - -- (void)setFailureCallbackQueue:(dispatch_queue_t)failureCallbackQueue { - if (failureCallbackQueue != _failureCallbackQueue) { - if (_failureCallbackQueue) { -#if !OS_OBJECT_USE_OBJC - dispatch_release(_failureCallbackQueue); -#endif - _failureCallbackQueue = NULL; - } - - if (failureCallbackQueue) { -#if !OS_OBJECT_USE_OBJC - dispatch_retain(failureCallbackQueue); -#endif - _failureCallbackQueue = failureCallbackQueue; - } - } -} - -- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ - // completionBlock is manually nilled out in AFURLConnectionOperation to break the retain cycle. -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-retain-cycles" - self.completionBlock = ^{ - if (self.error) { - if (failure) { - dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ - failure(self, self.error); - }); - } - } else { - if (success) { - dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ - success(self, self.responseData); - }); - } - } - }; -#pragma clang diagnostic pop -} - -#pragma mark - AFHTTPRequestOperation - -+ (NSIndexSet *)acceptableStatusCodes { - return [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)]; -} - -+ (void)addAcceptableStatusCodes:(NSIndexSet *)statusCodes { - NSMutableIndexSet *mutableStatusCodes = [[NSMutableIndexSet alloc] initWithIndexSet:[self acceptableStatusCodes]]; - [mutableStatusCodes addIndexes:statusCodes]; - AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableStatusCodes), ^(__unused id _self) { - return mutableStatusCodes; - }); -} - -+ (NSSet *)acceptableContentTypes { - return nil; -} - -+ (void)addAcceptableContentTypes:(NSSet *)contentTypes { - NSMutableSet *mutableContentTypes = [[NSMutableSet alloc] initWithSet:[self acceptableContentTypes] copyItems:YES]; - [mutableContentTypes unionSet:contentTypes]; - AFSwizzleClassMethodWithClassAndSelectorUsingBlock([self class], @selector(acceptableContentTypes), ^(__unused id _self) { - return mutableContentTypes; - }); -} - -+ (BOOL)canProcessRequest:(NSURLRequest *)request { - if ([[self class] isEqual:[AFHTTPRequestOperation class]]) { - return YES; - } - - return [[self acceptableContentTypes] intersectsSet:AFContentTypesFromHTTPHeader([request valueForHTTPHeaderField:@"Accept"])]; -} - -#pragma mark - NSURLConnectionDelegate - -- (void)connection:(__unused NSURLConnection *)connection -didReceiveResponse:(NSURLResponse *)response -{ - self.response = (NSHTTPURLResponse *)response; - - // Set Content-Range header if status code of response is 206 (Partial Content) - // See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.2.7 - long long totalContentLength = self.response.expectedContentLength; - long long fileOffset = 0; - NSUInteger statusCode = ([self.response isKindOfClass:[NSHTTPURLResponse class]]) ? (NSUInteger)[self.response statusCode] : 200; - if (statusCode == 206) { - NSString *contentRange = [self.response.allHeaderFields valueForKey:@"Content-Range"]; - if ([contentRange hasPrefix:@"bytes"]) { - NSArray *byteRanges = [contentRange componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@" -/"]]; - if ([byteRanges count] == 4) { - fileOffset = [[byteRanges objectAtIndex:1] longLongValue]; - totalContentLength = [[byteRanges objectAtIndex:2] longLongValue] ?: -1; // if this is "*", it's converted to 0, but -1 is default. - } - } - } else { - if ([self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey]) { - [self.outputStream setProperty:[NSNumber numberWithInteger:0] forKey:NSStreamFileCurrentOffsetKey]; - } else { - if ([[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length] > 0) { - self.outputStream = [NSOutputStream outputStreamToMemory]; - - NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; - for (NSString *runLoopMode in self.runLoopModes) { - [self.outputStream scheduleInRunLoop:runLoop forMode:runLoopMode]; - } - } - } - } - - self.offsetContentLength = MAX(fileOffset, 0); - self.totalContentLength = totalContentLength; - - [self.outputStream open]; -} - -@end diff --git a/AFNetworking/AFImageRequestOperation.h b/AFNetworking/AFImageRequestOperation.h deleted file mode 100755 index d991b25..0000000 --- a/AFNetworking/AFImageRequestOperation.h +++ /dev/null @@ -1,108 +0,0 @@ -// AFImageRequestOperation.h -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import -#import "AFHTTPRequestOperation.h" - -#import - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - #import -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) - #import -#endif - -/** - `AFImageRequestOperation` is a subclass of `AFHTTPRequestOperation` for downloading an processing images. - - ## Acceptable Content Types - - By default, `AFImageRequestOperation` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage: - - - `image/tiff` - - `image/jpeg` - - `image/gif` - - `image/png` - - `image/ico` - - `image/x-icon` - - `image/bmp` - - `image/x-bmp` - - `image/x-xbitmap` - - `image/x-win-bitmap` - */ -@interface AFImageRequestOperation : AFHTTPRequestOperation - -/** - An image constructed from the response data. If an error occurs during the request, `nil` will be returned, and the `error` property will be set to the error. - */ -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -@property (readonly, nonatomic, strong) UIImage *responseImage; -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -@property (readonly, nonatomic, strong) NSImage *responseImage; -#endif - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -/** - The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance. - */ -@property (nonatomic, assign) CGFloat imageScale; -#endif - -/** - Creates and returns an `AFImageRequestOperation` object and sets the specified success callback. - - @param urlRequest The request object to be loaded asynchronously during execution of the operation. - @param success A block object to be executed when the request finishes successfully. This block has no return value and takes a single arguments, the image created from the response data of the request. - - @return A new image request operation - */ -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(UIImage *image))success; -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSImage *image))success; -#endif - -/** - Creates and returns an `AFImageRequestOperation` object and sets the specified success callback. - - @param urlRequest The request object to be loaded asynchronously during execution of the operation. - @param imageProcessingBlock A block object to be executed after the image request finishes successfully, but before the image is returned in the `success` block. This block takes a single argument, the image loaded from the response body, and returns the processed image. - @param success A block object to be executed when the request finishes successfully, with a status code in the 2xx range, and with an acceptable content type (e.g. `image/png`). This block has no return value and takes three arguments: the request object of the operation, the response for the request, and the image created from the response data. - @param failure A block object to be executed when the request finishes unsuccessfully. This block has no return value and takes three arguments: the request object of the operation, the response for the request, and the error associated with the cause for the unsuccessful operation. - - @return A new image request operation - */ -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest - imageProcessingBlock:(UIImage *(^)(UIImage *image))imageProcessingBlock - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure; -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest - imageProcessingBlock:(NSImage *(^)(NSImage *image))imageProcessingBlock - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure; -#endif - -@end diff --git a/AFNetworking/AFImageRequestOperation.m b/AFNetworking/AFImageRequestOperation.m deleted file mode 100755 index 1eca51e..0000000 --- a/AFNetworking/AFImageRequestOperation.m +++ /dev/null @@ -1,233 +0,0 @@ -// AFImageRequestOperation.m -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "AFImageRequestOperation.h" - -static dispatch_queue_t af_image_request_operation_processing_queue; -static dispatch_queue_t image_request_operation_processing_queue() { - if (af_image_request_operation_processing_queue == NULL) { - af_image_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.image-request.processing", 0); - } - - return af_image_request_operation_processing_queue; -} - -@interface AFImageRequestOperation () -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -@property (readwrite, nonatomic, strong) UIImage *responseImage; -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -@property (readwrite, nonatomic, strong) NSImage *responseImage; -#endif -@end - -@implementation AFImageRequestOperation -@synthesize responseImage = _responseImage; -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -@synthesize imageScale = _imageScale; -#endif - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(UIImage *image))success -{ - return [self imageRequestOperationWithRequest:urlRequest imageProcessingBlock:nil success:^(NSURLRequest __unused *request, NSHTTPURLResponse __unused *response, UIImage *image) { - if (success) { - success(image); - } - } failure:nil]; -} -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSImage *image))success -{ - return [self imageRequestOperationWithRequest:urlRequest imageProcessingBlock:nil success:^(NSURLRequest __unused *request, NSHTTPURLResponse __unused *response, NSImage *image) { - if (success) { - success(image); - } - } failure:nil]; -} -#endif - - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest - imageProcessingBlock:(UIImage *(^)(UIImage *))imageProcessingBlock - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure -{ - AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest]; - [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { - if (success) { - UIImage *image = responseObject; - if (imageProcessingBlock) { - dispatch_async(image_request_operation_processing_queue(), ^(void) { - UIImage *processedImage = imageProcessingBlock(image); - - dispatch_async(operation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) { - success(operation.request, operation.response, processedImage); - }); - }); - } else { - success(operation.request, operation.response, image); - } - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if (failure) { - failure(operation.request, operation.response, error); - } - }]; - - - return requestOperation; -} -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -+ (instancetype)imageRequestOperationWithRequest:(NSURLRequest *)urlRequest - imageProcessingBlock:(NSImage *(^)(NSImage *))imageProcessingBlock - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSImage *image))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure -{ - AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest]; - [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { - if (success) { - NSImage *image = responseObject; - if (imageProcessingBlock) { - dispatch_async(image_request_operation_processing_queue(), ^(void) { - NSImage *processedImage = imageProcessingBlock(image); - - dispatch_async(operation.successCallbackQueue ?: dispatch_get_main_queue(), ^(void) { - success(operation.request, operation.response, processedImage); - }); - }); - } else { - success(operation.request, operation.response, image); - } - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if (failure) { - failure(operation.request, operation.response, error); - } - }]; - - return requestOperation; -} -#endif - -- (id)initWithRequest:(NSURLRequest *)urlRequest { - self = [super initWithRequest:urlRequest]; - if (!self) { - return nil; - } - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - self.imageScale = [[UIScreen mainScreen] scale]; -#endif - - return self; -} - - -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -- (UIImage *)responseImage { - if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) { - UIImage *image = [UIImage imageWithData:self.responseData]; - - self.responseImage = [UIImage imageWithCGImage:[image CGImage] scale:self.imageScale orientation:image.imageOrientation]; - } - - return _responseImage; -} - -- (void)setImageScale:(CGFloat)imageScale { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wfloat-equal" - if (imageScale == _imageScale) { - return; - } -#pragma clang diagnostic pop - - _imageScale = imageScale; - - self.responseImage = nil; -} -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) -- (NSImage *)responseImage { - if (!_responseImage && [self.responseData length] > 0 && [self isFinished]) { - // Ensure that the image is set to it's correct pixel width and height - NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:self.responseData]; - self.responseImage = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])]; - [self.responseImage addRepresentation:bitimage]; - } - - return _responseImage; -} -#endif - -#pragma mark - AFHTTPRequestOperation - -+ (NSSet *)acceptableContentTypes { - return [NSSet setWithObjects:@"image/tiff", @"image/jpeg", @"image/gif", @"image/png", @"image/ico", @"image/x-icon", @"image/bmp", @"image/x-bmp", @"image/x-xbitmap", @"image/x-win-bitmap", nil]; -} - -+ (BOOL)canProcessRequest:(NSURLRequest *)request { - static NSSet * _acceptablePathExtension = nil; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _acceptablePathExtension = [[NSSet alloc] initWithObjects:@"tif", @"tiff", @"jpg", @"jpeg", @"gif", @"png", @"ico", @"bmp", @"cur", nil]; - }); - - return [_acceptablePathExtension containsObject:[[request URL] pathExtension]] || [super canProcessRequest:request]; -} - -- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-retain-cycles" - self.completionBlock = ^ { - dispatch_async(image_request_operation_processing_queue(), ^(void) { - if (self.error) { - if (failure) { - dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ - failure(self, self.error); - }); - } - } else { - if (success) { -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - UIImage *image = nil; -#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) - NSImage *image = nil; -#endif - - image = self.responseImage; - - dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ - success(self, image); - }); - } - } - }); - }; -#pragma clang diagnostic pop -} - -@end diff --git a/AFNetworking/AFJSONRequestOperation.h b/AFNetworking/AFJSONRequestOperation.h deleted file mode 100755 index d625cb2..0000000 --- a/AFNetworking/AFJSONRequestOperation.h +++ /dev/null @@ -1,71 +0,0 @@ -// AFJSONRequestOperation.h -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import -#import "AFHTTPRequestOperation.h" - -/** - `AFJSONRequestOperation` is a subclass of `AFHTTPRequestOperation` for downloading and working with JSON response data. - - ## Acceptable Content Types - - By default, `AFJSONRequestOperation` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types: - - - `application/json` - - `text/json` - - @warning JSON parsing will use the built-in `NSJSONSerialization` class. - */ -@interface AFJSONRequestOperation : AFHTTPRequestOperation - -///---------------------------- -/// @name Getting Response Data -///---------------------------- - -/** - A JSON object constructed from the response data. If an error occurs while parsing, `nil` will be returned, and the `error` property will be set to the error. - */ -@property (readonly, nonatomic, strong) id responseJSON; - -/** - Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". - */ -@property (nonatomic, assign) NSJSONReadingOptions JSONReadingOptions; - -///---------------------------------- -/// @name Creating Request Operations -///---------------------------------- - -/** - Creates and returns an `AFJSONRequestOperation` object and sets the specified success and failure callbacks. - - @param urlRequest The request object to be loaded asynchronously during execution of the operation - @param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the JSON object created from the response data of request. - @param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data as JSON. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred. - - @return A new JSON request operation - */ -+ (instancetype)JSONRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id JSON))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON))failure; - -@end diff --git a/AFNetworking/AFJSONRequestOperation.m b/AFNetworking/AFJSONRequestOperation.m deleted file mode 100755 index 3807a0b..0000000 --- a/AFNetworking/AFJSONRequestOperation.m +++ /dev/null @@ -1,137 +0,0 @@ -// AFJSONRequestOperation.m -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "AFJSONRequestOperation.h" - -static dispatch_queue_t af_json_request_operation_processing_queue; -static dispatch_queue_t json_request_operation_processing_queue() { - if (af_json_request_operation_processing_queue == NULL) { - af_json_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.json-request.processing", 0); - } - - return af_json_request_operation_processing_queue; -} - -@interface AFJSONRequestOperation () -@property (readwrite, nonatomic, strong) id responseJSON; -@property (readwrite, nonatomic, strong) NSError *JSONError; -@end - -@implementation AFJSONRequestOperation -@synthesize responseJSON = _responseJSON; -@synthesize JSONReadingOptions = _JSONReadingOptions; -@synthesize JSONError = _JSONError; - -+ (instancetype)JSONRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id JSON))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id JSON))failure -{ - AFJSONRequestOperation *requestOperation = [(AFJSONRequestOperation *)[self alloc] initWithRequest:urlRequest]; - [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { - if (success) { - success(operation.request, operation.response, responseObject); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if (failure) { - failure(operation.request, operation.response, error, [(AFJSONRequestOperation *)operation responseJSON]); - } - }]; - - return requestOperation; -} - - -- (id)responseJSON { - if (!_responseJSON && [self.responseData length] > 0 && [self isFinished] && !self.JSONError) { - NSError *error = nil; - - // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization. - // See https://github.com/rails/rails/issues/1742 - if ([self.responseData length] == 0 || [self.responseString isEqualToString:@" "]) { - self.responseJSON = nil; - } else { - // Workaround for a bug in NSJSONSerialization when Unicode character escape codes are used instead of the actual character - // See http://stackoverflow.com/a/12843465/157142 - NSData *JSONData = [self.responseString dataUsingEncoding:self.responseStringEncoding]; - self.responseJSON = [NSJSONSerialization JSONObjectWithData:JSONData options:self.JSONReadingOptions error:&error]; - } - - self.JSONError = error; - } - - return _responseJSON; -} - -- (NSError *)error { - if (_JSONError) { - return _JSONError; - } else { - return [super error]; - } -} - -#pragma mark - AFHTTPRequestOperation - -+ (NSSet *)acceptableContentTypes { - return [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil]; -} - -+ (BOOL)canProcessRequest:(NSURLRequest *)request { - return [[[request URL] pathExtension] isEqualToString:@"json"] || [super canProcessRequest:request]; -} - -- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-retain-cycles" - self.completionBlock = ^ { - if (self.error) { - if (failure) { - dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ - failure(self, self.error); - }); - } - } else { - dispatch_async(json_request_operation_processing_queue(), ^{ - id JSON = self.responseJSON; - - if (self.JSONError) { - if (failure) { - dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ - failure(self, self.error); - }); - } - } else { - if (success) { - dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ - success(self, JSON); - }); - } - } - }); - } - }; -#pragma clang diagnostic pop -} - -@end diff --git a/AFNetworking/AFPropertyListRequestOperation.h b/AFNetworking/AFPropertyListRequestOperation.h deleted file mode 100755 index 04fe622..0000000 --- a/AFNetworking/AFPropertyListRequestOperation.h +++ /dev/null @@ -1,68 +0,0 @@ -// AFPropertyListRequestOperation.h -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import -#import "AFHTTPRequestOperation.h" - -/** - `AFPropertyListRequestOperation` is a subclass of `AFHTTPRequestOperation` for downloading and deserializing objects with property list (plist) response data. - - ## Acceptable Content Types - - By default, `AFPropertyListRequestOperation` accepts the following MIME types: - - - `application/x-plist` - */ -@interface AFPropertyListRequestOperation : AFHTTPRequestOperation - -///---------------------------- -/// @name Getting Response Data -///---------------------------- - -/** - An object deserialized from a plist constructed using the response data. - */ -@property (readonly, nonatomic) id responsePropertyList; - -///-------------------------------------- -/// @name Managing Property List Behavior -///-------------------------------------- - -/** - One of the `NSPropertyListMutabilityOptions` options, specifying the mutability of objects deserialized from the property list. By default, this is `NSPropertyListImmutable`. - */ -@property (nonatomic, assign) NSPropertyListReadOptions propertyListReadOptions; - -/** - Creates and returns an `AFPropertyListRequestOperation` object and sets the specified success and failure callbacks. - - @param urlRequest The request object to be loaded asynchronously during execution of the operation - @param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the object deserialized from a plist constructed using the response data. - @param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while deserializing the object from a property list. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred. - - @return A new property list request operation - */ -+ (instancetype)propertyListRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id propertyList))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id propertyList))failure; - -@end diff --git a/AFNetworking/AFPropertyListRequestOperation.m b/AFNetworking/AFPropertyListRequestOperation.m deleted file mode 100755 index 2eac6b6..0000000 --- a/AFNetworking/AFPropertyListRequestOperation.m +++ /dev/null @@ -1,141 +0,0 @@ -// AFPropertyListRequestOperation.m -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "AFPropertyListRequestOperation.h" - -static dispatch_queue_t af_property_list_request_operation_processing_queue; -static dispatch_queue_t property_list_request_operation_processing_queue() { - if (af_property_list_request_operation_processing_queue == NULL) { - af_property_list_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.property-list-request.processing", 0); - } - - return af_property_list_request_operation_processing_queue; -} - -@interface AFPropertyListRequestOperation () -@property (readwrite, nonatomic) id responsePropertyList; -@property (readwrite, nonatomic, assign) NSPropertyListFormat propertyListFormat; -@property (readwrite, nonatomic) NSError *propertyListError; -@end - -@implementation AFPropertyListRequestOperation -@synthesize responsePropertyList = _responsePropertyList; -@synthesize propertyListReadOptions = _propertyListReadOptions; -@synthesize propertyListFormat = _propertyListFormat; -@synthesize propertyListError = _propertyListError; - -+ (instancetype)propertyListRequestOperationWithRequest:(NSURLRequest *)request - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, id propertyList))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, id propertyList))failure -{ - AFPropertyListRequestOperation *requestOperation = [(AFPropertyListRequestOperation *)[self alloc] initWithRequest:request]; - [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { - if (success) { - success(operation.request, operation.response, responseObject); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if (failure) { - failure(operation.request, operation.response, error, [(AFPropertyListRequestOperation *)operation responsePropertyList]); - } - }]; - - return requestOperation; -} - -- (id)initWithRequest:(NSURLRequest *)urlRequest { - self = [super initWithRequest:urlRequest]; - if (!self) { - return nil; - } - - self.propertyListReadOptions = NSPropertyListImmutable; - - return self; -} - - -- (id)responsePropertyList { - if (!_responsePropertyList && [self.responseData length] > 0 && [self isFinished]) { - NSPropertyListFormat format; - NSError *error = nil; - self.responsePropertyList = [NSPropertyListSerialization propertyListWithData:self.responseData options:self.propertyListReadOptions format:&format error:&error]; - self.propertyListFormat = format; - self.propertyListError = error; - } - - return _responsePropertyList; -} - -- (NSError *)error { - if (_propertyListError) { - return _propertyListError; - } else { - return [super error]; - } -} - -#pragma mark - AFHTTPRequestOperation - -+ (NSSet *)acceptableContentTypes { - return [NSSet setWithObjects:@"application/x-plist", nil]; -} - -+ (BOOL)canProcessRequest:(NSURLRequest *)request { - return [[[request URL] pathExtension] isEqualToString:@"plist"] || [super canProcessRequest:request]; -} - -- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-retain-cycles" - self.completionBlock = ^ { - if (self.error) { - if (failure) { - dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ - failure(self, self.error); - }); - } - } else { - dispatch_async(property_list_request_operation_processing_queue(), ^(void) { - id propertyList = self.responsePropertyList; - - if (self.propertyListError) { - if (failure) { - dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ - failure(self, self.error); - }); - } - } else { - if (success) { - dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ - success(self, propertyList); - }); - } - } - }); - } - }; -#pragma clang diagnostic pop -} - -@end diff --git a/AFNetworking/AFXMLRequestOperation.h b/AFNetworking/AFXMLRequestOperation.h deleted file mode 100755 index 6a327f4..0000000 --- a/AFNetworking/AFXMLRequestOperation.h +++ /dev/null @@ -1,89 +0,0 @@ -// AFXMLRequestOperation.h -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import -#import "AFHTTPRequestOperation.h" - -#import - -/** - `AFXMLRequestOperation` is a subclass of `AFHTTPRequestOperation` for downloading and working with XML response data. - - ## Acceptable Content Types - - By default, `AFXMLRequestOperation` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: - - - `application/xml` - - `text/xml` - - ## Use With AFHTTPClient - - When `AFXMLRequestOperation` is registered with `AFHTTPClient`, the response object in the success callback of `HTTPRequestOperationWithRequest:success:failure:` will be an instance of `NSXMLParser`. On platforms that support `NSXMLDocument`, you have the option to ignore the response object, and simply use the `responseXMLDocument` property of the operation argument of the callback. - */ -@interface AFXMLRequestOperation : AFHTTPRequestOperation - -///---------------------------- -/// @name Getting Response Data -///---------------------------- - -/** - An `NSXMLParser` object constructed from the response data. - */ -@property (readonly, nonatomic, strong) NSXMLParser *responseXMLParser; - -#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED -/** - An `NSXMLDocument` object constructed from the response data. If an error occurs while parsing, `nil` will be returned, and the `error` property will be set to the error. - */ -@property (readonly, nonatomic, strong) NSXMLDocument *responseXMLDocument; -#endif - -/** - Creates and returns an `AFXMLRequestOperation` object and sets the specified success and failure callbacks. - - @param urlRequest The request object to be loaded asynchronously during execution of the operation - @param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the XML parser constructed with the response data of request. - @param failure A block object to be executed when the operation finishes unsuccessfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network error that occurred. - - @return A new XML request operation - */ -+ (instancetype)XMLParserRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLParser *XMLParser))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLParser *XMLParser))failure; - - -#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED -/** - Creates and returns an `AFXMLRequestOperation` object and sets the specified success and failure callbacks. - - @param urlRequest The request object to be loaded asynchronously during execution of the operation - @param success A block object to be executed when the operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the XML document created from the response data of request. - @param failure A block object to be executed when the operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data as XML. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error describing the network or parsing error that occurred. - - @return A new XML request operation - */ -+ (instancetype)XMLDocumentRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLDocument *document))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLDocument *document))failure; -#endif - -@end diff --git a/AFNetworking/AFXMLRequestOperation.m b/AFNetworking/AFXMLRequestOperation.m deleted file mode 100755 index a95ad82..0000000 --- a/AFNetworking/AFXMLRequestOperation.m +++ /dev/null @@ -1,165 +0,0 @@ -// AFXMLRequestOperation.m -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import "AFXMLRequestOperation.h" - -#include - -static dispatch_queue_t af_xml_request_operation_processing_queue; -static dispatch_queue_t xml_request_operation_processing_queue() { - if (af_xml_request_operation_processing_queue == NULL) { - af_xml_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.xml-request.processing", 0); - } - - return af_xml_request_operation_processing_queue; -} - -@interface AFXMLRequestOperation () -@property (readwrite, nonatomic, strong) NSXMLParser *responseXMLParser; -#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED -@property (readwrite, nonatomic, strong) NSXMLDocument *responseXMLDocument; -#endif -@property (readwrite, nonatomic, strong) NSError *XMLError; -@end - -@implementation AFXMLRequestOperation -@synthesize responseXMLParser = _responseXMLParser; -#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED -@synthesize responseXMLDocument = _responseXMLDocument; -#endif -@synthesize XMLError = _XMLError; - -+ (instancetype)XMLParserRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLParser *XMLParser))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLParser *XMLParser))failure -{ - AFXMLRequestOperation *requestOperation = [(AFXMLRequestOperation *)[self alloc] initWithRequest:urlRequest]; - [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { - if (success) { - success(operation.request, operation.response, responseObject); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if (failure) { - failure(operation.request, operation.response, error, [(AFXMLRequestOperation *)operation responseXMLParser]); - } - }]; - - return requestOperation; -} - -#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED -+ (instancetype)XMLDocumentRequestOperationWithRequest:(NSURLRequest *)urlRequest - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSXMLDocument *document))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error, NSXMLDocument *document))failure -{ - AFXMLRequestOperation *requestOperation = [[self alloc] initWithRequest:urlRequest]; - [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, __unused id responseObject) { - if (success) { - NSXMLDocument *XMLDocument = [(AFXMLRequestOperation *)operation responseXMLDocument]; - success(operation.request, operation.response, XMLDocument); - } - } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if (failure) { - NSXMLDocument *XMLDocument = [(AFXMLRequestOperation *)operation responseXMLDocument]; - failure(operation.request, operation.response, error, XMLDocument); - } - }]; - - return requestOperation; -} -#endif - - -- (NSXMLParser *)responseXMLParser { - if (!_responseXMLParser && [self.responseData length] > 0 && [self isFinished]) { - self.responseXMLParser = [[NSXMLParser alloc] initWithData:self.responseData]; - } - - return _responseXMLParser; -} - -#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED -- (NSXMLDocument *)responseXMLDocument { - if (!_responseXMLDocument && [self.responseData length] > 0 && [self isFinished]) { - NSError *error = nil; - self.responseXMLDocument = [[NSXMLDocument alloc] initWithData:self.responseData options:0 error:&error]; - self.XMLError = error; - } - - return _responseXMLDocument; -} -#endif - -- (NSError *)error { - if (_XMLError) { - return _XMLError; - } else { - return [super error]; - } -} - -#pragma mark - NSOperation - -- (void)cancel { - [super cancel]; - - self.responseXMLParser.delegate = nil; -} - -#pragma mark - AFHTTPRequestOperation - -+ (NSSet *)acceptableContentTypes { - return [NSSet setWithObjects:@"application/xml", @"text/xml", nil]; -} - -+ (BOOL)canProcessRequest:(NSURLRequest *)request { - return [[[request URL] pathExtension] isEqualToString:@"xml"] || [super canProcessRequest:request]; -} - -- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success - failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-retain-cycles" - self.completionBlock = ^ { - dispatch_async(xml_request_operation_processing_queue(), ^(void) { - NSXMLParser *XMLParser = self.responseXMLParser; - - if (self.error) { - if (failure) { - dispatch_async(self.failureCallbackQueue ?: dispatch_get_main_queue(), ^{ - failure(self, self.error); - }); - } - } else { - if (success) { - dispatch_async(self.successCallbackQueue ?: dispatch_get_main_queue(), ^{ - success(self, XMLParser); - }); - } - } - }); - }; -#pragma clang diagnostic pop -} - -@end diff --git a/AFNetworking/UIImageView+AFNetworking.h b/AFNetworking/UIImageView+AFNetworking.h deleted file mode 100755 index 6483b61..0000000 --- a/AFNetworking/UIImageView+AFNetworking.h +++ /dev/null @@ -1,78 +0,0 @@ -// UIImageView+AFNetworking.h -// -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -#import -#import "AFImageRequestOperation.h" - -#import - -#if __IPHONE_OS_VERSION_MIN_REQUIRED -#import - -/** - This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL. - */ -@interface UIImageView (AFNetworking) - -/** - Creates and enqueues an image request operation, which asynchronously downloads the image from the specified URL, and sets it the request is finished. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. - - @discussion By default, URL requests have a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` - - @param url The URL used for the image request. - */ -- (void)setImageWithURL:(NSURL *)url; - -/** - Creates and enqueues an image request operation, which asynchronously downloads the image from the specified URL. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. - - @param url The URL used for the image request. - @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. - - @discussion By default, URL requests have a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` -*/ -- (void)setImageWithURL:(NSURL *)url - placeholderImage:(UIImage *)placeholderImage; - -/** - Creates and enqueues an image request operation, which asynchronously downloads the image with the specified URL request object. Any previous image request for the receiver will be cancelled. If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. - - @param urlRequest The URL request used for the image request. - @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. - @param success A block to be executed when the image request operation finishes successfully, with a status code in the 2xx range, and with an acceptable content type (e.g. `image/png`). This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the request and response parameters will be `nil`. - @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. - - @discussion If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is executed. -*/ -- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest - placeholderImage:(UIImage *)placeholderImage - success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success - failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure; - -/** - Cancels any executing image request operation for the receiver, if one exists. - */ -- (void)cancelImageRequestOperation; - -@end - -#endif diff --git a/CorePlotHeaders/CPTAnnotation.h b/CorePlotHeaders/CPTAnnotation.h deleted file mode 100755 index bcbae35..0000000 --- a/CorePlotHeaders/CPTAnnotation.h +++ /dev/null @@ -1,37 +0,0 @@ -#import "CPTDefinitions.h" -#import -#import - -@class CPTAnnotationHostLayer; -@class CPTLayer; - -@interface CPTAnnotation : NSObject { - @private - __cpt_weak CPTAnnotationHostLayer *annotationHostLayer; - CPTLayer *contentLayer; - CGPoint contentAnchorPoint; - CGPoint displacement; - CGFloat rotation; -} - -@property (nonatomic, readwrite, retain) CPTLayer *contentLayer; -@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTAnnotationHostLayer *annotationHostLayer; -@property (nonatomic, readwrite, assign) CGPoint contentAnchorPoint; -@property (nonatomic, readwrite, assign) CGPoint displacement; -@property (nonatomic, readwrite, assign) CGFloat rotation; - -@end - -#pragma mark - - -/** @category CPTAnnotation(AbstractMethods) - * @brief CPTAnnotation abstract methods—must be overridden by subclasses. - **/ -@interface CPTAnnotation(AbstractMethods) - -/// @name Layout -/// @{ --(void)positionContentLayer; -/// @} - -@end diff --git a/CorePlotHeaders/CPTAnnotationHostLayer.h b/CorePlotHeaders/CPTAnnotationHostLayer.h deleted file mode 100755 index d12b421..0000000 --- a/CorePlotHeaders/CPTAnnotationHostLayer.h +++ /dev/null @@ -1,19 +0,0 @@ -#import "CPTLayer.h" - -@class CPTAnnotation; - -@interface CPTAnnotationHostLayer : CPTLayer { - @private - NSMutableArray *mutableAnnotations; -} - -@property (nonatomic, readonly, retain) NSArray *annotations; - -/// @name Annotations -/// @{ --(void)addAnnotation:(CPTAnnotation *)annotation; --(void)removeAnnotation:(CPTAnnotation *)annotation; --(void)removeAllAnnotations; -/// @} - -@end diff --git a/CorePlotHeaders/CPTAxis.h b/CorePlotHeaders/CPTAxis.h deleted file mode 100755 index f76b9ae..0000000 --- a/CorePlotHeaders/CPTAxis.h +++ /dev/null @@ -1,267 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTLayer.h" -#import "CPTTextStyle.h" -#import - -/// @file - -@class CPTAxis; -@class CPTAxisSet; -@class CPTAxisTitle; -@class CPTGridLines; -@class CPTLimitBand; -@class CPTLineCap; -@class CPTLineStyle; -@class CPTPlotSpace; -@class CPTPlotRange; -@class CPTPlotArea; -@class CPTShadow; - -/** - * @brief Enumeration of labeling policies - **/ -typedef enum _CPTAxisLabelingPolicy { - CPTAxisLabelingPolicyNone, ///< No labels provided; user sets labels and tick locations. - CPTAxisLabelingPolicyLocationsProvided, ///< User sets tick locations; axis makes labels. - CPTAxisLabelingPolicyFixedInterval, ///< Fixed interval labeling policy. - CPTAxisLabelingPolicyAutomatic, ///< Automatic labeling policy. - CPTAxisLabelingPolicyEqualDivisions ///< Divide the plot range into equal parts. -} -CPTAxisLabelingPolicy; - -#pragma mark - - -/** - * @brief Axis labeling delegate. - **/ -@protocol CPTAxisDelegate - -@optional - -/// @name Labels -/// @{ - -/** @brief @optional Determines if the axis should relabel itself now. - * @param axis The axis. - * @return @YES if the axis should relabel now. - **/ --(BOOL)axisShouldRelabel:(CPTAxis *)axis; - -/** @brief @optional The method is called after the axis is relabeled to allow the delegate to perform any - * necessary cleanup or further labeling actions. - * @param axis The axis. - **/ --(void)axisDidRelabel:(CPTAxis *)axis; - -/** @brief @optional This method gives the delegate a chance to create custom labels for each tick. - * It can be used with any labeling policy. Returning @NO will cause the axis not - * to update the labels. It is then the delegate’s responsiblity to do this. - * @param axis The axis. - * @param locations The locations of the major ticks. - * @return @YES if the axis class should proceed with automatic labeling. - **/ --(BOOL)axis:(CPTAxis *)axis shouldUpdateAxisLabelsAtLocations:(NSSet *)locations; - -/** @brief @optional This method gives the delegate a chance to create custom labels for each minor tick. - * It can be used with any labeling policy. Returning @NO will cause the axis not - * to update the labels. It is then the delegate’s responsiblity to do this. - * @param axis The axis. - * @param locations The locations of the minor ticks. - * @return @YES if the axis class should proceed with automatic labeling. - **/ --(BOOL)axis:(CPTAxis *)axis shouldUpdateMinorAxisLabelsAtLocations:(NSSet *)locations; - -/// @} - -@end - -#pragma mark - - -@interface CPTAxis : CPTLayer { - @private - CPTCoordinate coordinate; - CPTPlotSpace *plotSpace; - NSSet *majorTickLocations; - NSSet *minorTickLocations; - CGFloat majorTickLength; - CGFloat minorTickLength; - CGFloat labelOffset; - CGFloat minorTickLabelOffset; - CGFloat labelRotation; - CGFloat minorTickLabelRotation; - CPTAlignment labelAlignment; - CPTAlignment minorTickLabelAlignment; - CPTLineStyle *axisLineStyle; - CPTLineStyle *majorTickLineStyle; - CPTLineStyle *minorTickLineStyle; - CPTLineStyle *majorGridLineStyle; - CPTLineStyle *minorGridLineStyle; - CPTLineCap *axisLineCapMin; - CPTLineCap *axisLineCapMax; - NSDecimal labelingOrigin; - NSDecimal majorIntervalLength; - NSUInteger minorTicksPerInterval; - NSUInteger preferredNumberOfMajorTicks; - CPTAxisLabelingPolicy labelingPolicy; - CPTTextStyle *labelTextStyle; - CPTTextStyle *minorTickLabelTextStyle; - CPTTextStyle *titleTextStyle; - NSNumberFormatter *labelFormatter; - NSNumberFormatter *minorTickLabelFormatter; - BOOL labelFormatterChanged; - BOOL minorLabelFormatterChanged; - NSSet *axisLabels; - NSSet *minorTickAxisLabels; - CPTAxisTitle *axisTitle; - NSString *title; - CGFloat titleOffset; - CGFloat titleRotation; - NSDecimal titleLocation; - CPTSign tickDirection; - BOOL needsRelabel; - NSArray *labelExclusionRanges; - CPTPlotRange *visibleRange; - CPTPlotRange *visibleAxisRange; - CPTPlotRange *gridLinesRange; - NSArray *alternatingBandFills; - NSMutableArray *mutableBackgroundLimitBands; - BOOL separateLayers; - CPTShadow *labelShadow; - __cpt_weak CPTPlotArea *plotArea; - __cpt_weak CPTGridLines *minorGridLines; - __cpt_weak CPTGridLines *majorGridLines; -} - -/// @name Axis -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *axisLineStyle; -@property (nonatomic, readwrite, assign) CPTCoordinate coordinate; -@property (nonatomic, readwrite, assign) NSDecimal labelingOrigin; -@property (nonatomic, readwrite, assign) CPTSign tickDirection; -@property (nonatomic, readwrite, copy) CPTPlotRange *visibleRange; -@property (nonatomic, readwrite, copy) CPTPlotRange *visibleAxisRange; -@property (nonatomic, readwrite, copy) CPTLineCap *axisLineCapMin; -@property (nonatomic, readwrite, copy) CPTLineCap *axisLineCapMax; -/// @} - -/// @name Title -/// @{ -@property (nonatomic, readwrite, copy) CPTTextStyle *titleTextStyle; -@property (nonatomic, readwrite, retain) CPTAxisTitle *axisTitle; -@property (nonatomic, readwrite, assign) CGFloat titleOffset; -@property (nonatomic, readwrite, copy) NSString *title; -@property (nonatomic, readwrite, assign) CGFloat titleRotation; -@property (nonatomic, readwrite, assign) NSDecimal titleLocation; -@property (nonatomic, readonly, assign) NSDecimal defaultTitleLocation; -/// @} - -/// @name Labels -/// @{ -@property (nonatomic, readwrite, assign) CPTAxisLabelingPolicy labelingPolicy; -@property (nonatomic, readwrite, assign) CGFloat labelOffset; -@property (nonatomic, readwrite, assign) CGFloat minorTickLabelOffset; -@property (nonatomic, readwrite, assign) CGFloat labelRotation; -@property (nonatomic, readwrite, assign) CGFloat minorTickLabelRotation; -@property (nonatomic, readwrite, assign) CPTAlignment labelAlignment; -@property (nonatomic, readwrite, assign) CPTAlignment minorTickLabelAlignment; -@property (nonatomic, readwrite, copy) CPTTextStyle *labelTextStyle; -@property (nonatomic, readwrite, copy) CPTTextStyle *minorTickLabelTextStyle; -@property (nonatomic, readwrite, retain) NSNumberFormatter *labelFormatter; -@property (nonatomic, readwrite, retain) NSNumberFormatter *minorTickLabelFormatter; -@property (nonatomic, readwrite, retain) NSSet *axisLabels; -@property (nonatomic, readwrite, retain) NSSet *minorTickAxisLabels; -@property (nonatomic, readonly, assign) BOOL needsRelabel; -@property (nonatomic, readwrite, retain) NSArray *labelExclusionRanges; -@property (nonatomic, readwrite, retain) CPTShadow *labelShadow; -/// @} - -/// @name Major Ticks -/// @{ -@property (nonatomic, readwrite, assign) NSDecimal majorIntervalLength; -@property (nonatomic, readwrite, assign) CGFloat majorTickLength; -@property (nonatomic, readwrite, copy) CPTLineStyle *majorTickLineStyle; -@property (nonatomic, readwrite, retain) NSSet *majorTickLocations; -@property (nonatomic, readwrite, assign) NSUInteger preferredNumberOfMajorTicks; -/// @} - -/// @name Minor Ticks -/// @{ -@property (nonatomic, readwrite, assign) NSUInteger minorTicksPerInterval; -@property (nonatomic, readwrite, assign) CGFloat minorTickLength; -@property (nonatomic, readwrite, copy) CPTLineStyle *minorTickLineStyle; -@property (nonatomic, readwrite, retain) NSSet *minorTickLocations; -/// @} - -/// @name Grid Lines -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *majorGridLineStyle; -@property (nonatomic, readwrite, copy) CPTLineStyle *minorGridLineStyle; -@property (nonatomic, readwrite, copy) CPTPlotRange *gridLinesRange; -/// @} - -/// @name Background Bands -/// @{ -@property (nonatomic, readwrite, copy) NSArray *alternatingBandFills; -@property (nonatomic, readonly, retain) NSArray *backgroundLimitBands; -/// @} - -/// @name Plot Space -/// @{ -@property (nonatomic, readwrite, retain) CPTPlotSpace *plotSpace; -/// @} - -/// @name Layers -/// @{ -@property (nonatomic, readwrite, assign) BOOL separateLayers; -@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTPlotArea *plotArea; -@property (nonatomic, readonly, cpt_weak_property) __cpt_weak CPTGridLines *minorGridLines; -@property (nonatomic, readonly, cpt_weak_property) __cpt_weak CPTGridLines *majorGridLines; -@property (nonatomic, readonly, retain) CPTAxisSet *axisSet; -/// @} - -/// @name Labels -/// @{ --(void)relabel; --(void)setNeedsRelabel; --(void)updateMajorTickLabels; --(void)updateMinorTickLabels; -/// @} - -/// @name Ticks -/// @{ --(NSSet *)filteredMajorTickLocations:(NSSet *)allLocations; --(NSSet *)filteredMinorTickLocations:(NSSet *)allLocations; -/// @} - -/// @name Background Bands -/// @{ --(void)addBackgroundLimitBand:(CPTLimitBand *)limitBand; --(void)removeBackgroundLimitBand:(CPTLimitBand *)limitBand; -/// @} - -@end - -#pragma mark - - -/** @category CPTAxis(AbstractMethods) - * @brief CPTAxis abstract methods—must be overridden by subclasses - **/ -@interface CPTAxis(AbstractMethods) - -/// @name Coordinate Space Conversions -/// @{ --(CGPoint)viewPointForCoordinateDecimalNumber:(NSDecimal)coordinateDecimalNumber; -/// @} - -/// @name Grid Lines -/// @{ --(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major; -/// @} - -/// @name Background Bands -/// @{ --(void)drawBackgroundBandsInContext:(CGContextRef)context; --(void)drawBackgroundLimitsInContext:(CGContextRef)context; -/// @} - -@end diff --git a/CorePlotHeaders/CPTAxisLabel.h b/CorePlotHeaders/CPTAxisLabel.h deleted file mode 100755 index 034182d..0000000 --- a/CorePlotHeaders/CPTAxisLabel.h +++ /dev/null @@ -1,34 +0,0 @@ -#import "CPTDefinitions.h" -#import - -@class CPTLayer; -@class CPTTextStyle; - -@interface CPTAxisLabel : NSObject { - @private - CPTLayer *contentLayer; - CGFloat offset; - CGFloat rotation; - CPTAlignment alignment; - NSDecimal tickLocation; -} - -@property (nonatomic, readwrite, retain) CPTLayer *contentLayer; -@property (nonatomic, readwrite, assign) CGFloat offset; -@property (nonatomic, readwrite, assign) CGFloat rotation; -@property (nonatomic, readwrite, assign) CPTAlignment alignment; -@property (nonatomic, readwrite) NSDecimal tickLocation; - -/// @name Initialization -/// @{ --(id)initWithText:(NSString *)newText textStyle:(CPTTextStyle *)style; --(id)initWithContentLayer:(CPTLayer *)layer; -/// @} - -/// @name Layout -/// @{ --(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)coordinate inDirection:(CPTSign)direction; --(void)positionBetweenViewPoint:(CGPoint)firstPoint andViewPoint:(CGPoint)secondPoint forCoordinate:(CPTCoordinate)coordinate inDirection:(CPTSign)direction; -/// @} - -@end diff --git a/CorePlotHeaders/CPTAxisLabelGroup.h b/CorePlotHeaders/CPTAxisLabelGroup.h deleted file mode 100755 index eb19f37..0000000 --- a/CorePlotHeaders/CPTAxisLabelGroup.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "CPTLayer.h" -#import - -@interface CPTAxisLabelGroup : CPTLayer { -} - -@end diff --git a/CorePlotHeaders/CPTAxisSet.h b/CorePlotHeaders/CPTAxisSet.h deleted file mode 100755 index 2e40035..0000000 --- a/CorePlotHeaders/CPTAxisSet.h +++ /dev/null @@ -1,33 +0,0 @@ -#import "CPTLayer.h" -#import - -@class CPTAxis; -@class CPTLineStyle; - -@interface CPTAxisSet : CPTLayer { - @private - NSArray *axes; - CPTLineStyle *borderLineStyle; -} - -/// @name Axes -/// @{ -@property (nonatomic, readwrite, retain) NSArray *axes; -/// @} - -/// @name Drawing -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle; -/// @} - -/// @name Labels -/// @{ --(void)relabelAxes; -/// @} - -/// @name Axes -/// @{ --(CPTAxis *)axisForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx; -/// @} - -@end diff --git a/CorePlotHeaders/CPTAxisTitle.h b/CorePlotHeaders/CPTAxisTitle.h deleted file mode 100755 index 81370b6..0000000 --- a/CorePlotHeaders/CPTAxisTitle.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "CPTAxisLabel.h" -#import - -@interface CPTAxisTitle : CPTAxisLabel { -} - -@end diff --git a/CorePlotHeaders/CPTBarPlot.h b/CorePlotHeaders/CPTBarPlot.h deleted file mode 100755 index b1ec348..0000000 --- a/CorePlotHeaders/CPTBarPlot.h +++ /dev/null @@ -1,185 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTPlot.h" -#import - -/// @file - -@class CPTLineStyle; -@class CPTMutableNumericData; -@class CPTNumericData; -@class CPTFill; -@class CPTPlotRange; -@class CPTColor; -@class CPTBarPlot; -@class CPTTextLayer; -@class CPTTextStyle; - -/// @ingroup plotBindingsBarPlot -/// @{ -extern NSString *const CPTBarPlotBindingBarLocations; -extern NSString *const CPTBarPlotBindingBarTips; -extern NSString *const CPTBarPlotBindingBarBases; -extern NSString *const CPTBarPlotBindingBarFills; -extern NSString *const CPTBarPlotBindingBarLineStyles; -/// @} - -/** - * @brief Enumeration of bar plot data source field types - **/ -typedef enum _CPTBarPlotField { - CPTBarPlotFieldBarLocation, ///< Bar location on independent coordinate axis. - CPTBarPlotFieldBarTip, ///< Bar tip value. - CPTBarPlotFieldBarBase ///< Bar base (used only if @link CPTBarPlot::barBasesVary barBasesVary @endlink is YES). -} -CPTBarPlotField; - -#pragma mark - - -/** - * @brief A bar plot data source. - **/ -@protocol CPTBarPlotDataSource -@optional - -/// @name Bar Style -/// @{ - -/** @brief @optional Gets an array of bar fills for the given bar plot. - * @param barPlot The bar plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of bar fills. - **/ --(NSArray *)barFillsForBarPlot:(CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a bar fill for the given bar plot. - * This method will not be called if - * @link CPTBarPlotDataSource::barFillsForBarPlot:recordIndexRange: -barFillsForBarPlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param barPlot The bar plot. - * @param idx The data index of interest. - * @return The bar fill for the bar with the given index. If the data source returns @nil, the default fill is used. - * If the data source returns an NSNull object, no fill is drawn. - **/ --(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; - -/** @brief @optional Gets an array of bar line styles for the given bar plot. - * @param barPlot The bar plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of line styles. - **/ --(NSArray *)barLineStylesForBarPlot:(CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a bar line style for the given bar plot. - * This method will not be called if - * @link CPTBarPlotDataSource::barLineStylesForBarPlot:recordIndexRange: -barLineStylesForBarPlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param barPlot The bar plot. - * @param idx The data index of interest. - * @return The bar line style for the bar with the given index. If the data source returns @nil, the default line style is used. - * If the data source returns an NSNull object, no line is drawn. - **/ --(CPTLineStyle *)barLineStyleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; - -/// @} - -/// @name Legends -/// @{ - -/** @brief @optional Gets the legend title for the given bar plot bar. - * @param barPlot The bar plot. - * @param idx The data index of interest. - * @return The title text for the legend entry for the point with the given index. - **/ --(NSString *)legendTitleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; - -/// @} -@end - -#pragma mark - - -/** - * @brief Bar plot delegate. - **/ -@protocol CPTBarPlotDelegate - -@optional - -/// @name Point Selection -/// @{ - -/** @brief @optional Informs the delegate that a bar was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The bar plot. - * @param idx The index of the - * @if MacOnly clicked bar. @endif - * @if iOSOnly touched bar. @endif - **/ --(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx; - -/** @brief @optional Informs the delegate that a bar was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The bar plot. - * @param idx The index of the - * @if MacOnly clicked bar. @endif - * @if iOSOnly touched bar. @endif - * @param event The event that triggered the selection. - **/ --(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; - -/// @} - -@end - -#pragma mark - - -@interface CPTBarPlot : CPTPlot { - @private - CPTLineStyle *lineStyle; - CPTFill *fill; - NSDecimal barWidth; - CGFloat barWidthScale; - NSDecimal barOffset; - CGFloat barOffsetScale; - CGFloat barCornerRadius; - CGFloat barBaseCornerRadius; - NSDecimal baseValue; - BOOL barsAreHorizontal; - BOOL barBasesVary; - BOOL barWidthsAreInViewCoordinates; - CPTPlotRange *plotRange; -} - -/// @name Appearance -/// @{ -@property (nonatomic, readwrite, assign) BOOL barWidthsAreInViewCoordinates; -@property (nonatomic, readwrite, assign) NSDecimal barWidth; -@property (nonatomic, readwrite, assign) CGFloat barWidthScale; -@property (nonatomic, readwrite, assign) NSDecimal barOffset; -@property (nonatomic, readwrite, assign) CGFloat barOffsetScale; -@property (nonatomic, readwrite, assign) CGFloat barCornerRadius; -@property (nonatomic, readwrite, assign) CGFloat barBaseCornerRadius; -@property (nonatomic, readwrite, assign) BOOL barsAreHorizontal; -@property (nonatomic, readwrite, assign) NSDecimal baseValue; -@property (nonatomic, readwrite, assign) BOOL barBasesVary; -@property (nonatomic, readwrite, copy) CPTPlotRange *plotRange; -/// @} - -/// @name Drawing -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *lineStyle; -@property (nonatomic, readwrite, copy) CPTFill *fill; -/// @} - -/// @name Factory Methods -/// @{ -+(CPTBarPlot *)tubularBarPlotWithColor:(CPTColor *)color horizontalBars:(BOOL)horizontal; -/// @} - -/// @name Data Ranges -/// @{ --(CPTPlotRange *)plotRangeEnclosingBars; -/// @} - -@end diff --git a/CorePlotHeaders/CPTBorderedLayer.h b/CorePlotHeaders/CPTBorderedLayer.h deleted file mode 100755 index 9fb4d9e..0000000 --- a/CorePlotHeaders/CPTBorderedLayer.h +++ /dev/null @@ -1,30 +0,0 @@ -#import "CPTAnnotationHostLayer.h" -#import - -@class CPTLineStyle; -@class CPTFill; - -@interface CPTBorderedLayer : CPTAnnotationHostLayer { - @private - CPTLineStyle *borderLineStyle; - CPTFill *fill; - BOOL inLayout; -} - -/// @name Drawing -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle; -@property (nonatomic, readwrite, copy) CPTFill *fill; -/// @} - -/// @name Layout -/// @{ -@property (nonatomic, readwrite) BOOL inLayout; -/// @} - -/// @name Drawing -/// @{ --(void)renderBorderedLayer:(CPTBorderedLayer *)layer asVectorInContext:(CGContextRef)context; -/// @} - -@end diff --git a/CorePlotHeaders/CPTCalendarFormatter.h b/CorePlotHeaders/CPTCalendarFormatter.h deleted file mode 100755 index 1aaaef2..0000000 --- a/CorePlotHeaders/CPTCalendarFormatter.h +++ /dev/null @@ -1,21 +0,0 @@ -#import - -@interface CPTCalendarFormatter : NSNumberFormatter { - @private - NSDateFormatter *dateFormatter; - NSDate *referenceDate; - NSCalendar *referenceCalendar; - NSCalendarUnit referenceCalendarUnit; -} - -@property (nonatomic, readwrite, retain) NSDateFormatter *dateFormatter; -@property (nonatomic, readwrite, copy) NSDate *referenceDate; -@property (nonatomic, readwrite, copy) NSCalendar *referenceCalendar; -@property (nonatomic, readwrite, assign) NSCalendarUnit referenceCalendarUnit; - -/// @name Initialization -/// @{ --(id)initWithDateFormatter:(NSDateFormatter *)aDateFormatter; -/// @} - -@end diff --git a/CorePlotHeaders/CPTColor.h b/CorePlotHeaders/CPTColor.h deleted file mode 100755 index 20e3003..0000000 --- a/CorePlotHeaders/CPTColor.h +++ /dev/null @@ -1,42 +0,0 @@ -#import -#import - -@interface CPTColor : NSObject { - @private - CGColorRef cgColor; -} - -@property (nonatomic, readonly, assign) CGColorRef cgColor; - -/// @name Factory Methods -/// @{ -+(CPTColor *)clearColor; -+(CPTColor *)whiteColor; -+(CPTColor *)lightGrayColor; -+(CPTColor *)grayColor; -+(CPTColor *)darkGrayColor; -+(CPTColor *)blackColor; -+(CPTColor *)redColor; -+(CPTColor *)greenColor; -+(CPTColor *)blueColor; -+(CPTColor *)cyanColor; -+(CPTColor *)yellowColor; -+(CPTColor *)magentaColor; -+(CPTColor *)orangeColor; -+(CPTColor *)purpleColor; -+(CPTColor *)brownColor; - -+(CPTColor *)colorWithCGColor:(CGColorRef)newCGColor; -+(CPTColor *)colorWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; -+(CPTColor *)colorWithGenericGray:(CGFloat)gray; -/// @} - -/// @name Initialization -/// @{ --(id)initWithCGColor:(CGColorRef)cgColor; --(id)initWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; - --(CPTColor *)colorWithAlphaComponent:(CGFloat)alpha; -/// @} - -@end diff --git a/CorePlotHeaders/CPTColorSpace.h b/CorePlotHeaders/CPTColorSpace.h deleted file mode 100755 index 165d576..0000000 --- a/CorePlotHeaders/CPTColorSpace.h +++ /dev/null @@ -1,21 +0,0 @@ -#import -#import - -@interface CPTColorSpace : NSObject { - @private - CGColorSpaceRef cgColorSpace; -} - -@property (nonatomic, readonly, assign) CGColorSpaceRef cgColorSpace; - -/// @name Factory Methods -/// @{ -+(CPTColorSpace *)genericRGBSpace; -/// @} - -/// @name Initialization -/// @{ --(id)initWithCGColorSpace:(CGColorSpaceRef)colorSpace; -/// @} - -@end diff --git a/CorePlotHeaders/CPTConstraints.h b/CorePlotHeaders/CPTConstraints.h deleted file mode 100755 index 160c7f6..0000000 --- a/CorePlotHeaders/CPTConstraints.h +++ /dev/null @@ -1,38 +0,0 @@ -#import -#import - -@interface CPTConstraints : NSObject { -} - -/// @name Factory Methods -/// @{ -+(CPTConstraints *)constraintWithLowerOffset:(CGFloat)newOffset; -+(CPTConstraints *)constraintWithUpperOffset:(CGFloat)newOffset; -+(CPTConstraints *)constraintWithRelativeOffset:(CGFloat)newOffset; -/// @} - -/// @name Initialization -/// @{ --(id)initWithLowerOffset:(CGFloat)newOffset; --(id)initWithUpperOffset:(CGFloat)newOffset; --(id)initWithRelativeOffset:(CGFloat)newOffset; -/// @} - -@end - -/** @category CPTConstraints(AbstractMethods) - * @brief CPTConstraints abstract methods—must be overridden by subclasses - **/ -@interface CPTConstraints(AbstractMethods) - -/// @name Comparison -/// @{ --(BOOL)isEqualToConstraint:(CPTConstraints *)otherConstraint; -/// @} - -/// @name Position -/// @{ --(CGFloat)positionForLowerBound:(CGFloat)lowerBound upperBound:(CGFloat)upperBound; -/// @} - -@end diff --git a/CorePlotHeaders/CPTDataSourceTestCase.h b/CorePlotHeaders/CPTDataSourceTestCase.h deleted file mode 100755 index 60e2e7c..0000000 --- a/CorePlotHeaders/CPTDataSourceTestCase.h +++ /dev/null @@ -1,28 +0,0 @@ -#import "CPTTestCase.h" - -#import "CPTPlot.h" - -@class CPTMutablePlotRange; - -@interface CPTDataSourceTestCase : CPTTestCase { - @private - NSArray *xData, *yData; - CPTMutablePlotRange *xRange, *yRange; - - NSMutableArray *plots; - - NSUInteger nRecords; -} - -@property (copy, readwrite) NSArray *xData; -@property (copy, readwrite) NSArray *yData; -@property (assign, readwrite) NSUInteger nRecords; -@property (retain, readonly) CPTMutablePlotRange *xRange; -@property (retain, readonly) CPTMutablePlotRange *yRange; -@property (retain, readwrite) NSMutableArray *plots; - --(void)buildData; - --(void)addPlot:(CPTPlot *)newPlot; - -@end diff --git a/CorePlotHeaders/CPTDefinitions.h b/CorePlotHeaders/CPTDefinitions.h deleted file mode 100755 index d832a25..0000000 --- a/CorePlotHeaders/CPTDefinitions.h +++ /dev/null @@ -1,190 +0,0 @@ -#import -#import - -#import -#import - -/// @file - -/** - * @def CPT_SDK_SUPPORTS_WEAK - * @hideinitializer - * @brief Defined as @num{1} if the compiler and active SDK support weak references, @num{0} otherwise. - **/ - -/** - * @def __cpt_weak - * @hideinitializer - * @brief A custom definition for automatic reference counting (ARC) weak references that falls back to - * __unsafe_unretained values on older platforms. - **/ - -/** - * @def cpt_weak_property - * @hideinitializer - * @brief A custom definition for automatic reference counting (ARC) weak properties that falls back to - * assign on older platforms. - **/ - -// This is based on Ryan Petrich's ZWRCompatibility: https://github.com/rpetrich/ZWRCompatibility - -#if TARGET_OS_IPHONE && defined(__IPHONE_5_0) && (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_5_0) && __clang__ && (__clang_major__ >= 3) -#define CPT_SDK_SUPPORTS_WEAK 1 -#elif TARGET_OS_MAC && defined(__MAC_10_7) && (MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_7) && __clang__ && (__clang_major__ >= 3) -#define CPT_SDK_SUPPORTS_WEAK 1 -#else -#define CPT_SDK_SUPPORTS_WEAK 0 -#endif - -#if CPT_SDK_SUPPORTS_WEAK -#define __cpt_weak __weak -#define cpt_weak_property weak -#else -#if __clang__ && (__clang_major__ >= 3) -#define __cpt_weak __unsafe_unretained -#else -#define __cpt_weak -#endif -#define cpt_weak_property assign -#endif - -// Type safety defines - -/** - * @def CPTFloat - * @hideinitializer - * @param x The number to cast. - * @brief Casts a number to @ref CGFloat. - **/ -#define CPTFloat(x) ( (CGFloat)(x) ) - -/** - * @def CPTPointMake - * @hideinitializer - * @param x The x-coordinate of the point. - * @param y The y-coordinate of the point. - * @brief A replacement for @ref CGPointMake(), casting each parameter to @ref CGFloat. - **/ -#define CPTPointMake(x, y) CGPointMake( (CGFloat)(x), (CGFloat)(y) ) - -/** - * @def CPTSizeMake - * @hideinitializer - * @param w The width of the size. - * @param h The height of the size. - * @brief A replacement for @ref CGSizeMake(), casting each parameter to @ref CGFloat. - **/ -#define CPTSizeMake(w, h) CGSizeMake( (CGFloat)(w), (CGFloat)(h) ) - -/** - * @def CPTRectMake - * @hideinitializer - * @param x The x-coordinate of the rectangle. - * @param y The y-coordinate of the rectangle. - * @param w The width of the rectangle. - * @param h The height of the rectangle. - * @brief A replacement for @ref CGRectMake(), casting each parameter to @ref CGFloat. - **/ -#define CPTRectMake(x, y, w, h) CGRectMake( (CGFloat)(x), (CGFloat)(y), (CGFloat)(w), (CGFloat)(h) ) - -/** - * @def CPTRectInset - * @hideinitializer - * @param rect The rectangle to offset. - * @param dx The x-offset. - * @param dy The y-offset. - * @brief A replacement for @ref CGRectInset(), casting each offset parameter to @ref CGFloat. - **/ -#define CPTRectInset(rect, dx, dy) CGRectInset( rect, (CGFloat)(dx), (CGFloat)(dy) ) - -/** - * @brief Enumeration of numeric types - **/ -typedef enum _CPTNumericType { - CPTNumericTypeInteger, ///< Integer - CPTNumericTypeFloat, ///< Float - CPTNumericTypeDouble ///< Double -} -CPTNumericType; - -/** - * @brief Enumeration of error bar types - **/ -typedef enum _CPTErrorBarType { - CPTErrorBarTypeCustom, ///< Custom error bars - CPTErrorBarTypeConstantRatio, ///< Constant ratio error bars - CPTErrorBarTypeConstantValue ///< Constant value error bars -} -CPTErrorBarType; - -/** - * @brief Enumeration of axis scale types - **/ -typedef enum _CPTScaleType { - CPTScaleTypeLinear, ///< Linear axis scale - CPTScaleTypeLog, ///< Logarithmic axis scale - CPTScaleTypeAngular, ///< Angular axis scale (not implemented) - CPTScaleTypeDateTime, ///< Date/time axis scale (not implemented) - CPTScaleTypeCategory ///< Category axis scale (not implemented) -} -CPTScaleType; - -/** - * @brief Enumeration of axis coordinates - **/ -typedef enum _CPTCoordinate { - CPTCoordinateX = 0, ///< X axis - CPTCoordinateY = 1, ///< Y axis - CPTCoordinateZ = 2 ///< Z axis -} -CPTCoordinate; - -/** - * @brief RGBA color for gradients - **/ -typedef struct _CPTRGBAColor { - CGFloat red; ///< The red component (0 ≤ @par{red} ≤ 1). - CGFloat green; ///< The green component (0 ≤ @par{green} ≤ 1). - CGFloat blue; ///< The blue component (0 ≤ @par{blue} ≤ 1). - CGFloat alpha; ///< The alpha component (0 ≤ @par{alpha} ≤ 1). -} -CPTRGBAColor; - -/** - * @brief Enumeration of label positioning offset directions - **/ -typedef enum _CPTSign { - CPTSignNone = 0, ///< No offset - CPTSignPositive = +1, ///< Positive offset - CPTSignNegative = -1 ///< Negative offset -} -CPTSign; - -/** - * @brief Locations around the edge of a rectangle. - **/ -typedef enum _CPTRectAnchor { - CPTRectAnchorBottomLeft, ///< The bottom left corner - CPTRectAnchorBottom, ///< The bottom center - CPTRectAnchorBottomRight, ///< The bottom right corner - CPTRectAnchorLeft, ///< The left middle - CPTRectAnchorRight, ///< The right middle - CPTRectAnchorTopLeft, ///< The top left corner - CPTRectAnchorTop, ///< The top center - CPTRectAnchorTopRight, ///< The top right - CPTRectAnchorCenter ///< The center of the rect -} -CPTRectAnchor; - -/** - * @brief Label and constraint alignment constants. - **/ -typedef enum _CPTAlignment { - CPTAlignmentLeft, ///< Align horizontally to the left side. - CPTAlignmentCenter, ///< Align horizontally to the center. - CPTAlignmentRight, ///< Align horizontally to the right side. - CPTAlignmentTop, ///< Align vertically to the top. - CPTAlignmentMiddle, ///< Align vertically to the middle. - CPTAlignmentBottom ///< Align vertically to the bottom. -} -CPTAlignment; diff --git a/CorePlotHeaders/CPTDerivedXYGraph.h b/CorePlotHeaders/CPTDerivedXYGraph.h deleted file mode 100755 index a2c1e13..0000000 --- a/CorePlotHeaders/CPTDerivedXYGraph.h +++ /dev/null @@ -1,6 +0,0 @@ -#import "CPTXYGraph.h" - -@interface CPTDerivedXYGraph : CPTXYGraph { -} - -@end diff --git a/CorePlotHeaders/CPTExceptions.h b/CorePlotHeaders/CPTExceptions.h deleted file mode 100755 index 7d262d4..0000000 --- a/CorePlotHeaders/CPTExceptions.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -/// @file - -/// @name Custom Exception Identifiers -/// @{ -extern NSString *const CPTException; -extern NSString *const CPTDataException; -extern NSString *const CPTNumericDataException; -/// @} diff --git a/CorePlotHeaders/CPTFill.h b/CorePlotHeaders/CPTFill.h deleted file mode 100755 index 29ec535..0000000 --- a/CorePlotHeaders/CPTFill.h +++ /dev/null @@ -1,38 +0,0 @@ -#import -#import - -@class CPTGradient; -@class CPTImage; -@class CPTColor; - -@interface CPTFill : NSObject { -} - -/// @name Factory Methods -/// @{ -+(CPTFill *)fillWithColor:(CPTColor *)aColor; -+(CPTFill *)fillWithGradient:(CPTGradient *)aGradient; -+(CPTFill *)fillWithImage:(CPTImage *)anImage; -/// @} - -/// @name Initialization -/// @{ --(id)initWithColor:(CPTColor *)aColor; --(id)initWithGradient:(CPTGradient *)aGradient; --(id)initWithImage:(CPTImage *)anImage; -/// @} - -@end - -/** @category CPTFill(AbstractMethods) - * @brief CPTFill abstract methods—must be overridden by subclasses - **/ -@interface CPTFill(AbstractMethods) - -/// @name Drawing -/// @{ --(void)fillRect:(CGRect)rect inContext:(CGContextRef)context; --(void)fillPathInContext:(CGContextRef)context; -/// @} - -@end diff --git a/CorePlotHeaders/CPTGradient.h b/CorePlotHeaders/CPTGradient.h deleted file mode 100755 index b8b29f6..0000000 --- a/CorePlotHeaders/CPTGradient.h +++ /dev/null @@ -1,100 +0,0 @@ -// Based on CTGradient (http://blog.oofn.net/2006/01/15/gradients-in-cocoa/) -// CTGradient is in public domain (Thanks Chad Weider!) - -/// @file - -#import "CPTDefinitions.h" -#import - -/** - * @brief A structure representing one node in a linked list of RGBA colors. - **/ -typedef struct _CPTGradientElement { - CPTRGBAColor color; ///< Color - CGFloat position; ///< Gradient position (0 ≤ @par{position} ≤ 1) - - struct _CPTGradientElement *nextElement; ///< Pointer to the next CPTGradientElement in the list (last element == @NULL) -} -CPTGradientElement; - -/** - * @brief Enumeration of blending modes - **/ -typedef enum _CPTBlendingMode { - CPTLinearBlendingMode, ///< Linear blending mode - CPTChromaticBlendingMode, ///< Chromatic blending mode - CPTInverseChromaticBlendingMode ///< Inverse chromatic blending mode -} -CPTGradientBlendingMode; - -/** - * @brief Enumeration of gradient types - **/ -typedef enum _CPTGradientType { - CPTGradientTypeAxial, ///< Axial gradient - CPTGradientTypeRadial ///< Radial gradient -} -CPTGradientType; - -@class CPTColorSpace; -@class CPTColor; - -@interface CPTGradient : NSObject { - @private - CPTColorSpace *colorspace; - CPTGradientElement *elementList; - CPTGradientBlendingMode blendingMode; - CGFunctionRef gradientFunction; - CGFloat angle; // angle in degrees - CPTGradientType gradientType; -} - -@property (nonatomic, readonly, assign) CPTGradientBlendingMode blendingMode; -@property (nonatomic, readwrite, assign) CGFloat angle; -@property (nonatomic, readwrite, assign) CPTGradientType gradientType; - -/// @name Factory Methods -/// @{ -+(CPTGradient *)gradientWithBeginningColor:(CPTColor *)begin endingColor:(CPTColor *)end; -+(CPTGradient *)gradientWithBeginningColor:(CPTColor *)begin endingColor:(CPTColor *)end beginningPosition:(CGFloat)beginningPosition endingPosition:(CGFloat)endingPosition; - -+(CPTGradient *)aquaSelectedGradient; -+(CPTGradient *)aquaNormalGradient; -+(CPTGradient *)aquaPressedGradient; - -+(CPTGradient *)unifiedSelectedGradient; -+(CPTGradient *)unifiedNormalGradient; -+(CPTGradient *)unifiedPressedGradient; -+(CPTGradient *)unifiedDarkGradient; - -+(CPTGradient *)sourceListSelectedGradient; -+(CPTGradient *)sourceListUnselectedGradient; - -+(CPTGradient *)rainbowGradient; -+(CPTGradient *)hydrogenSpectrumGradient; -/// @} - -/// @name Modification -/// @{ --(CPTGradient *)gradientWithAlphaComponent:(CGFloat)alpha; --(CPTGradient *)gradientWithBlendingMode:(CPTGradientBlendingMode)mode; - --(CPTGradient *)addColorStop:(CPTColor *)color atPosition:(CGFloat)position; // positions given relative to [0,1] --(CPTGradient *)removeColorStopAtIndex:(NSUInteger)idx; --(CPTGradient *)removeColorStopAtPosition:(CGFloat)position; -/// @} - -/// @name Information -/// @{ --(CGColorRef)newColorStopAtIndex:(NSUInteger)idx; --(CGColorRef)newColorAtPosition:(CGFloat)position; -/// @} - -/// @name Drawing -/// @{ --(void)drawSwatchInRect:(CGRect)rect inContext:(CGContextRef)context; --(void)fillRect:(CGRect)rect inContext:(CGContextRef)context; --(void)fillPathInContext:(CGContextRef)context; -/// @} - -@end diff --git a/CorePlotHeaders/CPTGraph.h b/CorePlotHeaders/CPTGraph.h deleted file mode 100755 index ad8b9f8..0000000 --- a/CorePlotHeaders/CPTGraph.h +++ /dev/null @@ -1,143 +0,0 @@ -// Abstract class -#import "CPTBorderedLayer.h" -#import "CPTDefinitions.h" - -/// @file - -@class CPTAxisSet; -@class CPTGraphHostingView; -@class CPTLegend; -@class CPTPlot; -@class CPTPlotAreaFrame; -@class CPTPlotSpace; -@class CPTTheme; -@class CPTTextStyle; -@class CPTLayerAnnotation; - -/// @name Graph -/// @{ - -/** @brief Notification sent by various objects to tell the graph it should redraw itself. - * @ingroup notification - **/ -extern NSString *const CPTGraphNeedsRedrawNotification; - -/// @} - -/** - * @brief Enumeration of graph layers. - **/ -typedef enum _CPTGraphLayerType { - CPTGraphLayerTypeMinorGridLines, ///< Minor grid lines. - CPTGraphLayerTypeMajorGridLines, ///< Major grid lines. - CPTGraphLayerTypeAxisLines, ///< Axis lines. - CPTGraphLayerTypePlots, ///< Plots. - CPTGraphLayerTypeAxisLabels, ///< Axis labels. - CPTGraphLayerTypeAxisTitles ///< Axis titles. -} -CPTGraphLayerType; - -#pragma mark - - -@interface CPTGraph : CPTBorderedLayer { - @private - __cpt_weak CPTGraphHostingView *hostingView; - CPTPlotAreaFrame *plotAreaFrame; - NSMutableArray *plots; - NSMutableArray *plotSpaces; - NSString *title; - CPTTextStyle *titleTextStyle; - CPTRectAnchor titlePlotAreaFrameAnchor; - CGPoint titleDisplacement; - CPTLayerAnnotation *titleAnnotation; - CPTLegend *legend; - CPTLayerAnnotation *legendAnnotation; - CPTRectAnchor legendAnchor; - CGPoint legendDisplacement; -} - -/// @name Hosting View -/// @{ -@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTGraphHostingView *hostingView; -/// @} - -/// @name Title -/// @{ -@property (nonatomic, readwrite, copy) NSString *title; -@property (nonatomic, readwrite, copy) CPTTextStyle *titleTextStyle; -@property (nonatomic, readwrite, assign) CGPoint titleDisplacement; -@property (nonatomic, readwrite, assign) CPTRectAnchor titlePlotAreaFrameAnchor; -/// @} - -/// @name Layers -/// @{ -@property (nonatomic, readwrite, retain) CPTAxisSet *axisSet; -@property (nonatomic, readwrite, retain) CPTPlotAreaFrame *plotAreaFrame; -@property (nonatomic, readonly, retain) CPTPlotSpace *defaultPlotSpace; -@property (nonatomic, readwrite, retain) NSArray *topDownLayerOrder; -/// @} - -/// @name Legend -/// @{ -@property (nonatomic, readwrite, retain) CPTLegend *legend; -@property (nonatomic, readwrite, assign) CPTRectAnchor legendAnchor; -@property (nonatomic, readwrite, assign) CGPoint legendDisplacement; -/// @} - -/// @name Data Source -/// @{ --(void)reloadData; --(void)reloadDataIfNeeded; -/// @} - -/// @name Retrieving Plots -/// @{ --(NSArray *)allPlots; --(CPTPlot *)plotAtIndex:(NSUInteger)idx; --(CPTPlot *)plotWithIdentifier:(id)identifier; -/// @} - -/// @name Adding and Removing Plots -/// @{ --(void)addPlot:(CPTPlot *)plot; --(void)addPlot:(CPTPlot *)plot toPlotSpace:(CPTPlotSpace *)space; --(void)removePlot:(CPTPlot *)plot; --(void)removePlotWithIdentifier:(id)identifier; --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx; --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(CPTPlotSpace *)space; -/// @} - -/// @name Retrieving Plot Spaces -/// @{ --(NSArray *)allPlotSpaces; --(CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)idx; --(CPTPlotSpace *)plotSpaceWithIdentifier:(id)identifier; -/// @} - -/// @name Adding and Removing Plot Spaces -/// @{ --(void)addPlotSpace:(CPTPlotSpace *)space; --(void)removePlotSpace:(CPTPlotSpace *)plotSpace; -/// @} - -/// @name Themes -/// @{ --(void)applyTheme:(CPTTheme *)theme; -/// @} - -@end - -#pragma mark - - -/** @category CPTGraph(AbstractFactoryMethods) - * @brief CPTGraph abstract methods—must be overridden by subclasses - **/ -@interface CPTGraph(AbstractFactoryMethods) - -/// @name Factory Methods -/// @{ --(CPTPlotSpace *)newPlotSpace; --(CPTAxisSet *)newAxisSet; -/// @} - -@end diff --git a/CorePlotHeaders/CPTGraphHostingView.h b/CorePlotHeaders/CPTGraphHostingView.h deleted file mode 100755 index a53c6a7..0000000 --- a/CorePlotHeaders/CPTGraphHostingView.h +++ /dev/null @@ -1,18 +0,0 @@ -#import "CPTDefinitions.h" -#import - -@class CPTGraph; - -@interface CPTGraphHostingView : UIView { - @protected - CPTGraph *hostedGraph; - BOOL collapsesLayers; - BOOL allowPinchScaling; - __cpt_weak id pinchGestureRecognizer; -} - -@property (nonatomic, readwrite, retain) CPTGraph *hostedGraph; -@property (nonatomic, readwrite, assign) BOOL collapsesLayers; -@property (nonatomic, readwrite, assign) BOOL allowPinchScaling; - -@end diff --git a/CorePlotHeaders/CPTGridLineGroup.h b/CorePlotHeaders/CPTGridLineGroup.h deleted file mode 100755 index dce8ed2..0000000 --- a/CorePlotHeaders/CPTGridLineGroup.h +++ /dev/null @@ -1,14 +0,0 @@ -#import "CPTLayer.h" - -@class CPTPlotArea; - -@interface CPTGridLineGroup : CPTLayer { - @private - __cpt_weak CPTPlotArea *plotArea; - BOOL major; -} - -@property (nonatomic, readwrite, assign) __cpt_weak CPTPlotArea *plotArea; -@property (nonatomic, readwrite) BOOL major; - -@end diff --git a/CorePlotHeaders/CPTGridLines.h b/CorePlotHeaders/CPTGridLines.h deleted file mode 100755 index 53cc273..0000000 --- a/CorePlotHeaders/CPTGridLines.h +++ /dev/null @@ -1,15 +0,0 @@ -#import "CPTLayer.h" -#import - -@class CPTAxis; - -@interface CPTGridLines : CPTLayer { - @private - __cpt_weak CPTAxis *axis; - BOOL major; -} - -@property (nonatomic, readwrite, assign) __cpt_weak CPTAxis *axis; -@property (nonatomic, readwrite) BOOL major; - -@end diff --git a/CorePlotHeaders/CPTImage.h b/CorePlotHeaders/CPTImage.h deleted file mode 100755 index a3a6663..0000000 --- a/CorePlotHeaders/CPTImage.h +++ /dev/null @@ -1,36 +0,0 @@ -#import -#import - -@interface CPTImage : NSObject { - @private - CGImageRef image; - CGFloat scale; - BOOL tiled; - BOOL tileAnchoredToContext; -} - -@property (nonatomic, readwrite, assign) CGImageRef image; -@property (nonatomic, readwrite, assign) CGFloat scale; -@property (nonatomic, readwrite, assign, getter = isTiled) BOOL tiled; -@property (nonatomic, readwrite, assign) BOOL tileAnchoredToContext; - -/// @name Factory Methods -/// @{ -+(CPTImage *)imageWithCGImage:(CGImageRef)anImage scale:(CGFloat)newScale; -+(CPTImage *)imageWithCGImage:(CGImageRef)anImage; -+(CPTImage *)imageForPNGFile:(NSString *)path; -/// @} - -/// @name Initialization -/// @{ --(id)initWithCGImage:(CGImageRef)anImage scale:(CGFloat)newScale; --(id)initWithCGImage:(CGImageRef)anImage; --(id)initForPNGFile:(NSString *)path; -/// @} - -/// @name Drawing -/// @{ --(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context; -/// @} - -@end diff --git a/CorePlotHeaders/CPTLayer.h b/CorePlotHeaders/CPTLayer.h deleted file mode 100755 index ffd9d79..0000000 --- a/CorePlotHeaders/CPTLayer.h +++ /dev/null @@ -1,119 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTResponder.h" -#import -#import - -@class CPTGraph; -@class CPTShadow; - -/// @name Layout -/// @{ - -/** @brief Notification sent by all layers when the layer @link CALayer::bounds bounds @endlink change. - * @ingroup notification - **/ -extern NSString *const CPTLayerBoundsDidChangeNotification; - -/// @} - -@interface CPTLayer : CALayer { - @private - CGFloat paddingLeft; - CGFloat paddingTop; - CGFloat paddingRight; - CGFloat paddingBottom; - BOOL masksToBorder; - CPTShadow *shadow; - BOOL renderingRecursively; - BOOL useFastRendering; - __cpt_weak CPTGraph *graph; - CGPathRef outerBorderPath; - CGPathRef innerBorderPath; - id identifier; -} - -/// @name Graph -/// @{ -@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTGraph *graph; -/// @} - -/// @name Padding -/// @{ -@property (nonatomic, readwrite) CGFloat paddingLeft; -@property (nonatomic, readwrite) CGFloat paddingTop; -@property (nonatomic, readwrite) CGFloat paddingRight; -@property (nonatomic, readwrite) CGFloat paddingBottom; -/// @} - -/// @name Drawing -/// @{ -@property (readwrite, assign) CGFloat contentsScale; -@property (nonatomic, readonly, assign) BOOL useFastRendering; -@property (nonatomic, readwrite, copy) CPTShadow *shadow; -/// @} - -/// @name Masking -/// @{ -@property (nonatomic, readwrite, assign) BOOL masksToBorder; -@property (nonatomic, readwrite, assign) CGPathRef outerBorderPath; -@property (nonatomic, readwrite, assign) CGPathRef innerBorderPath; -@property (nonatomic, readonly, assign) CGPathRef maskingPath; -@property (nonatomic, readonly, assign) CGPathRef sublayerMaskingPath; -/// @} - -/// @name Identification -/// @{ -@property (nonatomic, readwrite, copy) id identifier; -/// @} - -/// @name Layout -/// @{ -@property (readonly) NSSet *sublayersExcludedFromAutomaticLayout; -/// @} - -/// @name Initialization -/// @{ --(id)initWithFrame:(CGRect)newFrame; -/// @} - -/// @name Drawing -/// @{ --(void)renderAsVectorInContext:(CGContextRef)context; --(void)recursivelyRenderInContext:(CGContextRef)context; --(void)layoutAndRenderInContext:(CGContextRef)context; --(NSData *)dataForPDFRepresentationOfLayer; -/// @} - -/// @name Masking -/// @{ --(void)applySublayerMaskToContext:(CGContextRef)context forSublayer:(CPTLayer *)sublayer withOffset:(CGPoint)offset; --(void)applyMaskToContext:(CGContextRef)context; -/// @} - -/// @name Layout -/// @{ --(void)pixelAlign; --(void)sublayerMarginLeft:(CGFloat *)left top:(CGFloat *)top right:(CGFloat *)right bottom:(CGFloat *)bottom; -/// @} - -/// @name Information -/// @{ --(void)logLayers; -/// @} - -@end - -/// @cond -// for MacOS 10.6 SDK compatibility -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE -#else -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 -@interface CALayer(CPTExtensions) - -@property (readwrite) CGFloat contentsScale; - -@end -#endif -#endif - -/// @endcond diff --git a/CorePlotHeaders/CPTLayerAnnotation.h b/CorePlotHeaders/CPTLayerAnnotation.h deleted file mode 100755 index 2c21c04..0000000 --- a/CorePlotHeaders/CPTLayerAnnotation.h +++ /dev/null @@ -1,20 +0,0 @@ -#import "CPTAnnotation.h" -#import "CPTDefinitions.h" -#import - -@class CPTConstraints; - -@interface CPTLayerAnnotation : CPTAnnotation { - @private - __cpt_weak CPTLayer *anchorLayer; - CPTConstraints *xConstraints; - CPTConstraints *yConstraints; - CPTRectAnchor rectAnchor; -} - -@property (nonatomic, readonly, cpt_weak_property) __cpt_weak CPTLayer *anchorLayer; -@property (nonatomic, readwrite, assign) CPTRectAnchor rectAnchor; - --(id)initWithAnchorLayer:(CPTLayer *)anchorLayer; - -@end diff --git a/CorePlotHeaders/CPTLegend.h b/CorePlotHeaders/CPTLegend.h deleted file mode 100755 index 55834ae..0000000 --- a/CorePlotHeaders/CPTLegend.h +++ /dev/null @@ -1,135 +0,0 @@ -#import "CPTBorderedLayer.h" -#import - -/// @file - -@class CPTLegend; -@class CPTPlot; -@class CPTTextStyle; - -/// @name Legend -/// @{ - -/** @brief Notification sent by plots to tell the legend it should redraw itself. - * @ingroup notification - **/ -extern NSString *const CPTLegendNeedsRedrawForPlotNotification; - -/** @brief Notification sent by plots to tell the legend it should update its layout and redraw itself. - * @ingroup notification - **/ -extern NSString *const CPTLegendNeedsLayoutForPlotNotification; - -/** @brief Notification sent by plots to tell the legend it should reload all legend entries. - * @ingroup notification - **/ -extern NSString *const CPTLegendNeedsReloadEntriesForPlotNotification; - -/// @} - -/** - * @brief Axis labeling delegate. - **/ -@protocol CPTLegendDelegate - -/// @name Drawing -/// @{ - -/** @brief @required This method gives the delegate a chance to draw custom swatches for each legend entry. - * - * The "swatch" is the graphical part of the legend entry, usually accompanied by a text title - * that will be drawn by the legend. Returning @NO will cause the legend to not draw the default - * legend graphics. It is then the delegate’s responsiblity to do this. - * @param legend The legend. - * @param idx The zero-based index of the legend entry for the given plot. - * @param plot The plot. - * @param rect The bounding rectangle to use when drawing the swatch. - * @param context The graphics context to draw into. - * @return @YES if the legend should draw the default swatch or @NO if the delegate handled the drawing. - **/ --(BOOL)legend:(CPTLegend *)legend shouldDrawSwatchAtIndex:(NSUInteger)idx forPlot:(CPTPlot *)plot inRect:(CGRect)rect inContext:(CGContextRef)context; - -/// @} - -@end - -#pragma mark - - -@interface CPTLegend : CPTBorderedLayer { - @private - NSMutableArray *plots; - NSMutableArray *legendEntries; - BOOL layoutChanged; - CPTTextStyle *textStyle; - CGSize swatchSize; - CPTLineStyle *swatchBorderLineStyle; - CGFloat swatchCornerRadius; - CPTFill *swatchFill; - NSUInteger numberOfRows; - NSUInteger numberOfColumns; - BOOL equalRows; - BOOL equalColumns; - NSArray *rowHeights; - NSArray *rowHeightsThatFit; - NSArray *columnWidths; - NSArray *columnWidthsThatFit; - CGFloat columnMargin; - CGFloat rowMargin; - CGFloat titleOffset; -} - -/// @name Formatting -/// @{ -@property (nonatomic, readwrite, copy) CPTTextStyle *textStyle; -@property (nonatomic, readwrite, assign) CGSize swatchSize; -@property (nonatomic, readwrite, copy) CPTLineStyle *swatchBorderLineStyle; -@property (nonatomic, readwrite, assign) CGFloat swatchCornerRadius; -@property (nonatomic, readwrite, copy) CPTFill *swatchFill; -/// @} - -/// @name Layout -/// @{ -@property (nonatomic, readonly, assign) BOOL layoutChanged; -@property (nonatomic, readwrite, assign) NSUInteger numberOfRows; -@property (nonatomic, readwrite, assign) NSUInteger numberOfColumns; -@property (nonatomic, readwrite, assign) BOOL equalRows; -@property (nonatomic, readwrite, assign) BOOL equalColumns; -@property (nonatomic, readwrite, copy) NSArray *rowHeights; -@property (nonatomic, readonly, retain) NSArray *rowHeightsThatFit; -@property (nonatomic, readwrite, copy) NSArray *columnWidths; -@property (nonatomic, readonly, retain) NSArray *columnWidthsThatFit; -@property (nonatomic, readwrite, assign) CGFloat columnMargin; -@property (nonatomic, readwrite, assign) CGFloat rowMargin; -@property (nonatomic, readwrite, assign) CGFloat titleOffset; -/// @} - -/// @name Factory Methods -/// @{ -+(id)legendWithPlots:(NSArray *)newPlots; -+(id)legendWithGraph:(CPTGraph *)graph; -/// @} - -/// @name Initialization -/// @{ --(id)initWithPlots:(NSArray *)newPlots; --(id)initWithGraph:(CPTGraph *)graph; -/// @} - -/// @name Plots -/// @{ --(NSArray *)allPlots; --(CPTPlot *)plotAtIndex:(NSUInteger)idx; --(CPTPlot *)plotWithIdentifier:(id)identifier; - --(void)addPlot:(CPTPlot *)plot; --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx; --(void)removePlot:(CPTPlot *)plot; --(void)removePlotWithIdentifier:(id)identifier; -/// @} - -/// @name Layout -/// @{ --(void)setLayoutChanged; -/// @} - -@end diff --git a/CorePlotHeaders/CPTLegendEntry.h b/CorePlotHeaders/CPTLegendEntry.h deleted file mode 100755 index 2ca27af..0000000 --- a/CorePlotHeaders/CPTLegendEntry.h +++ /dev/null @@ -1,40 +0,0 @@ -#import "CPTDefinitions.h" -#import -#import - -@class CPTPlot; -@class CPTTextStyle; - -@interface CPTLegendEntry : NSObject { - @private - __cpt_weak CPTPlot *plot; - NSUInteger index; - NSUInteger row; - NSUInteger column; - CPTTextStyle *textStyle; -} - -/// @name Plot Info -/// @{ -@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTPlot *plot; -@property (nonatomic, readwrite, assign) NSUInteger index; -/// @} - -/// @name Formatting -/// @{ -@property (nonatomic, readwrite, retain) CPTTextStyle *textStyle; -/// @} - -/// @name Layout -/// @{ -@property (nonatomic, readwrite, assign) NSUInteger row; -@property (nonatomic, readwrite, assign) NSUInteger column; -@property (nonatomic, readonly, assign) CGSize titleSize; -/// @} - -/// @name Drawing -/// @{ --(void)drawTitleInRect:(CGRect)rect inContext:(CGContextRef)context scale:(CGFloat)scale; -/// @} - -@end diff --git a/CorePlotHeaders/CPTLimitBand.h b/CorePlotHeaders/CPTLimitBand.h deleted file mode 100755 index 07238b9..0000000 --- a/CorePlotHeaders/CPTLimitBand.h +++ /dev/null @@ -1,25 +0,0 @@ -#import - -@class CPTPlotRange; -@class CPTFill; - -@interface CPTLimitBand : NSObject { - @private - CPTPlotRange *range; - CPTFill *fill; -} - -@property (nonatomic, readwrite, retain) CPTPlotRange *range; -@property (nonatomic, readwrite, retain) CPTFill *fill; - -/// @name Factory Methods -/// @{ -+(CPTLimitBand *)limitBandWithRange:(CPTPlotRange *)newRange fill:(CPTFill *)newFill; -/// @} - -/// @name Initialization -/// @{ --(id)initWithRange:(CPTPlotRange *)newRange fill:(CPTFill *)newFill; -/// @} - -@end diff --git a/CorePlotHeaders/CPTLineCap.h b/CorePlotHeaders/CPTLineCap.h deleted file mode 100755 index ee279aa..0000000 --- a/CorePlotHeaders/CPTLineCap.h +++ /dev/null @@ -1,69 +0,0 @@ -#import -#import - -/// @file - -@class CPTLineStyle; -@class CPTFill; - -/** - * @brief Line cap types. - **/ -typedef enum _CPTLineCapType { - CPTLineCapTypeNone, ///< No line cap. - CPTLineCapTypeOpenArrow, ///< Open arrow line cap. - CPTLineCapTypeSolidArrow, ///< Solid arrow line cap. - CPTLineCapTypeSweptArrow, ///< Swept arrow line cap. - CPTLineCapTypeRectangle, ///< Rectangle line cap. - CPTLineCapTypeEllipse, ///< Elliptical line cap. - CPTLineCapTypeDiamond, ///< Diamond line cap. - CPTLineCapTypePentagon, ///< Pentagon line cap. - CPTLineCapTypeHexagon, ///< Hexagon line cap. - CPTLineCapTypeBar, ///< Bar line cap. - CPTLineCapTypeCross, ///< X line cap. - CPTLineCapTypeSnow, ///< Snowflake line cap. - CPTLineCapTypeCustom ///< Custom line cap. -} -CPTLineCapType; - -@interface CPTLineCap : NSObject { - @private - CGSize size; - CPTLineCapType lineCapType; - CPTLineStyle *lineStyle; - CPTFill *fill; - CGPathRef cachedLineCapPath; - CGPathRef customLineCapPath; - BOOL usesEvenOddClipRule; -} - -@property (nonatomic, readwrite, assign) CGSize size; -@property (nonatomic, readwrite, assign) CPTLineCapType lineCapType; -@property (nonatomic, readwrite, retain) CPTLineStyle *lineStyle; -@property (nonatomic, readwrite, retain) CPTFill *fill; -@property (nonatomic, readwrite, assign) CGPathRef customLineCapPath; -@property (nonatomic, readwrite, assign) BOOL usesEvenOddClipRule; - -/// @name Factory Methods -/// @{ -+(CPTLineCap *)lineCap; -+(CPTLineCap *)openArrowPlotLineCap; -+(CPTLineCap *)solidArrowPlotLineCap; -+(CPTLineCap *)sweptArrowPlotLineCap; -+(CPTLineCap *)rectanglePlotLineCap; -+(CPTLineCap *)ellipsePlotLineCap; -+(CPTLineCap *)diamondPlotLineCap; -+(CPTLineCap *)pentagonPlotLineCap; -+(CPTLineCap *)hexagonPlotLineCap; -+(CPTLineCap *)barPlotLineCap; -+(CPTLineCap *)crossPlotLineCap; -+(CPTLineCap *)snowPlotLineCap; -+(CPTLineCap *)customLineCapWithPath:(CGPathRef)aPath; -/// @} - -/// @name Drawing -/// @{ --(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center inDirection:(CGPoint)direction; -/// @} - -@end diff --git a/CorePlotHeaders/CPTLineStyle.h b/CorePlotHeaders/CPTLineStyle.h deleted file mode 100755 index 60d2c83..0000000 --- a/CorePlotHeaders/CPTLineStyle.h +++ /dev/null @@ -1,42 +0,0 @@ -#import -#import - -@class CPTColor; -@class CPTFill; - -@interface CPTLineStyle : NSObject { - @private - CGLineCap lineCap; -// CGLineDash lineDash; // We should make a struct to keep this information - CGLineJoin lineJoin; - CGFloat miterLimit; - CGFloat lineWidth; - NSArray *dashPattern; - CGFloat patternPhase; -// StrokePattern; // We should make a struct to keep this information - CPTColor *lineColor; - CPTFill *lineFill; -} - -@property (nonatomic, readonly, assign) CGLineCap lineCap; -@property (nonatomic, readonly, assign) CGLineJoin lineJoin; -@property (nonatomic, readonly, assign) CGFloat miterLimit; -@property (nonatomic, readonly, assign) CGFloat lineWidth; -@property (nonatomic, readonly, retain) NSArray *dashPattern; -@property (nonatomic, readonly, assign) CGFloat patternPhase; -@property (nonatomic, readonly, retain) CPTColor *lineColor; -@property (nonatomic, readonly, retain) CPTFill *lineFill; - -/// @name Factory Methods -/// @{ -+(id)lineStyle; -/// @} - -/// @name Drawing -/// @{ --(void)setLineStyleInContext:(CGContextRef)context; --(void)strokePathInContext:(CGContextRef)context; --(void)strokeRect:(CGRect)rect inContext:(CGContextRef)context; -/// @} - -@end diff --git a/CorePlotHeaders/CPTMutableLineStyle.h b/CorePlotHeaders/CPTMutableLineStyle.h deleted file mode 100755 index 3166f13..0000000 --- a/CorePlotHeaders/CPTMutableLineStyle.h +++ /dev/null @@ -1,18 +0,0 @@ -#import "CPTLineStyle.h" -#import - -@class CPTColor; - -@interface CPTMutableLineStyle : CPTLineStyle { -} - -@property (nonatomic, readwrite, assign) CGLineCap lineCap; -@property (nonatomic, readwrite, assign) CGLineJoin lineJoin; -@property (nonatomic, readwrite, assign) CGFloat miterLimit; -@property (nonatomic, readwrite, assign) CGFloat lineWidth; -@property (nonatomic, readwrite, retain) NSArray *dashPattern; -@property (nonatomic, readwrite, assign) CGFloat patternPhase; -@property (nonatomic, readwrite, retain) CPTColor *lineColor; -@property (nonatomic, readwrite, retain) CPTFill *lineFill; - -@end diff --git a/CorePlotHeaders/CPTMutableNumericData+TypeConversion.h b/CorePlotHeaders/CPTMutableNumericData+TypeConversion.h deleted file mode 100755 index a677872..0000000 --- a/CorePlotHeaders/CPTMutableNumericData+TypeConversion.h +++ /dev/null @@ -1,23 +0,0 @@ -#import "CPTMutableNumericData.h" -#import "CPTNumericDataType.h" -#import - -/** @category CPTMutableNumericData(TypeConversion) - * @brief Type conversion methods for CPTMutableNumericData. - **/ -@interface CPTMutableNumericData(TypeConversion) - -/// @name Data Format -/// @{ -@property (assign, readwrite) CPTNumericDataType dataType; -@property (assign, readwrite) CPTDataTypeFormat dataTypeFormat; -@property (assign, readwrite) size_t sampleBytes; -@property (assign, readwrite) CFByteOrder byteOrder; -/// @} - -/// @name Type Conversion -/// @{ --(void)convertToType:(CPTDataTypeFormat)newDataType sampleBytes:(size_t)newSampleBytes byteOrder:(CFByteOrder)newByteOrder; -/// @} - -@end diff --git a/CorePlotHeaders/CPTMutableNumericData.h b/CorePlotHeaders/CPTMutableNumericData.h deleted file mode 100755 index 8d45898..0000000 --- a/CorePlotHeaders/CPTMutableNumericData.h +++ /dev/null @@ -1,18 +0,0 @@ -#import "CPTNumericData.h" -#import "CPTNumericDataType.h" -#import - -@interface CPTMutableNumericData : CPTNumericData { -} - -/// @name Data Buffer -/// @{ -@property (readonly) void *mutableBytes; -/// @} - -/// @name Dimensions -/// @{ -@property (copy, readwrite) NSArray *shape; -/// @} - -@end diff --git a/CorePlotHeaders/CPTMutablePlotRange.h b/CorePlotHeaders/CPTMutablePlotRange.h deleted file mode 100755 index fa3f6be..0000000 --- a/CorePlotHeaders/CPTMutablePlotRange.h +++ /dev/null @@ -1,29 +0,0 @@ -#import "CPTPlotRange.h" - -@interface CPTMutablePlotRange : CPTPlotRange { -} - -/// @name Range Limits -/// @{ -@property (nonatomic, readwrite) NSDecimal location; -@property (nonatomic, readwrite) NSDecimal length; -/// @} - -/// @name Combining Ranges -/// @{ --(void)unionPlotRange:(CPTPlotRange *)otherRange; --(void)intersectionPlotRange:(CPTPlotRange *)otherRange; -/// @} - -/// @name Shifting Ranges -/// @{ --(void)shiftLocationToFitInRange:(CPTPlotRange *)otherRange; --(void)shiftEndToFitInRange:(CPTPlotRange *)otherRange; -/// @} - -/// @name Expanding/Contracting Ranges -/// @{ --(void)expandRangeByFactor:(NSDecimal)factor; -/// @} - -@end diff --git a/CorePlotHeaders/CPTMutableShadow.h b/CorePlotHeaders/CPTMutableShadow.h deleted file mode 100755 index 064cb5d..0000000 --- a/CorePlotHeaders/CPTMutableShadow.h +++ /dev/null @@ -1,14 +0,0 @@ -#import "CPTShadow.h" -#import -#import - -@class CPTColor; - -@interface CPTMutableShadow : CPTShadow { -} - -@property (nonatomic, readwrite, assign) CGSize shadowOffset; -@property (nonatomic, readwrite, assign) CGFloat shadowBlurRadius; -@property (nonatomic, readwrite, retain) CPTColor *shadowColor; - -@end diff --git a/CorePlotHeaders/CPTMutableTextStyle.h b/CorePlotHeaders/CPTMutableTextStyle.h deleted file mode 100755 index 07fbdfe..0000000 --- a/CorePlotHeaders/CPTMutableTextStyle.h +++ /dev/null @@ -1,14 +0,0 @@ -#import "CPTTextStyle.h" -#import - -@class CPTColor; - -@interface CPTMutableTextStyle : CPTTextStyle { -} - -@property (readwrite, copy, nonatomic) NSString *fontName; -@property (readwrite, assign, nonatomic) CGFloat fontSize; -@property (readwrite, copy, nonatomic) CPTColor *color; -@property (readwrite, assign, nonatomic) CPTTextAlignment textAlignment; - -@end diff --git a/CorePlotHeaders/CPTNumericData+TypeConversion.h b/CorePlotHeaders/CPTNumericData+TypeConversion.h deleted file mode 100755 index b5a44e6..0000000 --- a/CorePlotHeaders/CPTNumericData+TypeConversion.h +++ /dev/null @@ -1,23 +0,0 @@ -#import "CPTNumericData.h" -#import "CPTNumericDataType.h" -#import - -/** @category CPTNumericData(TypeConversion) - * @brief Type conversion methods for CPTNumericData. - **/ -@interface CPTNumericData(TypeConversion) - -/// @name Type Conversion -/// @{ --(CPTNumericData *)dataByConvertingToDataType:(CPTNumericDataType)newDataType; - --(CPTNumericData *)dataByConvertingToType:(CPTDataTypeFormat)newDataType sampleBytes:(size_t)newSampleBytes byteOrder:(CFByteOrder)newByteOrder; -/// @} - -/// @name Data Conversion Utilities -/// @{ --(void)convertData:(NSData *)sourceData dataType:(CPTNumericDataType *)sourceDataType toData:(NSMutableData *)destData dataType:(CPTNumericDataType *)destDataType; --(void)swapByteOrderForData:(NSMutableData *)sourceData sampleSize:(size_t)sampleSize; -/// @} - -@end diff --git a/CorePlotHeaders/CPTNumericData.h b/CorePlotHeaders/CPTNumericData.h deleted file mode 100755 index dd21bc9..0000000 --- a/CorePlotHeaders/CPTNumericData.h +++ /dev/null @@ -1,71 +0,0 @@ -#import "CPTNumericDataType.h" -#import - -@interface CPTNumericData : NSObject { - @protected - NSData *data; - CPTNumericDataType dataType; - NSArray *shape; // array of dimension shapes (NSNumber) - CPTDataOrder dataOrder; -} - -/// @name Data Buffer -/// @{ -@property (copy, readonly) NSData *data; -@property (readonly) const void *bytes; -@property (readonly) NSUInteger length; -/// @} - -/// @name Data Format -/// @{ -@property (assign, readonly) CPTNumericDataType dataType; -@property (readonly) CPTDataTypeFormat dataTypeFormat; -@property (readonly) size_t sampleBytes; -@property (readonly) CFByteOrder byteOrder; -/// @} - -/// @name Dimensions -/// @{ -@property (copy, readonly) NSArray *shape; -@property (readonly) NSUInteger numberOfDimensions; -@property (readonly) NSUInteger numberOfSamples; -@property (readonly) CPTDataOrder dataOrder; -/// @} - -/// @name Factory Methods -/// @{ -+(id)numericDataWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; -+(id)numericDataWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; -+(id)numericDataWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; -+(id)numericDataWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; - -+(id)numericDataWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; -+(id)numericDataWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; -+(id)numericDataWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; -+(id)numericDataWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; -/// @} - -/// @name Initialization -/// @{ --(id)initWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; --(id)initWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; --(id)initWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray; --(id)initWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray; - --(id)initWithData:(NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; --(id)initWithData:(NSData *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; --(id)initWithArray:(NSArray *)newData dataType:(CPTNumericDataType)newDataType shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; --(id)initWithArray:(NSArray *)newData dataTypeString:(NSString *)newDataTypeString shape:(NSArray *)shapeArray dataOrder:(CPTDataOrder)order; -/// @} - -/// @name Samples -/// @{ --(NSUInteger)sampleIndex:(NSUInteger)idx, ...; --(void *)samplePointer:(NSUInteger)sample; --(void *)samplePointerAtIndex:(NSUInteger)idx, ...; --(NSNumber *)sampleValue:(NSUInteger)sample; --(NSNumber *)sampleValueAtIndex:(NSUInteger)idx, ...; --(NSArray *)sampleArray; -/// @} - -@end diff --git a/CorePlotHeaders/CPTNumericDataType.h b/CorePlotHeaders/CPTNumericDataType.h deleted file mode 100755 index 0e27dce..0000000 --- a/CorePlotHeaders/CPTNumericDataType.h +++ /dev/null @@ -1,54 +0,0 @@ -#import - -/// @file - -/** - * @brief Enumeration of data formats for numeric data. - **/ -typedef enum _CPTDataTypeFormat { - CPTUndefinedDataType = 0, ///< Undefined - CPTIntegerDataType, ///< Integer - CPTUnsignedIntegerDataType, ///< Unsigned integer - CPTFloatingPointDataType, ///< Floating point - CPTComplexFloatingPointDataType, ///< Complex floating point - CPTDecimalDataType ///< NSDecimal -} -CPTDataTypeFormat; - -/** - * @brief Enumeration of memory arrangements for multi-dimensional data arrays. - * @see See Wikipedia for more information. - **/ -typedef enum _CPTDataOrder { - CPTDataOrderRowsFirst, ///< Numeric data is arranged in row-major order. - CPTDataOrderColumnsFirst ///< Numeric data is arranged in column-major order. -} -CPTDataOrder; - -/** - * @brief Struct that describes the encoding of numeric data samples. - **/ -typedef struct _CPTNumericDataType { - CPTDataTypeFormat dataTypeFormat; ///< Data type format - size_t sampleBytes; ///< Number of bytes in each sample - CFByteOrder byteOrder; ///< Byte order -} -CPTNumericDataType; - -#if __cplusplus -extern "C" { -#endif - -/// @name Data Type Utilities -/// @{ -CPTNumericDataType CPTDataType(CPTDataTypeFormat format, size_t sampleBytes, CFByteOrder byteOrder); -CPTNumericDataType CPTDataTypeWithDataTypeString(NSString *dataTypeString); -NSString *CPTDataTypeStringFromDataType(CPTNumericDataType dataType); -BOOL CPTDataTypeIsSupported(CPTNumericDataType format); -BOOL CPTDataTypeEqualToDataType(CPTNumericDataType dataType1, CPTNumericDataType dataType2); - -/// @} - -#if __cplusplus -} -#endif diff --git a/CorePlotHeaders/CPTPathExtensions.h b/CorePlotHeaders/CPTPathExtensions.h deleted file mode 100755 index 3d3e328..0000000 --- a/CorePlotHeaders/CPTPathExtensions.h +++ /dev/null @@ -1,15 +0,0 @@ -#import -#import - -/// @file - -#if __cplusplus -extern "C" { -#endif - -CGPathRef CreateRoundedRectPath(CGRect rect, CGFloat cornerRadius); -void AddRoundedRectPath(CGContextRef context, CGRect rect, CGFloat cornerRadius); - -#if __cplusplus -} -#endif diff --git a/CorePlotHeaders/CPTPieChart.h b/CorePlotHeaders/CPTPieChart.h deleted file mode 100755 index 48f6c94..0000000 --- a/CorePlotHeaders/CPTPieChart.h +++ /dev/null @@ -1,190 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTPlot.h" -#import - -/// @file - -@class CPTColor; -@class CPTFill; -@class CPTMutableNumericData; -@class CPTNumericData; -@class CPTPieChart; -@class CPTTextLayer; -@class CPTLineStyle; - -/// @ingroup plotBindingsPieChart -/// @{ -extern NSString *const CPTPieChartBindingPieSliceWidthValues; -extern NSString *const CPTPieChartBindingPieSliceFills; -extern NSString *const CPTPieChartBindingPieSliceRadialOffsets; -/// @} - -/** - * @brief Enumeration of pie chart data source field types. - **/ -typedef enum _CPTPieChartField { - CPTPieChartFieldSliceWidth, ///< Pie slice width. - CPTPieChartFieldSliceWidthNormalized, ///< Pie slice width normalized [0, 1]. - CPTPieChartFieldSliceWidthSum ///< Cumulative sum of pie slice widths. -} -CPTPieChartField; - -/** - * @brief Enumeration of pie slice drawing directions. - **/ -typedef enum _CPTPieDirection { - CPTPieDirectionClockwise, ///< Pie slices are drawn in a clockwise direction. - CPTPieDirectionCounterClockwise ///< Pie slices are drawn in a counter-clockwise direction. -} -CPTPieDirection; - -#pragma mark - - -/** - * @brief A pie chart data source. - **/ -@protocol CPTPieChartDataSource -@optional - -/// @name Slice Style -/// @{ - -/** @brief @optional Gets a range of slice fills for the given pie chart. - * @param pieChart The pie chart. - * @param indexRange The range of the data indexes of interest. - * @return The pie slice fill for the slice with the given index. - **/ --(NSArray *)sliceFillsForPieChart:(CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a fill for the given pie chart slice. - * This method will not be called if - * @link CPTPieChartDataSource::sliceFillsForPieChart:recordIndexRange: -sliceFillsForPieChart:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param pieChart The pie chart. - * @param idx The data index of interest. - * @return The pie slice fill for the slice with the given index. - **/ --(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx; - -/// @} - -/// @name Slice Layout -/// @{ - -/** @brief @optional Gets a range of slice offsets for the given pie chart. - * @param pieChart The pie chart. - * @param indexRange The range of the data indexes of interest. - * @return An array of radial offsets. - **/ --(NSArray *)radialOffsetsForPieChart:(CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Offsets the slice radially from the center point. Can be used to @quote{explode} the chart. - * This method will not be called if - * @link CPTPieChartDataSource::radialOffsetsForPieChart:recordIndexRange: -radialOffsetsForPieChart:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param pieChart The pie chart. - * @param idx The data index of interest. - * @return The radial offset in view coordinates. Zero is no offset. - **/ --(CGFloat)radialOffsetForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx; - -/// @} - -/// @name Legends -/// @{ - -/** @brief @optional Gets the legend title for the given pie chart slice. - * @param pieChart The pie chart. - * @param idx The data index of interest. - * @return The title text for the legend entry for the point with the given index. - **/ --(NSString *)legendTitleForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)idx; - -/// @} -@end - -#pragma mark - - -/** - * @brief Pie chart delegate. - **/ -@protocol CPTPieChartDelegate - -@optional - -/// @name Slice Selection -/// @{ - -/** @brief @optional Informs the delegate that a pie slice was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The pie chart. - * @param idx The index of the - * @if MacOnly clicked pie slice. @endif - * @if iOSOnly touched pie slice. @endif - **/ --(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)idx; - -/** @brief @optional Informs the delegate that a pie slice was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The pie chart. - * @param idx The index of the - * @if MacOnly clicked pie slice. @endif - * @if iOSOnly touched pie slice. @endif - * @param event The event that triggered the selection. - **/ --(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; - -/// @} - -@end - -#pragma mark - - -@interface CPTPieChart : CPTPlot { - @private - CGFloat pieRadius; - CGFloat pieInnerRadius; - CGFloat startAngle; - CGFloat endAngle; - CPTPieDirection sliceDirection; - CGPoint centerAnchor; - CPTLineStyle *borderLineStyle; - CPTFill *overlayFill; - BOOL labelRotationRelativeToRadius; -} - -/// @name Appearance -/// @{ -@property (nonatomic, readwrite) CGFloat pieRadius; -@property (nonatomic, readwrite) CGFloat pieInnerRadius; -@property (nonatomic, readwrite) CGFloat startAngle; -@property (nonatomic, readwrite) CGFloat endAngle; -@property (nonatomic, readwrite) CPTPieDirection sliceDirection; -@property (nonatomic, readwrite) CGPoint centerAnchor; -/// @} - -/// @name Drawing -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle; -@property (nonatomic, readwrite, copy) CPTFill *overlayFill; -/// @} - -/// @name Data Labels -/// @{ -@property (nonatomic, readwrite, assign) BOOL labelRotationRelativeToRadius; -/// @} - -/// @name Information -/// @{ --(NSUInteger)pieSliceIndexAtAngle:(CGFloat)angle; --(CGFloat)medianAngleForPieSliceIndex:(NSUInteger)index; -/// @} - -/// @name Factory Methods -/// @{ -+(CPTColor *)defaultPieSliceColorForIndex:(NSUInteger)pieSliceIndex; -/// @} - -@end diff --git a/CorePlotHeaders/CPTPlatformSpecificCategories.h b/CorePlotHeaders/CPTPlatformSpecificCategories.h deleted file mode 100755 index 459cde9..0000000 --- a/CorePlotHeaders/CPTPlatformSpecificCategories.h +++ /dev/null @@ -1,37 +0,0 @@ -#import "CPTColor.h" -#import "CPTLayer.h" -#import "CPTPlatformSpecificDefines.h" -#import - -/** @category CPTColor(CPTPlatformSpecificColorExtensions) - * @brief Platform-specific extensions to CPTColor. - **/ -@interface CPTColor(CPTPlatformSpecificColorExtensions) - -@property (nonatomic, readonly, retain) UIColor *uiColor; - -@end - -/** @category CPTLayer(CPTPlatformSpecificLayerExtensions) - * @brief Platform-specific extensions to CPTLayer. - **/ -@interface CPTLayer(CPTPlatformSpecificLayerExtensions) - -/// @name Images -/// @{ --(CPTNativeImage *)imageOfLayer; -/// @} - -@end - -/** @category NSNumber(CPTPlatformSpecificNumberExtensions) - * @brief Platform-specific extensions to NSNumber. - **/ -@interface NSNumber(CPTPlatformSpecificNumberExtensions) - --(BOOL)isLessThan:(NSNumber *)other; --(BOOL)isLessThanOrEqualTo:(NSNumber *)other; --(BOOL)isGreaterThan:(NSNumber *)other; --(BOOL)isGreaterThanOrEqualTo:(NSNumber *)other; - -@end diff --git a/CorePlotHeaders/CPTPlatformSpecificDefines.h b/CorePlotHeaders/CPTPlatformSpecificDefines.h deleted file mode 100755 index 3d91db1..0000000 --- a/CorePlotHeaders/CPTPlatformSpecificDefines.h +++ /dev/null @@ -1,5 +0,0 @@ -#import -#import - -typedef UIImage CPTNativeImage; ///< Platform-native image format. -typedef UIEvent CPTNativeEvent; ///< Platform-native OS event. diff --git a/CorePlotHeaders/CPTPlatformSpecificFunctions.h b/CorePlotHeaders/CPTPlatformSpecificFunctions.h deleted file mode 100755 index a33e38c..0000000 --- a/CorePlotHeaders/CPTPlatformSpecificFunctions.h +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import - -/// @file - -#if __cplusplus -extern "C" { -#endif - -/// @name Graphics Context Save Stack -/// @{ -void CPTPushCGContext(CGContextRef context); -void CPTPopCGContext(void); - -/// @} - -/// @name Graphics Context -/// @{ -CGContextRef CPTGetCurrentContext(void); - -/// @} - -#if __cplusplus -} -#endif diff --git a/CorePlotHeaders/CPTPlot.h b/CorePlotHeaders/CPTPlot.h deleted file mode 100755 index 45a9ae9..0000000 --- a/CorePlotHeaders/CPTPlot.h +++ /dev/null @@ -1,340 +0,0 @@ -#import "CPTAnnotationHostLayer.h" -#import "CPTDefinitions.h" -#import "CPTMutableTextStyle.h" -#import "CPTNumericDataType.h" -#import "CPTPlotRange.h" - -/// @file - -@class CPTLegend; -@class CPTMutableNumericData; -@class CPTNumericData; -@class CPTPlot; -@class CPTPlotArea; -@class CPTPlotSpace; -@class CPTPlotSpaceAnnotation; -@class CPTPlotRange; - -/// @ingroup plotBindingsAllPlots -/// @{ -extern NSString *const CPTPlotBindingDataLabels; -/// @} - -/** - * @brief Enumeration of cache precisions. - **/ -typedef enum _CPTPlotCachePrecision { - CPTPlotCachePrecisionAuto, ///< Cache precision is determined automatically from the data. All cached data will be converted to match the last data loaded. - CPTPlotCachePrecisionDouble, ///< All cached data will be converted to double precision. - CPTPlotCachePrecisionDecimal ///< All cached data will be converted to @ref NSDecimal. -} -CPTPlotCachePrecision; - -#pragma mark - - -/** - * @brief A plot data source. - **/ -@protocol CPTPlotDataSource - -/// @name Data Values -/// @{ - -/** @brief @required The number of data points for the plot. - * @param plot The plot. - * @return The number of data points for the plot. - **/ --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot; - -@optional - -/** @brief @optional Gets a range of plot data for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param indexRange The range of the data indexes of interest. - * @return An array of data points. - **/ --(NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a plot data value for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param idx The data index of interest. - * @return A data point. - **/ --(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; - -/** @brief @optional Gets a range of plot data for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param indexRange The range of the data indexes of interest. - * @return A retained C array of data points. - **/ --(double *)doublesForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a plot data value for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param idx The data index of interest. - * @return A data point. - **/ --(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; - -/** @brief @optional Gets a range of plot data for the given plot and field. - * Implement one and only one of the optional methods in this section. - * @param plot The plot. - * @param fieldEnum The field index. - * @param indexRange The range of the data indexes of interest. - * @return A one-dimensional array of data points. - **/ --(CPTNumericData *)dataForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a range of plot data for all fields of the given plot simultaneously. - * Implement one and only one of the optional methods in this section. - * - * The data returned from this method should be a two-dimensional array. It can be arranged - * in row- or column-major order although column-major will load faster, especially for large arrays. - * The array should have the same number of rows as the length of @par{indexRange}. - * The number of columns should be equal to the number of plot fields required by the plot. - * The column index (zero-based) corresponds with the field index. - * The data type will be converted to match the @link CPTPlot::cachePrecision cachePrecision @endlink if needed. - * - * @param plot The plot. - * @param indexRange The range of the data indexes of interest. - * @return A two-dimensional array of data points. - **/ --(CPTNumericData *)dataForPlot:(CPTPlot *)plot recordIndexRange:(NSRange)indexRange; - -/// @} - -/// @name Data Labels -/// @{ - -/** @brief @optional Gets a range of data labels for the given plot. - * @param plot The plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of data labels. - **/ --(NSArray *)dataLabelsForPlot:(CPTPlot *)plot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a data label for the given plot. - * This method will not be called if - * @link CPTPlotDataSource::dataLabelsForPlot:recordIndexRange: -dataLabelsForPlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The plot. - * @param idx The data index of interest. - * @return The data label for the point with the given index. - * If you return @nil, the default data label will be used. If you return an instance of NSNull, - * no label will be shown for the index in question. - **/ --(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)idx; - -/// @} - -@end - -#pragma mark - - -/** - * @brief Plot delegate. - **/ -@protocol CPTPlotDelegate - -@optional - -/// @name Point Selection -/// @{ - -/** @brief @optional Informs the delegate that a data label was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The plot. - * @param idx The index of the - * @if MacOnly clicked data label. @endif - * @if iOSOnly touched data label. @endif - **/ --(void)plot:(CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)idx; - -/** @brief @optional Informs the delegate that a data label was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The plot. - * @param idx The index of the - * @if MacOnly clicked data label. @endif - * @if iOSOnly touched data label. @endif - * @param event The event that triggered the selection. - **/ --(void)plot:(CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; - -/// @} - -/// @name Drawing -/// @{ - -/** - * @brief @optional Informs the delegate that plot drawing is finished. - * @param plot The plot. - **/ --(void)didFinishDrawing:(CPTPlot *)plot; - -/// @} - -@end - -#pragma mark - - -@interface CPTPlot : CPTAnnotationHostLayer { - @private - __cpt_weak id dataSource; - NSString *title; - CPTPlotSpace *plotSpace; - BOOL dataNeedsReloading; - NSMutableDictionary *cachedData; - NSUInteger cachedDataCount; - CPTPlotCachePrecision cachePrecision; - BOOL needsRelabel; - CGFloat labelOffset; - CGFloat labelRotation; - NSUInteger labelField; - CPTTextStyle *labelTextStyle; - NSNumberFormatter *labelFormatter; - NSRange labelIndexRange; - NSMutableArray *labelAnnotations; - CPTShadow *labelShadow; - BOOL alignsPointsToPixels; -} - -/// @name Data Source -/// @{ -@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak id dataSource; -/// @} - -/// @name Identification -/// @{ -@property (nonatomic, readwrite, copy) NSString *title; -/// @} - -/// @name Plot Space -/// @{ -@property (nonatomic, readwrite, retain) CPTPlotSpace *plotSpace; -/// @} - -/// @name Plot Area -/// @{ -@property (nonatomic, readonly, retain) CPTPlotArea *plotArea; -/// @} - -/// @name Data Loading -/// @{ -@property (nonatomic, readonly, assign) BOOL dataNeedsReloading; -/// @} - -/// @name Data Cache -/// @{ -@property (nonatomic, readonly, assign) NSUInteger cachedDataCount; -@property (nonatomic, readonly, assign) BOOL doublePrecisionCache; -@property (nonatomic, readwrite, assign) CPTPlotCachePrecision cachePrecision; -@property (nonatomic, readonly, assign) CPTNumericDataType doubleDataType; -@property (nonatomic, readonly, assign) CPTNumericDataType decimalDataType; -/// @} - -/// @name Data Labels -/// @{ -@property (nonatomic, readonly, assign) BOOL needsRelabel; -@property (nonatomic, readwrite, assign) CGFloat labelOffset; -@property (nonatomic, readwrite, assign) CGFloat labelRotation; -@property (nonatomic, readwrite, assign) NSUInteger labelField; -@property (nonatomic, readwrite, copy) CPTTextStyle *labelTextStyle; -@property (nonatomic, readwrite, retain) NSNumberFormatter *labelFormatter; -@property (nonatomic, readwrite, retain) CPTShadow *labelShadow; -/// @} - -/// @name Drawing -/// @{ -@property (nonatomic, readwrite, assign) BOOL alignsPointsToPixels; -/// @} - -/// @name Data Labels -/// @{ --(void)setNeedsRelabel; --(void)relabel; --(void)relabelIndexRange:(NSRange)indexRange; --(void)repositionAllLabelAnnotations; -/// @} - -/// @name Data Loading -/// @{ --(void)setDataNeedsReloading; --(void)reloadData; --(void)reloadDataIfNeeded; --(void)reloadDataInIndexRange:(NSRange)indexRange; --(void)insertDataAtIndex:(NSUInteger)idx numberOfRecords:(NSUInteger)numberOfRecords; --(void)deleteDataInIndexRange:(NSRange)indexRange; -/// @} - -/// @name Plot Data -/// @{ -+(id)nilData; --(id)numbersFromDataSourceForField:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; --(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRange; -/// @} - -/// @name Data Cache -/// @{ --(CPTMutableNumericData *)cachedNumbersForField:(NSUInteger)fieldEnum; --(NSNumber *)cachedNumberForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; --(double)cachedDoubleForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; --(NSDecimal)cachedDecimalForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx; --(NSArray *)cachedArrayForKey:(NSString *)key; --(id)cachedValueForKey:(NSString *)key recordIndex:(NSUInteger)idx; - --(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum; --(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NSUInteger)idx; --(void)cacheArray:(NSArray *)array forKey:(NSString *)key; --(void)cacheArray:(NSArray *)array forKey:(NSString *)key atRecordIndex:(NSUInteger)idx; -/// @} - -/// @name Plot Data Ranges -/// @{ --(CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum; --(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord; -/// @} - -/// @name Legends -/// @{ --(NSUInteger)numberOfLegendEntries; --(NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx; --(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(CGContextRef)context; -/// @} - -@end - -#pragma mark - - -/** @category CPTPlot(AbstractMethods) - * @brief CPTPlot abstract methods—must be overridden by subclasses - **/ -@interface CPTPlot(AbstractMethods) - -/// @name Fields -/// @{ --(NSUInteger)numberOfFields; --(NSArray *)fieldIdentifiers; --(NSArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord; -/// @} - -/// @name Data Labels -/// @{ --(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx; -/// @} - -/// @name User Interaction -/// @{ --(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point; -/// @} - -@end diff --git a/CorePlotHeaders/CPTPlotArea.h b/CorePlotHeaders/CPTPlotArea.h deleted file mode 100755 index 5b2cf8b..0000000 --- a/CorePlotHeaders/CPTPlotArea.h +++ /dev/null @@ -1,56 +0,0 @@ -#import "CPTAnnotationHostLayer.h" -#import "CPTGraph.h" -#import "CPTLayer.h" -#import - -@class CPTAxis; -@class CPTAxisLabelGroup; -@class CPTAxisSet; -@class CPTGridLineGroup; -@class CPTPlotGroup; -@class CPTLineStyle; -@class CPTFill; - -@interface CPTPlotArea : CPTAnnotationHostLayer { - @private - CPTGridLineGroup *minorGridLineGroup; - CPTGridLineGroup *majorGridLineGroup; - CPTAxisSet *axisSet; - CPTPlotGroup *plotGroup; - CPTAxisLabelGroup *axisLabelGroup; - CPTAxisLabelGroup *axisTitleGroup; - CPTFill *fill; - NSArray *topDownLayerOrder; - CPTGraphLayerType *bottomUpLayerOrder; - BOOL updatingLayers; -} - -/// @name Layers -/// @{ -@property (nonatomic, readwrite, retain) CPTGridLineGroup *minorGridLineGroup; -@property (nonatomic, readwrite, retain) CPTGridLineGroup *majorGridLineGroup; -@property (nonatomic, readwrite, retain) CPTAxisSet *axisSet; -@property (nonatomic, readwrite, retain) CPTPlotGroup *plotGroup; -@property (nonatomic, readwrite, retain) CPTAxisLabelGroup *axisLabelGroup; -@property (nonatomic, readwrite, retain) CPTAxisLabelGroup *axisTitleGroup; -/// @} - -/// @name Layer Ordering -/// @{ -@property (nonatomic, readwrite, retain) NSArray *topDownLayerOrder; -/// @} - -/// @name Decorations -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *borderLineStyle; -@property (nonatomic, readwrite, copy) CPTFill *fill; -/// @} - -/// @name Axis Set Layer Management -/// @{ --(void)updateAxisSetLayersForType:(CPTGraphLayerType)layerType; --(void)setAxisSetLayersForType:(CPTGraphLayerType)layerType; --(unsigned)sublayerIndexForAxis:(CPTAxis *)axis layerType:(CPTGraphLayerType)layerType; -/// @} - -@end diff --git a/CorePlotHeaders/CPTPlotAreaFrame.h b/CorePlotHeaders/CPTPlotAreaFrame.h deleted file mode 100755 index 80b4442..0000000 --- a/CorePlotHeaders/CPTPlotAreaFrame.h +++ /dev/null @@ -1,16 +0,0 @@ -#import "CPTBorderedLayer.h" - -@class CPTAxisSet; -@class CPTPlotGroup; -@class CPTPlotArea; - -@interface CPTPlotAreaFrame : CPTBorderedLayer { - @private - CPTPlotArea *plotArea; -} - -@property (nonatomic, readonly, retain) CPTPlotArea *plotArea; -@property (nonatomic, readwrite, retain) CPTAxisSet *axisSet; -@property (nonatomic, readwrite, retain) CPTPlotGroup *plotGroup; - -@end diff --git a/CorePlotHeaders/CPTPlotGroup.h b/CorePlotHeaders/CPTPlotGroup.h deleted file mode 100755 index 95f2dd8..0000000 --- a/CorePlotHeaders/CPTPlotGroup.h +++ /dev/null @@ -1,15 +0,0 @@ -#import "CPTLayer.h" - -@class CPTPlot; - -@interface CPTPlotGroup : CPTLayer { -} - -/// @name Adding and Removing Plots -/// @{ --(void)addPlot:(CPTPlot *)plot; --(void)removePlot:(CPTPlot *)plot; --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx; -/// @} - -@end diff --git a/CorePlotHeaders/CPTPlotRange.h b/CorePlotHeaders/CPTPlotRange.h deleted file mode 100755 index 205ff2e..0000000 --- a/CorePlotHeaders/CPTPlotRange.h +++ /dev/null @@ -1,67 +0,0 @@ -#import "CPTDefinitions.h" -#import - -/// @file - -/** - * @brief Enumeration of possible results of a plot range comparison. - **/ -typedef enum _CPTPlotRangeComparisonResult { - CPTPlotRangeComparisonResultNumberBelowRange, ///< Number is below the range. - CPTPlotRangeComparisonResultNumberInRange, ///< Number is in the range. - CPTPlotRangeComparisonResultNumberAboveRange ///< Number is above the range. -} -CPTPlotRangeComparisonResult; - -@interface CPTPlotRange : NSObject { - @private - NSDecimal location; - NSDecimal length; - double locationDouble; - double lengthDouble; -} - -/// @name Range Limits -/// @{ -@property (nonatomic, readonly) NSDecimal location; -@property (nonatomic, readonly) NSDecimal length; -@property (nonatomic, readonly) NSDecimal end; -@property (nonatomic, readonly) double locationDouble; -@property (nonatomic, readonly) double lengthDouble; -@property (nonatomic, readonly) double endDouble; - -@property (nonatomic, readonly) NSDecimal minLimit; -@property (nonatomic, readonly) NSDecimal midPoint; -@property (nonatomic, readonly) NSDecimal maxLimit; -@property (nonatomic, readonly) double minLimitDouble; -@property (nonatomic, readonly) double midPointDouble; -@property (nonatomic, readonly) double maxLimitDouble; -/// @} - -/// @name Factory Methods -/// @{ -+(id)plotRangeWithLocation:(NSDecimal)loc length:(NSDecimal)len; -/// @} - -/// @name Initialization -/// @{ --(id)initWithLocation:(NSDecimal)loc length:(NSDecimal)len; -/// @} - -/// @name Checking Ranges -/// @{ --(BOOL)contains:(NSDecimal)number; --(BOOL)containsDouble:(double)number; --(BOOL)isEqualToRange:(CPTPlotRange *)otherRange; --(BOOL)containsRange:(CPTPlotRange *)otherRange; --(BOOL)intersectsRange:(CPTPlotRange *)otherRange; -/// @} - -/// @name Range Comparison -/// @{ --(CPTPlotRangeComparisonResult)compareToNumber:(NSNumber *)number; --(CPTPlotRangeComparisonResult)compareToDecimal:(NSDecimal)number; --(CPTPlotRangeComparisonResult)compareToDouble:(double)number; -/// @} - -@end diff --git a/CorePlotHeaders/CPTPlotSpace.h b/CorePlotHeaders/CPTPlotSpace.h deleted file mode 100755 index 1d0c0a3..0000000 --- a/CorePlotHeaders/CPTPlotSpace.h +++ /dev/null @@ -1,170 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTResponder.h" - -@class CPTLayer; -@class CPTPlotRange; -@class CPTGraph; -@class CPTPlotSpace; - -/// @name Plot Space -/// @{ - -/** @brief Plot space coordinate change notification. - * - * This notification is posted to the default notification center whenever the mapping between - * the plot space coordinate system and drawing coordinates changes. - * @ingroup notification - **/ -extern NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification; - -/// @} - -/** - * @brief Plot space delegate. - **/ -@protocol CPTPlotSpaceDelegate - -@optional - -/// @name Scaling -/// @{ - -/** @brief @optional Informs the receiver that it should uniformly scale (e.g., in response to a pinch gesture). - * @param space The plot space. - * @param interactionScale The scaling factor. - * @param interactionPoint The coordinates of the scaling centroid. - * @return @YES if the gesture should be handled by the plot space, and @NO if not. - * In either case, the delegate may choose to take extra actions, or handle the scaling itself. - **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldScaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint; - -/// @} - -/// @name Scrolling -/// @{ - -/** @brief @optional Notifies that plot space is going to scroll. - * @param space The plot space. - * @param proposedDisplacementVector The proposed amount by which the plot space will shift. - * @return The displacement actually applied. - **/ --(CGPoint)plotSpace:(CPTPlotSpace *)space willDisplaceBy:(CGPoint)proposedDisplacementVector; - -/// @} - -/// @name Plot Range Changes -/// @{ - -/** @brief @optional Notifies that plot space is going to change a plot range. - * @param space The plot space. - * @param newRange The proposed new plot range. - * @param coordinate The coordinate of the range. - * @return The new plot range to be used. - **/ --(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate; - -/** @brief @optional Notifies that plot space has changed a plot range. - * @param space The plot space. - * @param coordinate The coordinate of the range. - **/ --(void)plotSpace:(CPTPlotSpace *)space didChangePlotRangeForCoordinate:(CPTCoordinate)coordinate; - -/// @} - -/// @name User Interaction -/// @{ - -/** @brief @optional Notifies that plot space intercepted a device down event. - * @param space The plot space. - * @param event The native event. - * @param point The point in the host view. - * @return Whether the plot space should handle the event or not. - * In either case, the delegate may choose to take extra actions, or handle the scaling itself. - **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point; - -/** @brief @optional Notifies that plot space intercepted a device dragged event. - * @param space The plot space. - * @param event The native event. - * @param point The point in the host view. - * @return Whether the plot space should handle the event or not. - * In either case, the delegate may choose to take extra actions, or handle the scaling itself. - **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point; - -/** @brief @optional Notifies that plot space intercepted a device cancelled event. - * @param space The plot space. - * @param event The native event. - * @return Whether the plot space should handle the event or not. - * In either case, the delegate may choose to take extra actions, or handle the scaling itself. - **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceCancelledEvent:(CPTNativeEvent *)event; - -/** @brief @optional Notifies that plot space intercepted a device up event. - * @param space The plot space. - * @param event The native event. - * @param point The point in the host view. - * @return Whether the plot space should handle the event or not. - * In either case, the delegate may choose to take extra actions, or handle the scaling itself. - **/ --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point; - -/// @} - -@end - -#pragma mark - - -@interface CPTPlotSpace : NSObject { - @private - __cpt_weak CPTGraph *graph; - id identifier; - __cpt_weak id delegate; - BOOL allowsUserInteraction; -} - -@property (nonatomic, readwrite, copy) id identifier; -@property (nonatomic, readwrite, assign) BOOL allowsUserInteraction; -@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak CPTGraph *graph; -@property (nonatomic, readwrite, cpt_weak_property) __cpt_weak id delegate; - -@end - -#pragma mark - - -/** @category CPTPlotSpace(AbstractMethods) - * @brief CPTPlotSpace abstract methods—must be overridden by subclasses - **/ -@interface CPTPlotSpace(AbstractMethods) - -/// @name Coordinate Space Conversions -/// @{ --(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint; --(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint; --(void)plotPoint:(NSDecimal *)plotPoint forPlotAreaViewPoint:(CGPoint)point; --(void)doublePrecisionPlotPoint:(double *)plotPoint forPlotAreaViewPoint:(CGPoint)point; - --(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event; --(void)plotPoint:(NSDecimal *)plotPoint forEvent:(CPTNativeEvent *)event; --(void)doublePrecisionPlotPoint:(double *)plotPoint forEvent:(CPTNativeEvent *)event; -/// @} - -/// @name Coordinate Range -/// @{ --(void)setPlotRange:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate; --(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate; -/// @} - -/// @name Scale Types -/// @{ --(void)setScaleType:(CPTScaleType)newType forCoordinate:(CPTCoordinate)coordinate; --(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate)coordinate; -/// @} - -/// @name Adjusting Ranges -/// @{ --(void)scaleToFitPlots:(NSArray *)plots; --(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint; -/// @} - -@end diff --git a/CorePlotHeaders/CPTPlotSpaceAnnotation.h b/CorePlotHeaders/CPTPlotSpaceAnnotation.h deleted file mode 100755 index c250fb5..0000000 --- a/CorePlotHeaders/CPTPlotSpaceAnnotation.h +++ /dev/null @@ -1,16 +0,0 @@ -#import "CPTAnnotation.h" -#import - -@class CPTPlotSpace; - -@interface CPTPlotSpaceAnnotation : CPTAnnotation { - NSArray *anchorPlotPoint; - CPTPlotSpace *plotSpace; -} - -@property (nonatomic, readwrite, copy) NSArray *anchorPlotPoint; -@property (nonatomic, readonly, retain) CPTPlotSpace *plotSpace; - --(id)initWithPlotSpace:(CPTPlotSpace *)space anchorPlotPoint:(NSArray *)plotPoint; - -@end diff --git a/CorePlotHeaders/CPTPlotSymbol.h b/CorePlotHeaders/CPTPlotSymbol.h deleted file mode 100755 index e4a126a..0000000 --- a/CorePlotHeaders/CPTPlotSymbol.h +++ /dev/null @@ -1,76 +0,0 @@ -#import -#import - -/// @file - -@class CPTLineStyle; -@class CPTFill; -@class CPTShadow; - -/** - * @brief Plot symbol types. - **/ -typedef enum _CPTPlotSymbolType { - CPTPlotSymbolTypeNone, ///< No symbol. - CPTPlotSymbolTypeRectangle, ///< Rectangle symbol. - CPTPlotSymbolTypeEllipse, ///< Elliptical symbol. - CPTPlotSymbolTypeDiamond, ///< Diamond symbol. - CPTPlotSymbolTypeTriangle, ///< Triangle symbol. - CPTPlotSymbolTypeStar, ///< 5-point star symbol. - CPTPlotSymbolTypePentagon, ///< Pentagon symbol. - CPTPlotSymbolTypeHexagon, ///< Hexagon symbol. - CPTPlotSymbolTypeCross, ///< X symbol. - CPTPlotSymbolTypePlus, ///< Plus symbol. - CPTPlotSymbolTypeDash, ///< Dash symbol. - CPTPlotSymbolTypeSnow, ///< Snowflake symbol. - CPTPlotSymbolTypeCustom ///< Custom symbol. -} -CPTPlotSymbolType; - -@interface CPTPlotSymbol : NSObject { - @private - CGPoint anchorPoint; - CGSize size; - CPTPlotSymbolType symbolType; - CPTLineStyle *lineStyle; - CPTFill *fill; - CGPathRef cachedSymbolPath; - CGPathRef customSymbolPath; - BOOL usesEvenOddClipRule; - CGLayerRef cachedLayer; - CPTShadow *shadow; -} - -@property (nonatomic, readwrite, assign) CGPoint anchorPoint; -@property (nonatomic, readwrite, assign) CGSize size; -@property (nonatomic, readwrite, assign) CPTPlotSymbolType symbolType; -@property (nonatomic, readwrite, retain) CPTLineStyle *lineStyle; -@property (nonatomic, readwrite, retain) CPTFill *fill; -@property (nonatomic, readwrite, copy) CPTShadow *shadow; -@property (nonatomic, readwrite, assign) CGPathRef customSymbolPath; -@property (nonatomic, readwrite, assign) BOOL usesEvenOddClipRule; - -/// @name Factory Methods -/// @{ -+(CPTPlotSymbol *)plotSymbol; -+(CPTPlotSymbol *)crossPlotSymbol; -+(CPTPlotSymbol *)ellipsePlotSymbol; -+(CPTPlotSymbol *)rectanglePlotSymbol; -+(CPTPlotSymbol *)plusPlotSymbol; -+(CPTPlotSymbol *)starPlotSymbol; -+(CPTPlotSymbol *)diamondPlotSymbol; -+(CPTPlotSymbol *)trianglePlotSymbol; -+(CPTPlotSymbol *)pentagonPlotSymbol; -+(CPTPlotSymbol *)hexagonPlotSymbol; -+(CPTPlotSymbol *)dashPlotSymbol; -+(CPTPlotSymbol *)snowPlotSymbol; -+(CPTPlotSymbol *)customPlotSymbolWithPath:(CGPathRef)aPath; -/// @} - -/// @name Drawing -/// @{ --(void)renderInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFloat)scale alignToPixels:(BOOL)alignToPixels; --(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFloat)scale; -/// @} - -@end diff --git a/CorePlotHeaders/CPTRangePlot.h b/CorePlotHeaders/CPTRangePlot.h deleted file mode 100755 index 6b5f294..0000000 --- a/CorePlotHeaders/CPTRangePlot.h +++ /dev/null @@ -1,126 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTPlot.h" -#import - -@class CPTLineStyle; -@class CPTFill; -@class CPTRangePlot; - -/// @ingroup plotBindingsRangePlot -/// @{ -extern NSString *const CPTRangePlotBindingXValues; -extern NSString *const CPTRangePlotBindingYValues; -extern NSString *const CPTRangePlotBindingHighValues; -extern NSString *const CPTRangePlotBindingLowValues; -extern NSString *const CPTRangePlotBindingLeftValues; -extern NSString *const CPTRangePlotBindingRightValues; -extern NSString *const CPTRangePlotBindingBarLineStyles; -/// @} - -/** - * @brief Enumeration of range plot data source field types - **/ -typedef enum _CPTRangePlotField { - CPTRangePlotFieldX, ///< X values. - CPTRangePlotFieldY, ///< Y values. - CPTRangePlotFieldHigh, ///< relative High values. - CPTRangePlotFieldLow, ///< relative Low values. - CPTRangePlotFieldLeft, ///< relative Left values. - CPTRangePlotFieldRight, ///< relative Right values. -} -CPTRangePlotField; - -#pragma mark - - -/** - * @brief A range plot data source. - **/ -@protocol CPTRangePlotDataSource -@optional - -/// @name Bar Style -/// @{ - -/** @brief @optional Gets a range of bar line styles for the given range plot. - * @param plot The range plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of line styles. - **/ --(NSArray *)barLineStylesForRangePlot:(CPTRangePlot *)plot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a bar line style for the given range plot. - * This method will not be called if - * @link CPTRangePlotDataSource::barLineStylesForRangePlot:recordIndexRange: -barLineStylesForRangePlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The range plot. - * @param idx The data index of interest. - * @return The bar line style for the bar with the given index. If the data source returns @nil, the default line style is used. - * If the data source returns an NSNull object, no line is drawn. - **/ --(CPTLineStyle *)barLineStyleForRangePlot:(CPTRangePlot *)plot recordIndex:(NSUInteger)idx; - -/// @} - -@end - -#pragma mark - - -/** - * @brief Range plot delegate. - **/ -@protocol CPTRangePlotDelegate - -@optional - -/// @name Point Selection -/// @{ - -/** @brief @optional Informs the delegate that a bar was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The range plot. - * @param idx The index of the - * @if MacOnly clicked bar. @endif - * @if iOSOnly touched bar. @endif - **/ --(void)rangePlot:(CPTRangePlot *)plot rangeWasSelectedAtRecordIndex:(NSUInteger)idx; - -/** @brief @optional Informs the delegate that a bar was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The range plot. - * @param idx The index of the - * @if MacOnly clicked bar. @endif - * @if iOSOnly touched bar. @endif - * @param event The event that triggered the selection. - **/ --(void)rangePlot:(CPTRangePlot *)plot rangeWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; - -/// @} - -@end - -#pragma mark - - -@interface CPTRangePlot : CPTPlot { - CPTLineStyle *barLineStyle; - CGFloat barWidth; - CGFloat gapHeight; - CGFloat gapWidth; - CPTFill *areaFill; -} - -/// @name Appearance -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *barLineStyle; -@property (nonatomic, readwrite) CGFloat barWidth; -@property (nonatomic, readwrite) CGFloat gapHeight; -@property (nonatomic, readwrite) CGFloat gapWidth; -/// @} - -/// @name Drawing -/// @{ -@property (nonatomic, copy) CPTFill *areaFill; -/// @} - -@end diff --git a/CorePlotHeaders/CPTResponder.h b/CorePlotHeaders/CPTResponder.h deleted file mode 100755 index f3722e0..0000000 --- a/CorePlotHeaders/CPTResponder.h +++ /dev/null @@ -1,55 +0,0 @@ -#import -#import - -#import "CPTPlatformSpecificDefines.h" - -/** - * @brief The basis of all event processing in Core Plot. - **/ -@protocol CPTResponder - -/// @name User Interaction -/// @{ - -/** - * @brief @required Informs the receiver that the user has - * @if MacOnly pressed the mouse button. @endif - * @if iOSOnly touched the screen. @endif - * @param event The OS event. - * @param interactionPoint The coordinates of the interaction. - * @return Whether the event was handled or not. - **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint; - -/** - * @brief @required Informs the receiver that the user has - * @if MacOnly released the mouse button. @endif - * @if iOSOnly lifted their finger off the screen. @endif - * @param event The OS event. - * @param interactionPoint The coordinates of the interaction. - * @return Whether the event was handled or not. - **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint; - -/** - * @brief @required Informs the receiver that the user has moved - * @if MacOnly the mouse with the button pressed. @endif - * @if iOSOnly their finger while touching the screen. @endif - * @param event The OS event. - * @param interactionPoint The coordinates of the interaction. - * @return Whether the event was handled or not. - **/ --(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint; - -/** - * @brief @required Informs the receiver that tracking of - * @if MacOnly mouse moves @endif - * @if iOSOnly touches @endif - * has been cancelled for any reason. - * @param event The OS event. - * @return Whether the event was handled or not. - **/ --(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event; -/// @} - -@end diff --git a/CorePlotHeaders/CPTScatterPlot.h b/CorePlotHeaders/CPTScatterPlot.h deleted file mode 100755 index bbc8443..0000000 --- a/CorePlotHeaders/CPTScatterPlot.h +++ /dev/null @@ -1,156 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTPlot.h" -#import - -/// @file - -@class CPTLineStyle; -@class CPTMutableNumericData; -@class CPTNumericData; -@class CPTPlotSymbol; -@class CPTScatterPlot; -@class CPTFill; - -/// @ingroup plotBindingsScatterPlot -/// @{ -extern NSString *const CPTScatterPlotBindingXValues; -extern NSString *const CPTScatterPlotBindingYValues; -extern NSString *const CPTScatterPlotBindingPlotSymbols; -/// @} - -/** - * @brief Enumeration of scatter plot data source field types - **/ -typedef enum _CPTScatterPlotField { - CPTScatterPlotFieldX, ///< X values. - CPTScatterPlotFieldY ///< Y values. -} -CPTScatterPlotField; - -/** - * @brief Enumeration of scatter plot interpolation algorithms - **/ -typedef enum _CPTScatterPlotInterpolation { - CPTScatterPlotInterpolationLinear, ///< Linear interpolation. - CPTScatterPlotInterpolationStepped, ///< Steps beginnning at data point. - CPTScatterPlotInterpolationHistogram, ///< Steps centered at data point. - CPTScatterPlotInterpolationCurved ///< Bezier curve interpolation. -} -CPTScatterPlotInterpolation; - -#pragma mark - - -/** - * @brief A scatter plot data source. - **/ -@protocol CPTScatterPlotDataSource - -@optional - -/// @name Plot Symbols -/// @{ - -/** @brief @optional Gets a range of plot symbols for the given scatter plot. - * @param plot The scatter plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of plot symbols. - **/ --(NSArray *)symbolsForScatterPlot:(CPTScatterPlot *)plot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets a single plot symbol for the given scatter plot. - * This method will not be called if - * @link CPTScatterPlotDataSource::symbolsForScatterPlot:recordIndexRange: -symbolsForScatterPlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The scatter plot. - * @param idx The data index of interest. - * @return The plot symbol to show for the point with the given index. - **/ --(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)idx; - -/// @} - -@end - -#pragma mark - - -/** - * @brief Scatter plot delegate. - **/ -@protocol CPTScatterPlotDelegate - -@optional - -/// @name Point Selection -/// @{ - -/** @brief @optional Informs the delegate that a data point was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The scatter plot. - * @param idx The index of the - * @if MacOnly clicked data point. @endif - * @if iOSOnly touched data point. @endif - **/ --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)idx; - -/** @brief @optional Informs the delegate that a data point was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The scatter plot. - * @param idx The index of the - * @if MacOnly clicked data point. @endif - * @if iOSOnly touched data point. @endif - * @param event The event that triggered the selection. - **/ --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; - -/// @} - -@end - -#pragma mark - - -@interface CPTScatterPlot : CPTPlot { - @private - CPTScatterPlotInterpolation interpolation; - CPTLineStyle *dataLineStyle; - CPTPlotSymbol *plotSymbol; - CPTFill *areaFill; - CPTFill *areaFill2; - NSDecimal areaBaseValue; - NSDecimal areaBaseValue2; - CGFloat plotSymbolMarginForHitDetection; -} - -/// @name Appearance -/// @{ -@property (nonatomic, readwrite) NSDecimal areaBaseValue; -@property (nonatomic, readwrite) NSDecimal areaBaseValue2; -@property (nonatomic, readwrite, assign) CPTScatterPlotInterpolation interpolation; -/// @} - -/// @name Drawing -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *dataLineStyle; -@property (nonatomic, readwrite, copy) CPTPlotSymbol *plotSymbol; -@property (nonatomic, readwrite, copy) CPTFill *areaFill; -@property (nonatomic, readwrite, copy) CPTFill *areaFill2; -/// @} - -/// @name User Interaction -/// @{ -@property (nonatomic, readwrite, assign) CGFloat plotSymbolMarginForHitDetection; -/// @} - -/// @name Visible Points -/// @{ --(NSUInteger)indexOfVisiblePointClosestToPlotAreaPoint:(CGPoint)viewPoint; --(CGPoint)plotAreaPointOfVisiblePointAtIndex:(NSUInteger)idx; -/// @} - -/// @name Plot Symbols -/// @{ --(CPTPlotSymbol *)plotSymbolForRecordIndex:(NSUInteger)idx; -/// @} - -@end diff --git a/CorePlotHeaders/CPTShadow.h b/CorePlotHeaders/CPTShadow.h deleted file mode 100755 index c93b606..0000000 --- a/CorePlotHeaders/CPTShadow.h +++ /dev/null @@ -1,27 +0,0 @@ -#import -#import - -@class CPTColor; - -@interface CPTShadow : NSObject { - @private - CGSize shadowOffset; - CGFloat shadowBlurRadius; - CPTColor *shadowColor; -} - -@property (nonatomic, readonly, assign) CGSize shadowOffset; -@property (nonatomic, readonly, assign) CGFloat shadowBlurRadius; -@property (nonatomic, readonly, retain) CPTColor *shadowColor; - -/// @name Factory Methods -/// @{ -+(id)shadow; -/// @} - -/// @name Drawing -/// @{ --(void)setShadowInContext:(CGContextRef)context; -/// @} - -@end diff --git a/CorePlotHeaders/CPTTestCase.h b/CorePlotHeaders/CPTTestCase.h deleted file mode 100755 index 122fd91..0000000 --- a/CorePlotHeaders/CPTTestCase.h +++ /dev/null @@ -1,6 +0,0 @@ -#import - -@interface CPTTestCase : SenTestCase { -} - -@end diff --git a/CorePlotHeaders/CPTTextLayer.h b/CorePlotHeaders/CPTTextLayer.h deleted file mode 100755 index 24bb76f..0000000 --- a/CorePlotHeaders/CPTTextLayer.h +++ /dev/null @@ -1,29 +0,0 @@ -#import "CPTBorderedLayer.h" -#import "CPTTextStyle.h" - -/// @file - -extern const CGFloat kCPTTextLayerMarginWidth; ///< Margin width around the text. - -@interface CPTTextLayer : CPTBorderedLayer { - @private - NSString *text; - CPTTextStyle *textStyle; -} - -@property (readwrite, copy, nonatomic) NSString *text; -@property (readwrite, retain, nonatomic) CPTTextStyle *textStyle; - -/// @name Initialization -/// @{ --(id)initWithText:(NSString *)newText; --(id)initWithText:(NSString *)newText style:(CPTTextStyle *)newStyle; -/// @} - -/// @name Layout -/// @{ --(CGSize)sizeThatFits; --(void)sizeToFit; -/// @} - -@end diff --git a/CorePlotHeaders/CPTTextStyle.h b/CorePlotHeaders/CPTTextStyle.h deleted file mode 100755 index f447581..0000000 --- a/CorePlotHeaders/CPTTextStyle.h +++ /dev/null @@ -1,53 +0,0 @@ -#import -#import - -/// @file - -@class CPTColor; - -/** - * @brief Enumeration of paragraph alignments. - **/ -typedef enum _CPTTextAlignment { - CPTTextAlignmentLeft, ///< Left alignment - CPTTextAlignmentCenter, ///< Center alignment - CPTTextAlignmentRight ///< Right alignment -} -CPTTextAlignment; - -@interface CPTTextStyle : NSObject { - @protected - NSString *fontName; - CGFloat fontSize; - CPTColor *color; - CPTTextAlignment textAlignment; -} - -@property (readonly, copy, nonatomic) NSString *fontName; -@property (readonly, assign, nonatomic) CGFloat fontSize; -@property (readonly, copy, nonatomic) CPTColor *color; -@property (readonly, assign, nonatomic) CPTTextAlignment textAlignment; - -/// @name Factory Methods -/// @{ -+(id)textStyle; -/// @} - -@end - -/** @category NSString(CPTTextStyleExtensions) - * @brief NSString extensions for drawing styled text. - **/ -@interface NSString(CPTTextStyleExtensions) - -/// @name Measurement -/// @{ --(CGSize)sizeWithTextStyle:(CPTTextStyle *)style; -/// @} - -/// @name Drawing -/// @{ --(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CGContextRef)context; -/// @} - -@end diff --git a/CorePlotHeaders/CPTTextStylePlatformSpecific.h b/CorePlotHeaders/CPTTextStylePlatformSpecific.h deleted file mode 100755 index 0b8c4b8..0000000 --- a/CorePlotHeaders/CPTTextStylePlatformSpecific.h +++ /dev/null @@ -1 +0,0 @@ -#import diff --git a/CorePlotHeaders/CPTTheme.h b/CorePlotHeaders/CPTTheme.h deleted file mode 100755 index 64983b9..0000000 --- a/CorePlotHeaders/CPTTheme.h +++ /dev/null @@ -1,53 +0,0 @@ -#import - -/// @ingroup themeNames -/// @{ -extern NSString *const kCPTDarkGradientTheme; ///< A graph theme with dark gray gradient backgrounds and light gray lines. -extern NSString *const kCPTPlainBlackTheme; ///< A graph theme with black backgrounds and white lines. -extern NSString *const kCPTPlainWhiteTheme; ///< A graph theme with white backgrounds and black lines. -extern NSString *const kCPTSlateTheme; ///< A graph theme with colors that match the default iPhone navigation bar, toolbar buttons, and table views. -extern NSString *const kCPTStocksTheme; ///< A graph theme with a gradient background and white lines. -/// @} - -@class CPTGraph; -@class CPTPlotAreaFrame; -@class CPTAxisSet; -@class CPTMutableTextStyle; - -@interface CPTTheme : NSObject { - @private - Class graphClass; -} - -@property (nonatomic, readwrite, retain) Class graphClass; - -/// @name Theme Management -/// @{ -+(void)registerTheme:(Class)themeClass; -+(NSArray *)themeClasses; -+(CPTTheme *)themeNamed:(NSString *)theme; -+(NSString *)name; -/// @} - -/// @name Theme Usage -/// @{ --(void)applyThemeToGraph:(CPTGraph *)graph; -/// @} - -@end - -/** @category CPTTheme(AbstractMethods) - * @brief CPTTheme abstract methods—must be overridden by subclasses - **/ -@interface CPTTheme(AbstractMethods) - -/// @name Theme Usage -/// @{ --(id)newGraph; - --(void)applyThemeToBackground:(CPTGraph *)graph; --(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame; --(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet; -/// @} - -@end diff --git a/CorePlotHeaders/CPTTimeFormatter.h b/CorePlotHeaders/CPTTimeFormatter.h deleted file mode 100755 index cd4c5f8..0000000 --- a/CorePlotHeaders/CPTTimeFormatter.h +++ /dev/null @@ -1,19 +0,0 @@ -#import - -/// @file - -@interface CPTTimeFormatter : NSNumberFormatter { - @private - NSDateFormatter *dateFormatter; - NSDate *referenceDate; -} - -@property (nonatomic, readwrite, retain) NSDateFormatter *dateFormatter; -@property (nonatomic, readwrite, copy) NSDate *referenceDate; - -/// @name Initialization -/// @{ --(id)initWithDateFormatter:(NSDateFormatter *)aDateFormatter; -/// @} - -@end diff --git a/CorePlotHeaders/CPTTradingRangePlot.h b/CorePlotHeaders/CPTTradingRangePlot.h deleted file mode 100755 index 5ea6cef..0000000 --- a/CorePlotHeaders/CPTTradingRangePlot.h +++ /dev/null @@ -1,229 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTPlot.h" -#import - -/// @file - -@class CPTLineStyle; -@class CPTMutableNumericData; -@class CPTNumericData; -@class CPTTradingRangePlot; -@class CPTFill; - -/// @ingroup plotBindingsTradingRangePlot -/// @{ -extern NSString *const CPTTradingRangePlotBindingXValues; -extern NSString *const CPTTradingRangePlotBindingOpenValues; -extern NSString *const CPTTradingRangePlotBindingHighValues; -extern NSString *const CPTTradingRangePlotBindingLowValues; -extern NSString *const CPTTradingRangePlotBindingCloseValues; -extern NSString *const CPTTradingRangePlotBindingIncreaseFills; -extern NSString *const CPTTradingRangePlotBindingDecreaseFills; -extern NSString *const CPTTradingRangePlotBindingLineStyles; -extern NSString *const CPTTradingRangePlotBindingIncreaseLineStyles; -extern NSString *const CPTTradingRangePlotBindingDecreaseLineStyles; -/// @} - -/** - * @brief Enumeration of Quote plot render style types. - **/ -typedef enum _CPTTradingRangePlotStyle { - CPTTradingRangePlotStyleOHLC, ///< Open-High-Low-Close (OHLC) plot. - CPTTradingRangePlotStyleCandleStick ///< Candlestick plot. -} -CPTTradingRangePlotStyle; - -/** - * @brief Enumeration of Quote plot data source field types. - **/ -typedef enum _CPTTradingRangePlotField { - CPTTradingRangePlotFieldX, ///< X values. - CPTTradingRangePlotFieldOpen, ///< Open values. - CPTTradingRangePlotFieldHigh, ///< High values. - CPTTradingRangePlotFieldLow, ///< Low values. - CPTTradingRangePlotFieldClose ///< Close values. -} -CPTTradingRangePlotField; - -#pragma mark - - -/** - * @brief A trading range plot data source. - **/ -@protocol CPTTradingRangePlotDataSource -@optional - -/// @name Bar Fills -/// @{ - -/** @brief @optional Gets a range of fills used with a candlestick plot when close >= open for the given plot. - * @param plot The trading range plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of fills. - **/ --(NSArray *)increaseFillsForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets the fill used with a candlestick plot when close >= open for the given plot. - * This method will not be called if - * @link CPTTradingRangePlotDataSource::increaseFillsForTradingRangePlot:recordIndexRange: -increaseFillsForTradingRangePlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The trading range plot. - * @param idx The data index of interest. - * @return The bar fill for the bar with the given index. If the data source returns @nil, the default increase fill is used. - * If the data source returns an NSNull object, no fill is drawn. - **/ --(CPTFill *)increaseFillForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; - -/** @brief @optional Gets a range of fills used with a candlestick plot when close < open for the given plot. - * @param plot The trading range plot. - * @param indexRange The range of the data indexes of interest. - * @param indexRange The range of the data indexes of interest. - **/ --(NSArray *)decreaseFillsForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets the fill used with a candlestick plot when close < open for the given plot. - * This method will not be called if - * @link CPTTradingRangePlotDataSource::decreaseFillsForTradingRangePlot:recordIndexRange: -decreaseFillsForTradingRangePlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The trading range plot. - * @param idx The data index of interest. - * @return The bar fill for the bar with the given index. If the data source returns @nil, the default decrease fill is used. - * If the data source returns an NSNull object, no fill is drawn. - **/ --(CPTFill *)decreaseFillForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; - -/// @} - -/// @name Bar Line Styles -/// @{ - -/** @brief @optional Gets a range of line styles used to draw candlestick or OHLC symbols for the given trading range plot. - * @param plot The trading range plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of line styles. - **/ --(NSArray *)lineStylesForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets the line style used to draw candlestick or OHLC symbols for the given trading range plot. - * This method will not be called if - * @link CPTTradingRangePlotDataSource::lineStylesForTradingRangePlot:recordIndexRange: -lineStylesForTradingRangePlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The trading range plot. - * @param idx The data index of interest. - * @return The line style for the symbol with the given index. If the data source returns @nil, the default line style is used. - * If the data source returns an NSNull object, no line is drawn. - **/ --(CPTLineStyle *)lineStyleForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; - -/** @brief @optional Gets a range of line styles used to outline candlestick symbols when close >= open for the given trading range plot. - * @param plot The trading range plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of line styles. - **/ --(NSArray *)increaseLineStylesForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets the line style used to outline candlestick symbols when close >= open for the given trading range plot. - * This method will not be called if - * @link CPTTradingRangePlotDataSource::increaseLineStylesForTradingRangePlot:recordIndexRange: -increaseLineStylesForTradingRangePlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The trading range plot. - * @param idx The data index of interest. - * @return The line line style for the symbol with the given index. If the data source returns @nil, the default increase line style is used. - * If the data source returns an NSNull object, no line is drawn. - **/ --(CPTLineStyle *)increaseLineStyleForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; - -/** @brief @optional Gets a range of line styles used to outline candlestick symbols when close < open for the given trading range plot. - * @param plot The trading range plot. - * @param indexRange The range of the data indexes of interest. - * @return An array of line styles. - **/ --(NSArray *)decreaseLineStylesForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; - -/** @brief @optional Gets the line style used to outline candlestick symbols when close < open for the given trading range plot. - * This method will not be called if - * @link CPTTradingRangePlotDataSource::decreaseLineStylesForTradingRangePlot:recordIndexRange: -decreaseLineStylesForTradingRangePlot:recordIndexRange: @endlink - * is also implemented in the datasource. - * @param plot The trading range plot. - * @param idx The data index of interest. - * @return The line line style for the symbol with the given index. If the data source returns @nil, the default decrease line style is used. - * If the data source returns an NSNull object, no line is drawn. - **/ --(CPTLineStyle *)decreaseLineStyleForTradingRangePlot:(CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; - -/// @} - -@end - -#pragma mark - - -/** - * @brief Trading range plot delegate. - **/ -@protocol CPTTradingRangePlotDelegate - -@optional - -/// @name Point Selection -/// @{ - -/** @brief @optional Informs the delegate that a bar was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The trading range plot. - * @param idx The index of the - * @if MacOnly clicked bar. @endif - * @if iOSOnly touched bar. @endif - **/ --(void)tradingRangePlot:(CPTTradingRangePlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx; - -/** @brief @optional Informs the delegate that a bar was - * @if MacOnly clicked. @endif - * @if iOSOnly touched. @endif - * @param plot The trading range plot. - * @param idx The index of the - * @if MacOnly clicked bar. @endif - * @if iOSOnly touched bar. @endif - * @param event The event that triggered the selection. - **/ --(void)tradingRangePlot:(CPTTradingRangePlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)idx withEvent:(CPTNativeEvent *)event; - -/// @} - -@end - -#pragma mark - - -@interface CPTTradingRangePlot : CPTPlot { - @private - CPTLineStyle *lineStyle; - CPTLineStyle *increaseLineStyle; - CPTLineStyle *decreaseLineStyle; - CPTFill *increaseFill; - CPTFill *decreaseFill; - - CPTTradingRangePlotStyle plotStyle; - - CGFloat barWidth; - CGFloat stickLength; - CGFloat barCornerRadius; -} - -/// @name Appearance -/// @{ -@property (nonatomic, readwrite, assign) CPTTradingRangePlotStyle plotStyle; -@property (nonatomic, readwrite, assign) CGFloat barWidth; // In view coordinates -@property (nonatomic, readwrite, assign) CGFloat stickLength; // In view coordinates -@property (nonatomic, readwrite, assign) CGFloat barCornerRadius; -/// @} - -/// @name Drawing -/// @{ -@property (nonatomic, readwrite, copy) CPTLineStyle *lineStyle; -@property (nonatomic, readwrite, copy) CPTLineStyle *increaseLineStyle; -@property (nonatomic, readwrite, copy) CPTLineStyle *decreaseLineStyle; -@property (nonatomic, readwrite, copy) CPTFill *increaseFill; -@property (nonatomic, readwrite, copy) CPTFill *decreaseFill; -/// @} - -@end diff --git a/CorePlotHeaders/CPTUtilities.h b/CorePlotHeaders/CPTUtilities.h deleted file mode 100755 index 6863027..0000000 --- a/CorePlotHeaders/CPTUtilities.h +++ /dev/null @@ -1,128 +0,0 @@ -#import "CPTDefinitions.h" -#import - -/// @file - -#if __cplusplus -extern "C" { -#endif - -/// @name Convert NSDecimal to Primitive Types -/// @{ -int8_t CPTDecimalCharValue(NSDecimal decimalNumber); -int16_t CPTDecimalShortValue(NSDecimal decimalNumber); -int32_t CPTDecimalLongValue(NSDecimal decimalNumber); -int64_t CPTDecimalLongLongValue(NSDecimal decimalNumber); -int CPTDecimalIntValue(NSDecimal decimalNumber); -NSInteger CPTDecimalIntegerValue(NSDecimal decimalNumber); - -uint8_t CPTDecimalUnsignedCharValue(NSDecimal decimalNumber); -uint16_t CPTDecimalUnsignedShortValue(NSDecimal decimalNumber); -uint32_t CPTDecimalUnsignedLongValue(NSDecimal decimalNumber); -uint64_t CPTDecimalUnsignedLongLongValue(NSDecimal decimalNumber); -unsigned int CPTDecimalUnsignedIntValue(NSDecimal decimalNumber); -NSUInteger CPTDecimalUnsignedIntegerValue(NSDecimal decimalNumber); - -float CPTDecimalFloatValue(NSDecimal decimalNumber); -double CPTDecimalDoubleValue(NSDecimal decimalNumber); -CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber); - -NSString *CPTDecimalStringValue(NSDecimal decimalNumber); - -/// @} - -/// @name Convert Primitive Types to NSDecimal -/// @{ -NSDecimal CPTDecimalFromChar(int8_t anInt); -NSDecimal CPTDecimalFromShort(int16_t anInt); -NSDecimal CPTDecimalFromLong(int32_t anInt); -NSDecimal CPTDecimalFromLongLong(int64_t anInt); -NSDecimal CPTDecimalFromInt(int i); -NSDecimal CPTDecimalFromInteger(NSInteger i); - -NSDecimal CPTDecimalFromUnsignedChar(uint8_t i); -NSDecimal CPTDecimalFromUnsignedShort(uint16_t i); -NSDecimal CPTDecimalFromUnsignedLong(uint32_t i); -NSDecimal CPTDecimalFromUnsignedLongLong(uint64_t i); -NSDecimal CPTDecimalFromUnsignedInt(unsigned int i); -NSDecimal CPTDecimalFromUnsignedInteger(NSUInteger i); - -NSDecimal CPTDecimalFromFloat(float aFloat); -NSDecimal CPTDecimalFromDouble(double aDouble); -NSDecimal CPTDecimalFromCGFloat(CGFloat aCGFloat); - -NSDecimal CPTDecimalFromString(NSString *stringRepresentation); - -/// @} - -/// @name NSDecimal Arithmetic -/// @{ -NSDecimal CPTDecimalAdd(NSDecimal leftOperand, NSDecimal rightOperand); -NSDecimal CPTDecimalSubtract(NSDecimal leftOperand, NSDecimal rightOperand); -NSDecimal CPTDecimalMultiply(NSDecimal leftOperand, NSDecimal rightOperand); -NSDecimal CPTDecimalDivide(NSDecimal numerator, NSDecimal denominator); - -/// @} - -/// @name NSDecimal Comparison -/// @{ -BOOL CPTDecimalGreaterThan(NSDecimal leftOperand, NSDecimal rightOperand); -BOOL CPTDecimalGreaterThanOrEqualTo(NSDecimal leftOperand, NSDecimal rightOperand); -BOOL CPTDecimalLessThan(NSDecimal leftOperand, NSDecimal rightOperand); -BOOL CPTDecimalLessThanOrEqualTo(NSDecimal leftOperand, NSDecimal rightOperand); -BOOL CPTDecimalEquals(NSDecimal leftOperand, NSDecimal rightOperand); - -/// @} - -/// @name NSDecimal Utilities -/// @{ -NSDecimal CPTDecimalNaN(void); - -/// @} - -/// @name Ranges -/// @{ -NSRange CPTExpandedRange(NSRange range, NSInteger expandBy); - -/// @} - -/// @name Coordinates -/// @{ -CPTCoordinate CPTOrthogonalCoordinate(CPTCoordinate coord); - -/// @} - -/// @name Gradient Colors -/// @{ -CPTRGBAColor CPTRGBAColorFromCGColor(CGColorRef color); - -/// @} - -/// @name Quartz Pixel-Alignment Functions -/// @{ -CGPoint CPTAlignPointToUserSpace(CGContextRef context, CGPoint point); -CGSize CPTAlignSizeToUserSpace(CGContextRef context, CGSize size); -CGRect CPTAlignRectToUserSpace(CGContextRef context, CGRect rect); - -CGPoint CPTAlignIntegralPointToUserSpace(CGContextRef context, CGPoint point); -CGRect CPTAlignIntegralRectToUserSpace(CGContextRef context, CGRect rect); - -/// @} - -/// @name String Formatting for Core Graphics Structs -/// @{ -NSString *CPTStringFromPoint(CGPoint point); -NSString *CPTStringFromSize(CGSize size); -NSString *CPTStringFromRect(CGRect rect); - -/// @} - -/// @name CGPoint Utilities -/// @{ -CGFloat squareOfDistanceBetweenPoints(CGPoint point1, CGPoint point2); - -/// @} - -#if __cplusplus -} -#endif diff --git a/CorePlotHeaders/CPTXYAxis.h b/CorePlotHeaders/CPTXYAxis.h deleted file mode 100755 index 559f842..0000000 --- a/CorePlotHeaders/CPTXYAxis.h +++ /dev/null @@ -1,18 +0,0 @@ -#import "CPTAxis.h" -#import - -@class CPTConstraints; - -@interface CPTXYAxis : CPTAxis { - @private - NSDecimal orthogonalCoordinateDecimal; - CPTConstraints *axisConstraints; -} - -/// @name Positioning -/// @{ -@property (nonatomic, readwrite) NSDecimal orthogonalCoordinateDecimal; -@property (nonatomic, readwrite, retain) CPTConstraints *axisConstraints; -/// @} - -@end diff --git a/CorePlotHeaders/CPTXYAxisSet.h b/CorePlotHeaders/CPTXYAxisSet.h deleted file mode 100755 index 82c63d3..0000000 --- a/CorePlotHeaders/CPTXYAxisSet.h +++ /dev/null @@ -1,12 +0,0 @@ -#import "CPTAxisSet.h" -#import - -@class CPTXYAxis; - -@interface CPTXYAxisSet : CPTAxisSet { -} - -@property (nonatomic, readonly, retain) CPTXYAxis *xAxis; -@property (nonatomic, readonly, retain) CPTXYAxis *yAxis; - -@end diff --git a/CorePlotHeaders/CPTXYGraph.h b/CorePlotHeaders/CPTXYGraph.h deleted file mode 100755 index 235c65b..0000000 --- a/CorePlotHeaders/CPTXYGraph.h +++ /dev/null @@ -1,16 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTGraph.h" -#import - -@interface CPTXYGraph : CPTGraph { - @private - CPTScaleType xScaleType; - CPTScaleType yScaleType; -} - -/// @name Initialization -/// @{ --(id)initWithFrame:(CGRect)newFrame xScaleType:(CPTScaleType)newXScaleType yScaleType:(CPTScaleType)newYScaleType; -/// @} - -@end diff --git a/CorePlotHeaders/CPTXYPlotSpace.h b/CorePlotHeaders/CPTXYPlotSpace.h deleted file mode 100755 index c27894a..0000000 --- a/CorePlotHeaders/CPTXYPlotSpace.h +++ /dev/null @@ -1,25 +0,0 @@ -#import "CPTDefinitions.h" -#import "CPTPlotSpace.h" - -@class CPTPlotRange; - -@interface CPTXYPlotSpace : CPTPlotSpace { - @private - CPTPlotRange *xRange; - CPTPlotRange *yRange; - CPTPlotRange *globalXRange; - CPTPlotRange *globalYRange; - CPTScaleType xScaleType; - CPTScaleType yScaleType; - CGPoint lastDragPoint; - BOOL isDragging; -} - -@property (nonatomic, readwrite, copy) CPTPlotRange *xRange; -@property (nonatomic, readwrite, copy) CPTPlotRange *yRange; -@property (nonatomic, readwrite, copy) CPTPlotRange *globalXRange; -@property (nonatomic, readwrite, copy) CPTPlotRange *globalYRange; -@property (nonatomic, readwrite, assign) CPTScaleType xScaleType; -@property (nonatomic, readwrite, assign) CPTScaleType yScaleType; - -@end diff --git a/CorePlotHeaders/CorePlot-CocoaTouch.h b/CorePlotHeaders/CorePlot-CocoaTouch.h deleted file mode 100755 index e882ffd..0000000 --- a/CorePlotHeaders/CorePlot-CocoaTouch.h +++ /dev/null @@ -1,61 +0,0 @@ -#import "CPTAnnotation.h" -#import "CPTAnnotationHostLayer.h" -#import "CPTAxis.h" -#import "CPTAxisLabel.h" -#import "CPTAxisSet.h" -#import "CPTAxisTitle.h" -#import "CPTBarPlot.h" -#import "CPTBorderedLayer.h" -#import "CPTCalendarFormatter.h" -#import "CPTColor.h" -#import "CPTColorSpace.h" -#import "CPTConstraints.h" -#import "CPTDefinitions.h" -#import "CPTExceptions.h" -#import "CPTFill.h" -#import "CPTGradient.h" -#import "CPTGraph.h" -#import "CPTGraphHostingView.h" -#import "CPTImage.h" -#import "CPTLayer.h" -#import "CPTLayerAnnotation.h" -#import "CPTLegend.h" -#import "CPTLegendEntry.h" -#import "CPTLimitBand.h" -#import "CPTLineCap.h" -#import "CPTLineStyle.h" -#import "CPTMutableLineStyle.h" -#import "CPTMutableNumericData.h" -#import "CPTMutableNumericData+TypeConversion.h" -#import "CPTMutablePlotRange.h" -#import "CPTMutableShadow.h" -#import "CPTMutableTextStyle.h" -#import "CPTNumericData.h" -#import "CPTNumericData+TypeConversion.h" -#import "CPTNumericDataType.h" -#import "CPTPieChart.h" -#import "CPTPlatformSpecificDefines.h" -#import "CPTPlatformSpecificFunctions.h" -#import "CPTPlatformSpecificCategories.h" -#import "CPTPathExtensions.h" -#import "CPTPlot.h" -#import "CPTPlotArea.h" -#import "CPTPlotAreaFrame.h" -#import "CPTPlotRange.h" -#import "CPTPlotSpace.h" -#import "CPTPlotSpaceAnnotation.h" -#import "CPTPlotSymbol.h" -#import "CPTRangePlot.h" -#import "CPTResponder.h" -#import "CPTScatterPlot.h" -#import "CPTShadow.h" -#import "CPTTextLayer.h" -#import "CPTTextStyle.h" -#import "CPTTheme.h" -#import "CPTTimeFormatter.h" -#import "CPTTradingRangePlot.h" -#import "CPTUtilities.h" -#import "CPTXYAxis.h" -#import "CPTXYAxisSet.h" -#import "CPTXYGraph.h" -#import "CPTXYPlotSpace.h" diff --git a/CorePlotHeaders/NSCoderExtensions.h b/CorePlotHeaders/NSCoderExtensions.h deleted file mode 100755 index 1c2b6b0..0000000 --- a/CorePlotHeaders/NSCoderExtensions.h +++ /dev/null @@ -1,37 +0,0 @@ -#import -#import - -/** @category NSCoder(CPTExtensions) - * @brief Core Plot extensions to NSCoder. - **/ -@interface NSCoder(CPTExtensions) - -/// @name Encoding Data -/// @{ --(void)encodeCGFloat:(CGFloat)number forKey:(NSString *)key; --(void)encodeCPTPoint:(CGPoint)point forKey:(NSString *)key; --(void)encodeCPTSize:(CGSize)size forKey:(NSString *)key; --(void)encodeCPTRect:(CGRect)rect forKey:(NSString *)key; - --(void)encodeCGColorSpace:(CGColorSpaceRef)colorSpace forKey:(NSString *)key; --(void)encodeCGPath:(CGPathRef)path forKey:(NSString *)key; --(void)encodeCGImage:(CGImageRef)image forKey:(NSString *)key; - --(void)encodeDecimal:(NSDecimal)number forKey:(NSString *)key; -/// @} - -/// @name Decoding Data -/// @{ --(CGFloat)decodeCGFloatForKey:(NSString *)key; --(CGPoint)decodeCPTPointForKey:(NSString *)key; --(CGSize)decodeCPTSizeForKey:(NSString *)key; --(CGRect)decodeCPTRectForKey:(NSString *)key; - --(CGColorSpaceRef)newCGColorSpaceDecodeForKey:(NSString *)key; --(CGPathRef)newCGPathDecodeForKey:(NSString *)key; --(CGImageRef)newCGImageDecodeForKey:(NSString *)key; - --(NSDecimal)decodeDecimalForKey:(NSString *)key; -/// @} - -@end diff --git a/CorePlotHeaders/NSDecimalNumberExtensions.h b/CorePlotHeaders/NSDecimalNumberExtensions.h deleted file mode 100755 index 36466d3..0000000 --- a/CorePlotHeaders/NSDecimalNumberExtensions.h +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import - -/** @category NSDecimalNumber(CPTExtensions) - * @brief Core Plot extensions to NSDecimalNumber. - **/ -@interface NSDecimalNumber(CPTExtensions) - -@end diff --git a/CorePlotHeaders/NSNumberExtensions.h b/CorePlotHeaders/NSNumberExtensions.h deleted file mode 100755 index 39cba81..0000000 --- a/CorePlotHeaders/NSNumberExtensions.h +++ /dev/null @@ -1,16 +0,0 @@ -#import -#import - -/** @category NSNumber(CPTExtensions) - * @brief Core Plot extensions to NSNumber. - **/ -@interface NSNumber(CPTExtensions) - -+(NSNumber *)numberWithCGFloat:(CGFloat)number; - --(CGFloat)cgFloatValue; --(id)initWithCGFloat:(CGFloat)number; - --(NSDecimalNumber *)decimalNumber; - -@end diff --git a/CorePlotHeaders/mainpage.h b/CorePlotHeaders/mainpage.h deleted file mode 100755 index 8640102..0000000 --- a/CorePlotHeaders/mainpage.h +++ /dev/null @@ -1,36 +0,0 @@ -/*! @mainpage Core Plot - * - * @section intro Introduction - * - * Core Plot is a plotting framework for Mac OS X and iOS. It provides 2D visualization of data, - * and is tightly integrated with Apple technologies like Core Animation, Core Data, and Cocoa Bindings. - * - * @section start Getting Started - * - * See the project wiki at - * http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications for information on how to use Core Plot - * in your own application. - * - * @section contribute Contributing to Core Plot - * - * Core Plot is an open source project. The project home page is http://code.google.com/p/core-plot/ on Google Code. - * See http://code.google.com/p/core-plot/source/checkout for instructions on how to download the source code. - * - * @subsection coding Coding Standards - * Everyone has a their own preferred coding style, and no one way can be considered right. Nonetheless, in a - * project like Core Plot, with many developers contributing, it is worthwhile defining a set of basic coding - * standards to prevent a mishmash of different styles which can become frustrating when - * navigating the code base. See the file "Coding Style.mdown" found in the documentation directory - * of the project source for specific guidelines. - * - * @subsection documentation Documentation Policy - * See http://code.google.com/p/core-plot/wiki/DocumentationPolicy for instructions on how to - * document your code so that your comments will appear in these documentation pages. - * - * @subsection testing Testing Policy - * Because Core Plot is intended to be used in scientific, financial, and other domains where correctness is paramount, - * unit testing is integrated into the framework. Good test coverage protects developers from introducing accidental - * regressions and frees them to experiment and refactor without fear of breaking things. See - * http://code.google.com/p/core-plot/wiki/CorePlotTesting for instructions on how to build unit tests - * for any new code you add to the project. - */ diff --git a/Podfile b/Podfile new file mode 100644 index 0000000..ba87338 --- /dev/null +++ b/Podfile @@ -0,0 +1,5 @@ +platform :ios, '6.0' + +pod 'AFNetworking' +pod 'SSZipArchive' +pod 'RaptureXML' diff --git a/Podfile.lock b/Podfile.lock new file mode 100644 index 0000000..b3b83ce --- /dev/null +++ b/Podfile.lock @@ -0,0 +1,35 @@ +PODS: + - AFNetworking (2.0.1): + - AFNetworking/NSURLConnection + - AFNetworking/NSURLSession + - AFNetworking/Reachability + - AFNetworking/Security + - AFNetworking/Serialization + - AFNetworking/UIKit + - AFNetworking/NSURLConnection (2.0.1): + - AFNetworking/Reachability + - AFNetworking/Security + - AFNetworking/Serialization + - AFNetworking/NSURLSession (2.0.1): + - AFNetworking/Reachability + - AFNetworking/Security + - AFNetworking/Serialization + - AFNetworking/Reachability (2.0.1) + - AFNetworking/Security (2.0.1) + - AFNetworking/Serialization (2.0.1) + - AFNetworking/UIKit (2.0.1): + - AFNetworking/NSURLConnection + - RaptureXML (1.0.1) + - SSZipArchive (0.3.1) + +DEPENDENCIES: + - AFNetworking + - RaptureXML + - SSZipArchive + +SPEC CHECKSUMS: + AFNetworking: a6f11ac4ac087303e6ff87adc1ba57b0dac20ef8 + RaptureXML: ef017fda62eb95c60300108366d1f0cd0c28cbd4 + SSZipArchive: 47d0589a15452311749a4eeecb97e12800d127de + +COCOAPODS: 0.25.0 diff --git a/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h b/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h new file mode 100644 index 0000000..6c3bb3f --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h @@ -0,0 +1,68 @@ +// AFHTTPRequestOperation.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import "AFURLConnectionOperation.h" +#import "AFURLResponseSerialization.h" + +/** + `AFHTTPRequestOperation` is a subclass of `AFURLConnectionOperation` for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request. + */ +@interface AFHTTPRequestOperation : AFURLConnectionOperation + +///------------------------------------------------ +/// @name Getting HTTP URL Connection Information +///------------------------------------------------ + +/** + The last HTTP response received by the operation's connection. + */ +@property (readonly, nonatomic, strong) NSHTTPURLResponse *response; + +/** + Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to a JSON serializer, which serializes data from responses with a `application/json` MIME type, and falls back to the raw data object. The serializer validates the status code to be in the `2XX` range, denoting success. If the response serializer generates an error in `-responseObjectForResponse:data:error:`, the `failure` callback of the session task or request operation will be executed; otherwise, the `success` callback will be executed. + + @warning `responseSerializer` must not be `nil`. Setting a response serializer will clear out any cached value + */ +@property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; + +/** + An object constructed by the `responseSerializer` from the response and response data. Returns `nil` unless the operation `isFinished`, has a `response`, and has `responseData` with non-zero content length. If an error occurs during serialization, `nil` will be returned, and the `error` property will be populated with the serialization error. + */ +@property (readonly, nonatomic, strong) id responseObject; + +///----------------------------------------------------------- +/// @name Setting Completion Block Success / Failure Callbacks +///----------------------------------------------------------- + +/** + Sets the `completionBlock` property with a block that executes either the specified success or failure block, depending on the state of the request on completion. If `error` returns a value, which can be caused by an unacceptable status code or content type, then `failure` is executed. Otherwise, `success` is executed. + + This method should be overridden in subclasses in order to specify the response object passed into the success block. + + @param success The block to be executed on the completion of a successful request. This block has no return value and takes two arguments: the receiver operation and the object constructed from the response data of the request. + @param failure The block to be executed on the completion of an unsuccessful request. This block has no return value and takes two arguments: the receiver operation and the error that occurred during the request. + */ +- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +@end diff --git a/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m b/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m new file mode 100644 index 0000000..ce4330c --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m @@ -0,0 +1,198 @@ +// AFHTTPRequestOperation.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFHTTPRequestOperation.h" + +static dispatch_queue_t http_request_operation_processing_queue() { + static dispatch_queue_t af_http_request_operation_processing_queue; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + af_http_request_operation_processing_queue = dispatch_queue_create("com.alamofire.networking.http-request.processing", DISPATCH_QUEUE_CONCURRENT); + }); + + return af_http_request_operation_processing_queue; +} + +static dispatch_group_t http_request_operation_completion_group() { + static dispatch_group_t af_http_request_operation_completion_group; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + af_http_request_operation_completion_group = dispatch_group_create(); + }); + + return af_http_request_operation_completion_group; +} + +#pragma mark - + +@interface AFHTTPRequestOperation () +@property (readwrite, nonatomic, strong) NSURLRequest *request; +@property (readwrite, nonatomic, strong) NSHTTPURLResponse *response; +@property (readwrite, nonatomic, strong) id responseObject; +@property (readwrite, nonatomic, strong) NSError *responseSerializationError; +@property (readwrite, nonatomic, strong) NSRecursiveLock *lock; +@end + +@implementation AFHTTPRequestOperation +@dynamic lock; + +- (instancetype)initWithRequest:(NSURLRequest *)urlRequest { + self = [super initWithRequest:urlRequest]; + if (!self) { + return nil; + } + + self.responseSerializer = [AFJSONResponseSerializer serializer]; + + return self; +} + +- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { + NSParameterAssert(responseSerializer); + + [self.lock lock]; + _responseSerializer = responseSerializer; + self.responseObject = nil; + self.responseSerializationError = nil; + [self.lock unlock]; +} + +- (id)responseObject { + [self.lock lock]; + if (!_responseObject && [self.responseData length] > 0 && [self isFinished] && !self.error) { + NSError *error = nil; + self.responseObject = [self.responseSerializer responseObjectForResponse:self.response data:self.responseData error:&error]; + if (error) { + self.responseSerializationError = error; + } + } + [self.lock unlock]; + + return _responseObject; +} + +- (NSError *)error { + if (_responseSerializationError) { + return _responseSerializationError; + } else { + return [super error]; + } +} + +#pragma mark - AFHTTPRequestOperation + +- (void)setCompletionBlockWithSuccess:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + // completionBlock is manually nilled out in AFURLConnectionOperation to break the retain cycle. +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-retain-cycles" +#pragma clang diagnostic ignored "-Wgnu" + self.completionBlock = ^{ + if (self.completionGroup) { + dispatch_group_enter(self.completionGroup); + } + + dispatch_async(http_request_operation_processing_queue(), ^{ + if (self.error) { + if (failure) { + dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); + }); + } + } else { + id responseObject = self.responseObject; + if (self.error) { + if (failure) { + dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ + failure(self, self.error); + }); + } + } else { + if (success) { + dispatch_group_async(self.completionGroup ?: http_request_operation_completion_group(), self.completionQueue ?: dispatch_get_main_queue(), ^{ + success(self, responseObject); + }); + } + } + } + + if (self.completionGroup) { + dispatch_group_leave(self.completionGroup); + } + }); + }; +#pragma clang diagnostic pop +} + +#pragma mark - AFURLRequestOperation + +- (void)pause { + int64_t offset = 0; + if ([self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey]) { + offset = [(NSNumber *)[self.outputStream propertyForKey:NSStreamFileCurrentOffsetKey] longLongValue]; + } else { + offset = [(NSData *)[self.outputStream propertyForKey:NSStreamDataWrittenToMemoryStreamKey] length]; + } + + NSMutableURLRequest *mutableURLRequest = [self.request mutableCopy]; + if ([self.response respondsToSelector:@selector(allHeaderFields)] && [[self.response allHeaderFields] valueForKey:@"ETag"]) { + [mutableURLRequest setValue:[[self.response allHeaderFields] valueForKey:@"ETag"] forHTTPHeaderField:@"If-Range"]; + } + [mutableURLRequest setValue:[NSString stringWithFormat:@"bytes=%llu-", offset] forHTTPHeaderField:@"Range"]; + self.request = mutableURLRequest; + + [super pause]; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (!self) { + return nil; + } + + self.responseSerializer = [aDecoder decodeObjectForKey:@"responseSerializer"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject:self.responseSerializer forKey:@"responseSerializer"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFHTTPRequestOperation *operation = [[[self class] allocWithZone:zone] initWithRequest:self.request]; + + operation.responseSerializer = [self.responseSerializer copyWithZone:zone]; + operation.completionQueue = self.completionQueue; + operation.completionGroup = self.completionGroup; + + return operation; +} + +@end diff --git a/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h b/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h new file mode 100644 index 0000000..1288a25 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h @@ -0,0 +1,294 @@ +// AFHTTPRequestOperationManager.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import +#import + +#if __IPHONE_OS_VERSION_MIN_REQUIRED +#import +#else +#import +#endif + +#import "AFHTTPRequestOperation.h" +#import "AFURLResponseSerialization.h" +#import "AFURLRequestSerialization.h" +#import "AFSecurityPolicy.h" +#import "AFNetworkReachabilityManager.h" + +/** + `AFHTTPRequestOperationManager` encapsulates the common patterns of communicating with an web application over HTTP, including request creation, response serialization, network reachability monitoring, and security, as well as request operation management. + + ## Subclassing Notes + + Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application. + + For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect. + + ## Methods to Override + + To change the behavior of all request operation construction for an `AFHTTPRequestOperationManager` subclass, override `HTTPRequestOperationWithRequest:success:failure`. + + ## Serialization + + Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to ``. + + Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `` + + ## URL Construction Using Relative Paths + + For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`. + + Below are a few examples of how `baseURL` and relative paths interact: + + NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; + [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo + [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz + [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo + [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo + [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/ + [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/ + + Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash. + + ## Network Reachability Monitoring + + Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details. + + ## NSCoding & NSCopying Caveats + + `AFHTTPRequestOperationManager` conforms to the `NSCoding` and `NSCopying` protocols, allowing operations to be archived to disk, and copied in memory, respectively. There are a few minor caveats to keep in mind, however: + + - Archives and copies of HTTP clients will be initialized with an empty operation queue. + - NSCoding cannot serialize / deserialize block properties, so an archive of an HTTP client will not include any reachability callback block that may be set. + */ +@interface AFHTTPRequestOperationManager : NSObject + +/** + The URL used to monitor reachability, and construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods. + */ +@property (readonly, nonatomic, strong) NSURL *baseURL; + +/** + Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies. + + @warning `requestSerializer` must not be `nil`. + */ +@property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; + +/** + Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to a JSON serializer, which serializes data from responses with a `application/json` MIME type, and falls back to the raw data object. The serializer validates the status code to be in the `2XX` range, denoting success. If the response serializer generates an error in `-responseObjectForResponse:data:error:`, the `failure` callback of the session task or request operation will be executed; otherwise, the `success` callback will be executed. + + @warning `responseSerializer` must not be `nil`. + */ +@property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; + +/** + The operation queue on which request operations are scheduled and run. + */ +@property (nonatomic, strong) NSOperationQueue *operationQueue; + +///------------------------------- +/// @name Managing URL Credentials +///------------------------------- + +/** + Whether request operations should consult the credential storage for authenticating the connection. `YES` by default. + + @see AFURLConnectionOperation -shouldUseCredentialStorage + */ +@property (nonatomic, assign) BOOL shouldUseCredentialStorage; + +/** + The credential used by request operations for authentication challenges. + + @see AFURLConnectionOperation -credential + */ +@property (nonatomic, strong) NSURLCredential *credential; + +///------------------------------- +/// @name Managing Security Policy +///------------------------------- + +/** + The security policy used by created request operations to evaluate server trust for secure connections. `AFHTTPRequestOperationManager` uses the `defaultPolicy` unless otherwise specified. + */ +@property (nonatomic, strong) AFSecurityPolicy *securityPolicy; + +///------------------------------------ +/// @name Managing Network Reachability +///------------------------------------ + +/** + The network reachability manager. `AFHTTPRequestOperationManager` uses the `sharedManager` by default. + */ +@property (readonly, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager; + +///--------------------------------------------- +/// @name Creating and Initializing HTTP Clients +///--------------------------------------------- + +/** + Creates and returns an `AFHTTPRequestOperationManager` object. + */ ++ (instancetype)manager; + +/** + Initializes an `AFHTTPRequestOperationManager` object with the specified base URL. + + This is the designated initializer. + + @param url The base URL for the HTTP client. + + @return The newly-initialized HTTP client + */ +- (instancetype)initWithBaseURL:(NSURL *)url; + +///--------------------------------------- +/// @name Managing HTTP Request Operations +///--------------------------------------- + +/** + Creates an `AFHTTPRequestOperation`, setting the operation's request serializer and response serializers to those of the HTTP client. + + @param request The request object to be loaded asynchronously during execution of the operation. + @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the created request operation and the object created from the response data of request. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes two arguments:, the created request operation and the `NSError` object describing the network or parsing error that occurred. + */ +- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)request + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +///--------------------------- +/// @name Making HTTP Requests +///--------------------------- + +/** + Creates and runs an `AFHTTPRequestOperation` with a `GET` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred. + + @see -HTTPRequestOperationWithRequest:success:failure: + */ +- (AFHTTPRequestOperation *)GET:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +/** + Creates and runs an `AFHTTPRequestOperation` with a `HEAD` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes a single arguments: the request operation. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred. + + @see -HTTPRequestOperationWithRequest:success:failure: + */ +- (AFHTTPRequestOperation *)HEAD:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +/** + Creates and runs an `AFHTTPRequestOperation` with a `POST` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred. + + @see -HTTPRequestOperationWithRequest:success:failure: + */ +- (AFHTTPRequestOperation *)POST:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +/** + Creates and runs an `AFHTTPRequestOperation` with a multipart `POST` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. + @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred. + + @see -HTTPRequestOperationWithRequest:success:failure: + */ +- (AFHTTPRequestOperation *)POST:(NSString *)URLString + parameters:(NSDictionary *)parameters + constructingBodyWithBlock:(void (^)(id formData))block + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +/** + Creates and runs an `AFHTTPRequestOperation` with a `PUT` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred. + + @see -HTTPRequestOperationWithRequest:success:failure: + */ +- (AFHTTPRequestOperation *)PUT:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +/** + Creates and runs an `AFHTTPRequestOperation` with a `PATCH` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred. + + @see -HTTPRequestOperationWithRequest:success:failure: + */ +- (AFHTTPRequestOperation *)PATCH:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +/** + Creates and runs an `AFHTTPRequestOperation` with a `DELETE` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the request operation finishes successfully. This block has no return value and takes two arguments: the request operation, and the response object created by the client response serializer. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the request operation and the error describing the network or parsing error that occurred. + + @see -HTTPRequestOperationWithRequest:success:failure: + */ +- (AFHTTPRequestOperation *)DELETE:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure; + +@end + diff --git a/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperationManager.m b/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperationManager.m new file mode 100644 index 0000000..a47d7c0 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperationManager.m @@ -0,0 +1,239 @@ +// AFHTTPRequestOperationManager.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import "AFHTTPRequestOperationManager.h" +#import "AFHTTPRequestOperation.h" + +#import +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +#import +#endif + +@interface AFHTTPRequestOperationManager () +@property (readwrite, nonatomic, strong) NSURL *baseURL; +@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager; +@end + +@implementation AFHTTPRequestOperationManager + ++ (instancetype)manager { + return [[AFHTTPRequestOperationManager alloc] initWithBaseURL:nil]; +} + +- (instancetype)initWithBaseURL:(NSURL *)url { + self = [super init]; + if (!self) { + return nil; + } + + // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected + if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) { + url = [url URLByAppendingPathComponent:@""]; + } + + self.baseURL = url; + + self.requestSerializer = [AFHTTPRequestSerializer serializer]; + self.responseSerializer = [AFJSONResponseSerializer serializer]; + + self.securityPolicy = [AFSecurityPolicy defaultPolicy]; + + if (self.baseURL.host) { + self.reachabilityManager = [AFNetworkReachabilityManager managerForDomain:self.baseURL.host]; + } else { + self.reachabilityManager = [AFNetworkReachabilityManager sharedManager]; + } + + [self.reachabilityManager startMonitoring]; + + self.operationQueue = [[NSOperationQueue alloc] init]; + + return self; +} + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.operationQueue]; +} + +#pragma mark - + +#ifdef _SYSTEMCONFIGURATION_H +#endif + +- (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { + NSParameterAssert(requestSerializer); + + _requestSerializer = requestSerializer; +} + +- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { + NSParameterAssert(responseSerializer); + + _responseSerializer = responseSerializer; +} + +#pragma mark - + +- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)request + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; + operation.responseSerializer = self.responseSerializer; + operation.shouldUseCredentialStorage = self.shouldUseCredentialStorage; + operation.credential = self.credential; + operation.securityPolicy = self.securityPolicy; + + [operation setCompletionBlockWithSuccess:success failure:failure]; + + return operation; +} + +#pragma mark - + +- (AFHTTPRequestOperation *)GET:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"GET" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; + [self.operationQueue addOperation:operation]; + + return operation; +} + +- (AFHTTPRequestOperation *)HEAD:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"HEAD" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *requestOperation, __unused id responseObject) { + if (success) { + success(requestOperation); + } + } failure:failure]; + [self.operationQueue addOperation:operation]; + + return operation; +} + +- (AFHTTPRequestOperation *)POST:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; + [self.operationQueue addOperation:operation]; + + return operation; +} + +- (AFHTTPRequestOperation *)POST:(NSString *)URLString + parameters:(NSDictionary *)parameters + constructingBodyWithBlock:(void (^)(id formData))block + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block]; + AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; + [self.operationQueue addOperation:operation]; + + return operation; +} + +- (AFHTTPRequestOperation *)PUT:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PUT" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; + [self.operationQueue addOperation:operation]; + + return operation; +} + +- (AFHTTPRequestOperation *)PATCH:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PATCH" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; + [self.operationQueue addOperation:operation]; + + return operation; +} + +- (AFHTTPRequestOperation *)DELETE:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success + failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"DELETE" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + AFHTTPRequestOperation *operation = [self HTTPRequestOperationWithRequest:request success:success failure:failure]; + [self.operationQueue addOperation:operation]; + + return operation; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + NSURL *baseURL = [aDecoder decodeObjectForKey:@"baseURL"]; + + self = [self initWithBaseURL:baseURL]; + if (!self) { + return nil; + } + + self.requestSerializer = [aDecoder decodeObjectForKey:@"requestSerializer"]; + self.responseSerializer = [aDecoder decodeObjectForKey:@"responseSerializer"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [aCoder encodeObject:self.baseURL forKey:@"baseURL"]; + [aCoder encodeObject:self.requestSerializer forKey:@"requestSerializer"]; + [aCoder encodeObject:self.responseSerializer forKey:@"responseSerializer"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFHTTPRequestOperationManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL]; + + HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone]; + HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone]; + + return HTTPClient; +} + +@end diff --git a/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h b/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h new file mode 100644 index 0000000..57bdc05 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.h @@ -0,0 +1,238 @@ +// AFHTTPSessionManager.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import +#import + +#if __IPHONE_OS_VERSION_MIN_REQUIRED +#import +#else +#import +#endif + +#import "AFURLSessionManager.h" + +/** + `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths; network reachability is also scoped to the host of the base URL as well. + + ## Subclassing Notes + + Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application. + + For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect. + + ## Methods to Override + + To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:completionHandler:`. + + ## Serialization + + Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to ``. + + Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `` + + ## URL Construction Using Relative Paths + + For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`. + + Below are a few examples of how `baseURL` and relative paths interact: + + NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; + [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo + [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz + [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo + [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo + [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/ + [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/ + + Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash. + */ + +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) + +@interface AFHTTPSessionManager : AFURLSessionManager + +/** + The URL used to monitor reachability, and construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods. + */ +@property (readonly, nonatomic, strong) NSURL *baseURL; + +/** + Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies. + + @warning `requestSerializer` must not be `nil`. + */ +@property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; + +/** + Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`. + + @warning `responseSerializer` must not be `nil`. + */ +@property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; + +///--------------------- +/// @name Initialization +///--------------------- + +/** + Creates and returns an `AFHTTPSessionManager` object. + */ ++ (instancetype)manager; + +/** + Initializes an `AFHTTPSessionManager` object with the specified base URL. + + @param url The base URL for the HTTP client. + + @return The newly-initialized HTTP client + */ +- (instancetype)initWithBaseURL:(NSURL *)url; + +/** + Initializes an `AFHTTPSessionManager` object with the specified base URL. + + This is the designated initializer. + + @param url The base URL for the HTTP client. + @param configuration The configuration used to create the managed session. + + @return The newly-initialized HTTP client + */ +- (instancetype)initWithBaseURL:(NSURL *)url + sessionConfiguration:(NSURLSessionConfiguration *)configuration; + +///--------------------------- +/// @name Making HTTP Requests +///--------------------------- + +/** + Creates and runs an `NSURLSessionDataTask` with a `GET` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (NSURLSessionDataTask *)GET:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `HEAD` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (NSURLSessionDataTask *)HEAD:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `POST` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(NSDictionary *)parameters + constructingBodyWithBlock:(void (^)(id formData))block + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `PUT` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (NSURLSessionDataTask *)PUT:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `PATCH` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (NSURLSessionDataTask *)PATCH:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `DELETE` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (NSURLSessionDataTask *)DELETE:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure; + +@end + +#endif diff --git a/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m b/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m new file mode 100644 index 0000000..3f1dedb --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFHTTPSessionManager.m @@ -0,0 +1,318 @@ +// AFHTTPSessionManager.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFHTTPSessionManager.h" + +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) + +#import "AFHTTPRequestOperation.h" + +#import +#import + +#ifdef _SYSTEMCONFIGURATION_H +#import +#import +#import +#import +#import +#endif + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +#import +#endif + +@interface AFHTTPSessionManager () +@property (readwrite, nonatomic, strong) NSURL *baseURL; +@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager; +@end + +@implementation AFHTTPSessionManager + ++ (instancetype)manager { + return [[AFHTTPSessionManager alloc] initWithBaseURL:nil]; +} + +- (instancetype)initWithBaseURL:(NSURL *)url { + return [self initWithBaseURL:url sessionConfiguration:nil]; +} + +- (instancetype)initWithBaseURL:(NSURL *)url + sessionConfiguration:(NSURLSessionConfiguration *)configuration +{ + self = [super initWithSessionConfiguration:configuration]; + if (!self) { + return nil; + } + + // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected + if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) { + url = [url URLByAppendingPathComponent:@""]; + } + + self.baseURL = url; + + self.requestSerializer = [AFHTTPRequestSerializer serializer]; + self.responseSerializer = [AFJSONResponseSerializer serializer]; + + self.securityPolicy = [AFSecurityPolicy defaultPolicy]; + + if (self.baseURL.host) { + self.reachabilityManager = [AFNetworkReachabilityManager managerForDomain:self.baseURL.host]; + } else { + self.reachabilityManager = [AFNetworkReachabilityManager sharedManager]; + } + + return self; +} + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue]; +} + +#pragma mark - + +#ifdef _SYSTEMCONFIGURATION_H +#endif + +- (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { + NSParameterAssert(requestSerializer); + + _requestSerializer = requestSerializer; +} + +- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { + NSParameterAssert(responseSerializer); + + [super setResponseSerializer:responseSerializer]; +} + +#pragma mark - + +- (NSURLSessionDataTask *)GET:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"GET" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + + __block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { + if (error) { + if (failure) { + failure(task, error); + } + } else { + if (success) { + success(task, responseObject); + } + } + }]; + + [task resume]; + + return task; +} + +- (NSURLSessionDataTask *)HEAD:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"HEAD" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + + __block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id __unused responseObject, NSError *error) { + if (error) { + if (failure) { + failure(task, error); + } + } else { + if (success) { + success(task); + } + } + }]; + + [task resume]; + + return task; +} + +- (NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + + __block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { + if (error) { + if (failure) { + failure(task, error); + } + } else { + if (success) { + success(task, responseObject); + } + } + }]; + + [task resume]; + + return task; +} + +- (NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(NSDictionary *)parameters + constructingBodyWithBlock:(void (^)(id formData))block + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block]; + + __block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { + if (error) { + if (failure) { + failure(task, error); + } + } else { + if (success) { + success(task, responseObject); + } + } + }]; + + [task resume]; + + return task; +} + +- (NSURLSessionDataTask *)PUT:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PUT" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + + __block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { + if (error) { + if (failure) { + failure(task, error); + } + } else { + if (success) { + success(task, responseObject); + } + } + }]; + + [task resume]; + + return task; +} + +- (NSURLSessionDataTask *)PATCH:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"PATCH" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + + __block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { + if (error) { + if (failure) { + failure(task, error); + } + } else { + if (success) { + success(task, responseObject); + } + } + }]; + + [task resume]; + + return task; +} + +- (NSURLSessionDataTask *)DELETE:(NSString *)URLString + parameters:(NSDictionary *)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"DELETE" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters]; + + __block NSURLSessionDataTask *task = [self dataTaskWithRequest:request completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { + if (error) { + if (failure) { + failure(task, error); + } + } else { + if (success) { + success(task, responseObject); + } + } + }]; + + [task resume]; + + return task; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + NSURL *baseURL = [aDecoder decodeObjectForKey:@"baseURL"]; + NSURLSessionConfiguration *configuration = [aDecoder decodeObjectForKey:@"sessionConfiguration"]; + + self = [self initWithBaseURL:baseURL sessionConfiguration:configuration]; + if (!self) { + return nil; + } + + self.requestSerializer = [aDecoder decodeObjectForKey:@"requestSerializer"]; + self.responseSerializer = [aDecoder decodeObjectForKey:@"responseSerializer"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject:self.baseURL forKey:@"baseURL"]; + [aCoder encodeObject:self.requestSerializer forKey:@"requestSerializer"]; + [aCoder encodeObject:self.responseSerializer forKey:@"responseSerializer"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration]; + + HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone]; + HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone]; + + return HTTPClient; +} + +@end + +#endif diff --git a/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h b/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h new file mode 100644 index 0000000..c17e1a3 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h @@ -0,0 +1,195 @@ +// AFNetworkReachabilityManager.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import + +#import +#import +#import +#import +#import + +typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) { + AFNetworkReachabilityStatusUnknown = -1, + AFNetworkReachabilityStatusNotReachable = 0, + AFNetworkReachabilityStatusReachableViaWWAN = 1, + AFNetworkReachabilityStatusReachableViaWiFi = 2, +}; + +/** + `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces. + + See Apple's Reachability Sample Code (https://developer.apple.com/library/ios/samplecode/reachability/) + */ +@interface AFNetworkReachabilityManager : NSObject + +/** + The current network reachability status. + */ +@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; + +/** + Whether or not the network is currently reachable. + */ +@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable; + +/** + Whether or not the network is currently reachable via WWAN. + */ +@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN; + +/** + Whether or not the network is currently reachable via WiFi. + */ +@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi; + +///--------------------- +/// @name Initialization +///--------------------- + +/** + Returns the shared network reachability manager. + */ ++ (instancetype)sharedManager; + +/** + Creates and returns a network reachability manager for the specified domain. + + @param domain The domain used to evaluate network reachability. + + @return An initialized network reachability manager, actively monitoring the specified domain. + */ ++ (instancetype)managerForDomain:(NSString *)domain; + +/** + Creates and returns a network reachability manager for the socket address. + + @param address The socket address used to evaluate network reachability. + + @return An initialized network reachability manager, actively monitoring the specified socket address. + */ ++ (instancetype)managerForAddress:(const struct sockaddr_in *)address; + +/** + Initializes an instance of a network reachability manager from the specified reachability object. + + @param reachability The reachability object to monitor. + + @return An initialized network reachability manager, actively monitoring the specified reachability. + */ +- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability; + +///-------------------------------------------------- +/// @name Starting & Stopping Reachability Monitoring +///-------------------------------------------------- + +/** + Starts monitoring for changes in network reachability status. + */ +- (void)startMonitoring; + +/** + Stops monitoring for changes in network reachability status. + */ +- (void)stopMonitoring; + +///------------------------------------------------- +/// @name Getting Localized Reachability Description +///------------------------------------------------- + +/** + Returns a localized string representation of the current network reachability status. + */ +- (NSString *)localizedNetworkReachabilityStatusString; + +///--------------------------------------------------- +/// @name Setting Network Reachability Change Callback +///--------------------------------------------------- + +/** + Sets a callback to be executed when the network availability of the `baseURL` host changes. + + @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`. + */ +- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block; + +@end + +///---------------- +/// @name Constants +///---------------- + +/** + ## Network Reachability + + The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses. + + enum { + AFNetworkReachabilityStatusUnknown, + AFNetworkReachabilityStatusNotReachable, + AFNetworkReachabilityStatusReachableViaWWAN, + AFNetworkReachabilityStatusReachableViaWiFi, + } + + `AFNetworkReachabilityStatusUnknown` + The `baseURL` host reachability is not known. + + `AFNetworkReachabilityStatusNotReachable` + The `baseURL` host cannot be reached. + + `AFNetworkReachabilityStatusReachableViaWWAN` + The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS. + + `AFNetworkReachabilityStatusReachableViaWiFi` + The `baseURL` host can be reached via a Wi-Fi connection. + + ### Keys for Notification UserInfo Dictionary + + Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification. + + `AFNetworkingReachabilityNotificationStatusItem` + A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification. + The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status. + */ + +///-------------------- +/// @name Notifications +///-------------------- + +/** + Posted when network reachability changes. + This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability. + + @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). + */ +extern NSString * const AFNetworkingReachabilityDidChangeNotification; +extern NSString * const AFNetworkingReachabilityNotificationStatusItem; + +///-------------------- +/// @name Functions +///-------------------- + +/** + Returns a localized string representation of an `AFNetworkReachabilityStatus` value. + */ +extern NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status); diff --git a/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m b/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m new file mode 100644 index 0000000..fcd83bb --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m @@ -0,0 +1,222 @@ +// AFNetworkReachabilityManager.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFNetworkReachabilityManager.h" + +NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change"; +NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem"; + +typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status); + +NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) { + switch (status) { + case AFNetworkReachabilityStatusNotReachable: + return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil); + case AFNetworkReachabilityStatusReachableViaWWAN: + return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil); + case AFNetworkReachabilityStatusReachableViaWiFi: + return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil); + case AFNetworkReachabilityStatusUnknown: + default: + return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil); + } +} + +static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) { + BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0); + BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0); + BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)); + BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0); + BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction)); + + AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown; + if (isNetworkReachable == NO) { + status = AFNetworkReachabilityStatusNotReachable; + } +#if TARGET_OS_IPHONE + else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { + status = AFNetworkReachabilityStatusReachableViaWWAN; + } +#endif + else { + status = AFNetworkReachabilityStatusReachableViaWiFi; + } + + return status; +} + +static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) { + AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); + AFNetworkReachabilityStatusBlock block = (__bridge AFNetworkReachabilityStatusBlock)info; + if (block) { + block(status); + } + + + dispatch_async(dispatch_get_main_queue(), ^{ + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:@{ AFNetworkingReachabilityNotificationStatusItem: @(status) }]; + }); +} + +static const void * AFNetworkReachabilityRetainCallback(const void *info) { + return Block_copy(info); +} + +static void AFNetworkReachabilityReleaseCallback(const void *info) { + if (info) { + Block_release(info); + } +} + +@interface AFNetworkReachabilityManager () +@property (readwrite, nonatomic, assign) SCNetworkReachabilityRef networkReachability; +@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; +@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock; +@end + +@implementation AFNetworkReachabilityManager + ++ (instancetype)sharedManager { + static AFNetworkReachabilityManager *_sharedManager = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + struct sockaddr_in address; + bzero(&address, sizeof(address)); + address.sin_len = sizeof(address); + address.sin_family = AF_INET; + + _sharedManager = [self managerForAddress:&address]; + }); + + return _sharedManager; +} + ++ (instancetype)managerForDomain:(NSString *)domain { + SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]); + + return [[self alloc] initWithReachability:reachability]; +} + ++ (instancetype)managerForAddress:(const struct sockaddr_in *)address { + SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address); + + return [[self alloc] initWithReachability:reachability]; +} + +- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability { + self = [super init]; + if (!self) { + return nil; + } + + self.networkReachability = reachability; + + self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown; + + return self; +} + +- (void)dealloc { + [self stopMonitoring]; + + CFRelease(_networkReachability); + _networkReachability = NULL; +} + +#pragma mark - + +- (BOOL)isReachable { + return [self isReachableViaWWAN] || [self isReachableViaWiFi]; +} + +- (BOOL)isReachableViaWWAN { + return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN; +} + +- (BOOL)isReachableViaWiFi { + return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi; +} + +#pragma mark - + +- (void)startMonitoring { + [self stopMonitoring]; + + if (!self.networkReachability) { + return; + } + + __weak __typeof(self)weakSelf = self; + AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + + strongSelf.networkReachabilityStatus = status; + if (strongSelf.networkReachabilityStatusBlock) { + strongSelf.networkReachabilityStatusBlock(status); + } + }; + + SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; + SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context); + + SCNetworkReachabilityFlags flags; + SCNetworkReachabilityGetFlags(self.networkReachability, &flags); + dispatch_async(dispatch_get_main_queue(), ^{ + AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); + callback(status); + }); + + SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); +} + +- (void)stopMonitoring { + if (!self.networkReachability) { + return; + } + + SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); +} + +#pragma mark - + +- (NSString *)localizedNetworkReachabilityStatusString { + return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus); +} + +#pragma mark - + +- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block { + self.networkReachabilityStatusBlock = block; +} + +#pragma mark - NSKeyValueObserving + ++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { + if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) { + return [NSSet setWithObject:@"networkReachabilityStatus"]; + } + + return [super keyPathsForValuesAffectingValueForKey:key]; +} + +@end diff --git a/AFNetworking/AFNetworking.h b/Pods/AFNetworking/AFNetworking/AFNetworking.h old mode 100755 new mode 100644 similarity index 70% rename from AFNetworking/AFNetworking.h rename to Pods/AFNetworking/AFNetworking/AFNetworking.h index b8f840b..68273da --- a/AFNetworking/AFNetworking.h +++ b/Pods/AFNetworking/AFNetworking/AFNetworking.h @@ -1,6 +1,6 @@ // AFNetworking.h // -// Copyright (c) 2011 Gowalla (http://gowalla.com/) +// Copyright (c) 2013 AFNetworking (http://afnetworking.com/) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal @@ -26,18 +26,19 @@ #ifndef _AFNETWORKING_ #define _AFNETWORKING_ - #import "AFURLConnectionOperation.h" + #import "AFURLRequestSerialization.h" + #import "AFURLResponseSerialization.h" + #import "AFSecurityPolicy.h" + #import "AFNetworkReachabilityManager.h" + #import "AFURLConnectionOperation.h" #import "AFHTTPRequestOperation.h" - #import "AFJSONRequestOperation.h" - #import "AFXMLRequestOperation.h" - #import "AFPropertyListRequestOperation.h" - #import "AFHTTPClient.h" + #import "AFHTTPRequestOperationManager.h" - #import "AFImageRequestOperation.h" +#if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \ + ( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) ) + #import "AFURLSessionManager.h" + #import "AFHTTPSessionManager.h" +#endif - #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - #import "AFNetworkActivityIndicatorManager.h" - #import "UIImageView+AFNetworking.h" - #endif #endif /* _AFNETWORKING_ */ diff --git a/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h b/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h new file mode 100644 index 0000000..d36bc02 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.h @@ -0,0 +1,118 @@ +// AFSecurity.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import + +typedef NS_ENUM(NSUInteger, AFSSLPinningMode) { + AFSSLPinningModeNone, + AFSSLPinningModePublicKey, + AFSSLPinningModeCertificate, +}; + +/** + `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. + + Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. + */ +@interface AFSecurityPolicy : NSObject + +/** + The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`. + */ +@property (nonatomic, assign) AFSSLPinningMode SSLPinningMode; + +/** + The certificates used to evaluate server trust according to the SSL pinning mode. By default, this property is set to any (`.cer`) certificates included in the app bundle. + */ +@property (nonatomic, strong) NSArray *pinnedCertificates; + +/** + Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. + */ +@property (nonatomic, assign) BOOL allowInvalidCertificates; + +///----------------------------------------- +/// @name Getting Specific Security Policies +///----------------------------------------- + +/** + Returns the shared default security policy, which does not accept invalid certificates, and does not validate against pinned certificates or public keys. + + @return The default security policy. + */ ++ (instancetype)defaultPolicy; + +///--------------------- +/// @name Initialization +///--------------------- + +/** + Creates and returns a security policy with the specified pinning mode. + + @param pinningMode The SSL pinning mode. + + @return A new security policy. + */ ++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; + +///------------------------------ +/// @name Evaluating Server Trust +///------------------------------ + +/** + Whether or not the specified server trust should be accepted, based on the security policy. + + This method should be used when responding to an authentication challenge from a server. + + @param serverTrust The X.509 certificate trust of the server. + + @return Whether or not to trust the server. + */ +- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust; + +@end + +///---------------- +/// @name Constants +///---------------- + +/** + ## SSL Pinning Modes + + The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes. + + enum { + AFSSLPinningModeNone, + AFSSLPinningModePublicKey, + AFSSLPinningModeCertificate, + } + + `AFSSLPinningModeNone` + Do not validate servers against pinned certificates. + + `AFSSLPinningModePublicKey` + Validate host certificates against public keys of pinned certificates. + + `AFSSLPinningModeCertificate` + Validate host certificates against pinned certificates. +*/ diff --git a/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m b/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m new file mode 100644 index 0000000..14d23b9 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFSecurityPolicy.m @@ -0,0 +1,235 @@ +// AFSecurity.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFSecurityPolicy.h" + +#if !defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +static NSData * AFSecKeyGetData(SecKeyRef key) { + CFDataRef data = NULL; + +#if defined(NS_BLOCK_ASSERTIONS) + SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data); +#else + OSStatus status = SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data); + NSCAssert(status == errSecSuccess, @"SecItemExport error: %ld", (long int)status); +#endif + + NSCParameterAssert(data); + + return (__bridge_transfer NSData *)data; +} +#endif + +static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) { +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + return [(__bridge id)key1 isEqual:(__bridge id)key2]; +#else + return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)]; +#endif +} + +static id AFPublicKeyForCertificate(NSData *certificate) { + SecCertificateRef allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate); + NSCParameterAssert(allowedCertificate); + + SecCertificateRef allowedCertificates[] = {allowedCertificate}; + CFArrayRef tempCertificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL); + + SecPolicyRef policy = SecPolicyCreateBasicX509(); + SecTrustRef allowedTrust = NULL; +#if defined(NS_BLOCK_ASSERTIONS) + SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust); +#else + OSStatus status = SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust); + NSCAssert(status == errSecSuccess, @"SecTrustCreateWithCertificates error: %ld", (long int)status); +#endif + + SecTrustResultType result = 0; + +#if defined(NS_BLOCK_ASSERTIONS) + SecTrustEvaluate(allowedTrust, &result); +#else + status = SecTrustEvaluate(allowedTrust, &result); + NSCAssert(status == errSecSuccess, @"SecTrustEvaluate error: %ld", (long int)status); +#endif + + SecKeyRef allowedPublicKey = SecTrustCopyPublicKey(allowedTrust); + NSCParameterAssert(allowedPublicKey); + + CFRelease(allowedTrust); + CFRelease(policy); + CFRelease(tempCertificates); + CFRelease(allowedCertificate); + + return (__bridge_transfer id)allowedPublicKey; +} + +static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) { + SecTrustResultType result = 0; + +#if defined(NS_BLOCK_ASSERTIONS) + SecTrustEvaluate(serverTrust, &result); +#else + OSStatus status = SecTrustEvaluate(serverTrust, &result); + NSCAssert(status == errSecSuccess, @"SecTrustEvaluate error: %ld", (long int)status); +#endif + + return (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed); +} + +static NSArray * AFCertificateTrustChainForServerTrust(SecTrustRef serverTrust) { + CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); + NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; + + for (CFIndex i = 0; i < certificateCount; i++) { + SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); + [trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]; + } + + return [NSArray arrayWithArray:trustChain]; +} + +static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) { + SecPolicyRef policy = SecPolicyCreateBasicX509(); + CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); + NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; + for (CFIndex i = 0; i < certificateCount; i++) { + SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); + + SecCertificateRef someCertificates[] = {certificate}; + CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL); + + SecTrustRef trust = NULL; + + OSStatus status = SecTrustCreateWithCertificates(certificates, policy, &trust); + NSCAssert(status == errSecSuccess, @"SecTrustCreateWithCertificates error: %ld", (long int)status); + + SecTrustResultType result; + status = SecTrustEvaluate(trust, &result); + NSCAssert(status == errSecSuccess, @"SecTrustEvaluate error: %ld", (long int)status); + + [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)]; + + CFRelease(trust); + CFRelease(certificates); + } + CFRelease(policy); + + return [NSArray arrayWithArray:trustChain]; +} + +#pragma mark - + +@interface AFSecurityPolicy() +@property (readwrite, nonatomic, strong) NSArray *pinnedPublicKeys; +@end + +@implementation AFSecurityPolicy + ++ (NSArray *)defaultPinnedCertificates { + static NSArray *_defaultPinnedCertificates = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"."]; + + NSMutableArray *certificates = [NSMutableArray arrayWithCapacity:[paths count]]; + for (NSString *path in paths) { + NSData *certificateData = [NSData dataWithContentsOfFile:path]; + [certificates addObject:certificateData]; + } + + _defaultPinnedCertificates = [[NSArray alloc] initWithArray:certificates]; + }); + + return _defaultPinnedCertificates; +} + ++ (instancetype)defaultPolicy { + AFSecurityPolicy *securityPolicy = [[self alloc] init]; + securityPolicy.SSLPinningMode = AFSSLPinningModeNone; + + return securityPolicy; +} + ++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode { + AFSecurityPolicy *securityPolicy = [[self alloc] init]; + securityPolicy.SSLPinningMode = pinningMode; + [securityPolicy setPinnedCertificates:[self defaultPinnedCertificates]]; + + return securityPolicy; +} + +#pragma mark - + +- (void)setPinnedCertificates:(NSArray *)pinnedCertificates { + _pinnedCertificates = pinnedCertificates; + + if (self.pinnedCertificates) { + NSMutableArray *mutablePinnedPublicKeys = [NSMutableArray arrayWithCapacity:[self.pinnedCertificates count]]; + for (NSData *certificate in self.pinnedCertificates) { + [mutablePinnedPublicKeys addObject:AFPublicKeyForCertificate(certificate)]; + } + self.pinnedPublicKeys = [NSArray arrayWithArray:mutablePinnedPublicKeys]; + } else { + self.pinnedPublicKeys = nil; + } +} + +#pragma mark - + +- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust { + switch (self.SSLPinningMode) { + case AFSSLPinningModeNone: + return (self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust)); + case AFSSLPinningModeCertificate: { + for (NSData *trustChainCertificate in AFCertificateTrustChainForServerTrust(serverTrust)) { + if ([self.pinnedCertificates containsObject:trustChainCertificate]) { + return YES; + } + } + } + break; + case AFSSLPinningModePublicKey: { + for (id trustChainPublicKey in AFPublicKeyTrustChainForServerTrust(serverTrust)) { + for (id pinnedPublicKey in self.pinnedPublicKeys) { + if (AFSecKeyIsEqualToKey((__bridge SecKeyRef)trustChainPublicKey, (__bridge SecKeyRef)pinnedPublicKey)) { + return YES; + } + } + } + } + break; + default: + break; + } + + return NO; +} + +#pragma mark - NSKeyValueObserving + ++ (NSSet *)keyPathsForValuesAffectingPinnedPublicKeys { + return [NSSet setWithObject:@"pinnedCertificates"]; +} + +@end diff --git a/AFNetworking/AFURLConnectionOperation.h b/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h old mode 100755 new mode 100644 similarity index 73% rename from AFNetworking/AFURLConnectionOperation.h rename to Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h index 2afec5e..e34d746 --- a/AFNetworking/AFURLConnectionOperation.h +++ b/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h @@ -1,17 +1,17 @@ // AFURLConnectionOperation.h // -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -23,58 +23,63 @@ #import #import +#import "AFSecurityPolicy.h" /** `AFURLConnectionOperation` is a subclass of `NSOperation` that implements `NSURLConnection` delegate methods. - + ## Subclassing Notes - + This is the base class of all network request operations. You may wish to create your own subclass in order to implement additional `NSURLConnection` delegate methods (see "`NSURLConnection` Delegate Methods" below), or to provide additional properties and/or class constructors. - + If you are creating a subclass that communicates over the HTTP or HTTPS protocols, you may want to consider subclassing `AFHTTPRequestOperation` instead, as it supports specifying acceptable content types or status codes. - + ## NSURLConnection Delegate Methods - + `AFURLConnectionOperation` implements the following `NSURLConnection` delegate methods: - + - `connection:didReceiveResponse:` - `connection:didReceiveData:` - `connectionDidFinishLoading:` - `connection:didFailWithError:` - `connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:` - `connection:willCacheResponse:` - - `connection:canAuthenticateAgainstProtectionSpace:` - - `connection:didReceiveAuthenticationChallenge:` - `connectionShouldUseCredentialStorage:` - - `connection:needNewBodyStream:` - + - `connection:needNewBodyStream:` + - `connection:willSendRequestForAuthenticationChallenge:` + If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first. - - ## Class Constructors - - Class constructors, or methods that return an unowned instance, are the preferred way for subclasses to encapsulate any particular logic for handling the setup or parsing of response data. For instance, `AFJSONRequestOperation` provides `JSONRequestOperationWithRequest:success:failure:`, which takes block arguments, whose parameter on for a successful request is the JSON object initialized from the `response data`. - + ## Callbacks and Completion Blocks - + The built-in `completionBlock` provided by `NSOperation` allows for custom behavior to be executed after the request finishes. It is a common pattern for class constructors in subclasses to take callback block parameters, and execute them conditionally in the body of its `completionBlock`. Make sure to handle cancelled operations appropriately when setting a `completionBlock` (i.e. returning early before parsing response data). See the implementation of any of the `AFHTTPRequestOperation` subclasses for an example of this. - + Subclasses are strongly discouraged from overriding `setCompletionBlock:`, as `AFURLConnectionOperation`'s implementation includes a workaround to mitigate retain cycles, and what Apple rather ominously refers to as ["The Deallocation Problem"](http://developer.apple.com/library/ios/#technotes/tn2109/). - ## NSCoding & NSCopying Conformance + ## SSL Pinning - `AFURLConnectionOperation` conforms to the `NSCoding` and `NSCopying` protocols, allowing operations to be archived to disk, and copied in memory, respectively. However, because of the intrinsic limitations of capturing the exact state of an operation at a particular moment, there are some important caveats to keep in mind: + Relying on the CA trust model to validate SSL certificates exposes your app to security vulnerabilities, such as man-in-the-middle attacks. For applications that connect to known servers, SSL certificate pinning provides an increased level of security, by checking server certificate validity against those specified in the app bundle. + SSL with certificate pinning is strongly recommended for any application that transmits sensitive information to an external webservice. + + Connections will be validated on all matching certificates with a `.cer` extension in the bundle root. + + ## NSCoding & NSCopying Conformance + + `AFURLConnectionOperation` conforms to the `NSCoding` and `NSCopying` protocols, allowing operations to be archived to disk, and copied in memory, respectively. However, because of the intrinsic limitations of capturing the exact state of an operation at a particular moment, there are some important caveats to keep in mind: + ### NSCoding Caveats - + - Encoded operations do not include any block or stream properties. Be sure to set `completionBlock`, `outputStream`, and any callback blocks as necessary when using `-initWithCoder:` or `NSKeyedUnarchiver`. - Operations are paused on `encodeWithCoder:`. If the operation was encoded while paused or still executing, its archived state will return `YES` for `isReady`. Otherwise, the state of an operation when encoding will remain unchanged. - + ### NSCopying Caveats - + - `-copy` and `-copyWithZone:` return a new operation with the `NSURLRequest` of the original. So rather than an exact copy of the operation at that particular instant, the copying mechanism returns a completely new instance, which can be useful for retrying operations. - A copy of an operation will not include the `outputStream` of the original. - - Operation copies do not include `completionBlock`. `completionBlock` often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ operation when copied. + - Operation copies do not include `completionBlock`, as it often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ operation when copied. */ + @interface AFURLConnectionOperation : NSOperation ///------------------------------- @@ -110,7 +115,7 @@ ///---------------------------- /** - The data received during the request. + The data received during the request. */ @property (readonly, nonatomic, strong) NSData *responseData; @@ -121,48 +126,70 @@ /** The string encoding of the response. - - @discussion If the response does not specify a valid string encoding, `responseStringEncoding` will return `NSUTF8StringEncoding`. + + If the response does not specify a valid string encoding, `responseStringEncoding` will return `NSUTF8StringEncoding`. */ @property (readonly, nonatomic, assign) NSStringEncoding responseStringEncoding; - ///------------------------------- /// @name Managing URL Credentials ///------------------------------- /** Whether the URL connection should consult the credential storage for authenticating the connection. `YES` by default. - - @discussion This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`. + + This is the value that is returned in the `NSURLConnectionDelegate` method `-connectionShouldUseCredentialStorage:`. */ @property (nonatomic, assign) BOOL shouldUseCredentialStorage; /** The credential used for authentication challenges in `-connection:didReceiveAuthenticationChallenge:`. - - @discussion This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. + + This will be overridden by any shared credentials that exist for the username or password of the request URL, if present. */ @property (nonatomic, strong) NSURLCredential *credential; +///------------------------------- +/// @name Managing Security Policy +///------------------------------- + +/** + The security policy used to evaluate server trust for secure connections. + */ +@property (nonatomic, strong) AFSecurityPolicy *securityPolicy; + ///------------------------ /// @name Accessing Streams ///------------------------ /** - The input stream used to read data to be sent during the request. - - @discussion This property acts as a proxy to the `HTTPBodyStream` property of `request`. + The input stream used to read data to be sent during the request. + + This property acts as a proxy to the `HTTPBodyStream` property of `request`. */ @property (nonatomic, strong) NSInputStream *inputStream; /** The output stream that is used to write data received until the request is finished. - - @discussion By default, data is accumulated into a buffer that is stored into `responseData` upon completion of the request. When `outputStream` is set, the data will not be accumulated into an internal buffer, and as a result, the `responseData` property of the completed request will be `nil`. The output stream will be scheduled in the network thread runloop upon being set. + + By default, data is accumulated into a buffer that is stored into `responseData` upon completion of the request. When `outputStream` is set, the data will not be accumulated into an internal buffer, and as a result, the `responseData` property of the completed request will be `nil`. The output stream will be scheduled in the network thread runloop upon being set. */ @property (nonatomic, strong) NSOutputStream *outputStream; +///--------------------------------- +/// @name Managing Callback Queues +///--------------------------------- + +/** + The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used. + */ +@property (nonatomic, strong) dispatch_queue_t completionQueue; + +/** + The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used. + */ +@property (nonatomic, strong) dispatch_group_t completionGroup; + ///--------------------------------------------- /// @name Managing Request Operation Information ///--------------------------------------------- @@ -179,11 +206,11 @@ /** Initializes and returns a newly allocated operation object with a url connection configured with the specified url request. - @param urlRequest The request object to be used by the operation connection. + This is the designated initializer. - @discussion This is the designated initializer. + @param urlRequest The request object to be used by the operation connection. */ -- (id)initWithRequest:(NSURLRequest *)urlRequest; +- (instancetype)initWithRequest:(NSURLRequest *)urlRequest; ///---------------------------------- /// @name Pausing / Resuming Requests @@ -191,22 +218,22 @@ /** Pauses the execution of the request operation. - - @discussion A paused operation returns `NO` for `-isReady`, `-isExecuting`, and `-isFinished`. As such, it will remain in an `NSOperationQueue` until it is either cancelled or resumed. Pausing a finished, cancelled, or paused operation has no effect. + + A paused operation returns `NO` for `-isReady`, `-isExecuting`, and `-isFinished`. As such, it will remain in an `NSOperationQueue` until it is either cancelled or resumed. Pausing a finished, cancelled, or paused operation has no effect. */ - (void)pause; /** Whether the request operation is currently paused. - + @return `YES` if the operation is currently paused, otherwise `NO`. */ - (BOOL)isPaused; /** Resumes the execution of the paused request operation. - - @discussion Pause/Resume behavior varies depending on the underlying implementation for the operation class. In its base implementation, resuming a paused requests restarts the original request. However, since HTTP defines a specification for how to request a specific content range, `AFHTTPRequestOperation` will resume downloading the request from where it left off, instead of restarting the original request. + + Pause/Resume behavior varies depending on the underlying implementation for the operation class. In its base implementation, resuming a paused requests restarts the original request. However, since HTTP defines a specification for how to request a specific content range, `AFHTTPRequestOperation` will resume downloading the request from where it left off, instead of restarting the original request. */ - (void)resume; @@ -216,8 +243,8 @@ /** Specifies that the operation should continue execution after the app has entered the background, and the expiration handler for that background task. - - @param handler A handler to be called shortly before the application’s remaining background time reaches 0. The handler is wrapped in a block that cancels the operation, and cleans up and marks the end of execution, unlike the `handler` parameter in `UIApplication -beginBackgroundTaskWithExpirationHandler:`, which expects this to be done in the handler itself. The handler is called synchronously on the main thread, thus blocking the application’s suspension momentarily while the application is notified. + + @param handler A handler to be called shortly before the application’s remaining background time reaches 0. The handler is wrapped in a block that cancels the operation, and cleans up and marks the end of execution, unlike the `handler` parameter in `UIApplication -beginBackgroundTaskWithExpirationHandler:`, which expects this to be done in the handler itself. The handler is called synchronously on the main thread, thus blocking the application’s suspension momentarily while the application is notified. */ #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler; @@ -229,14 +256,14 @@ /** Sets a callback to be called when an undetermined number of bytes have been uploaded to the server. - + @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes three arguments: the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread. */ - (void)setUploadProgressBlock:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))block; /** Sets a callback to be called when an undetermined number of bytes have been downloaded from the server. - + @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. */ - (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead))block; @@ -246,26 +273,17 @@ ///------------------------------------------------- /** - Sets a block to be executed to determine whether the connection should be able to respond to a protection space's form of authentication, as handled by the `NSURLConnectionDelegate` method `connection:canAuthenticateAgainstProtectionSpace:`. + Sets a block to be executed when the connection will authenticate a challenge in order to download its request, as handled by the `NSURLConnectionDelegate` method `connection:willSendRequestForAuthenticationChallenge:`. - @param block A block object to be executed to determine whether the connection should be able to respond to a protection space's form of authentication. The block has a `BOOL` return type and takes two arguments: the URL connection object, and the protection space to authenticate against. + @param block A block object to be executed when the connection will authenticate a challenge in order to download its request. The block has no return type and takes two arguments: the URL connection object, and the challenge that must be authenticated. This block must invoke one of the challenge-responder methods (NSURLAuthenticationChallengeSender protocol). - @discussion If `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is defined, `connection:canAuthenticateAgainstProtectionSpace:` will accept invalid SSL certificates, returning `YES` if the protection space authentication method is `NSURLAuthenticationMethodServerTrust`. + If `allowsInvalidSSLCertificate` is set to YES, `connection:willSendRequestForAuthenticationChallenge:` will attempt to have the challenge sender use credentials with invalid SSL certificates. */ -- (void)setAuthenticationAgainstProtectionSpaceBlock:(BOOL (^)(NSURLConnection *connection, NSURLProtectionSpace *protectionSpace))block; - -/** - Sets a block to be executed when the connection must authenticate a challenge in order to download its request, as handled by the `NSURLConnectionDelegate` method `connection:didReceiveAuthenticationChallenge:`. - - @param block A block object to be executed when the connection must authenticate a challenge in order to download its request. The block has no return type and takes two arguments: the URL connection object, and the challenge that must be authenticated. - - @discussion If `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is defined, `connection:didReceiveAuthenticationChallenge:` will attempt to have the challenge sender use credentials with invalid SSL certificates. - */ -- (void)setAuthenticationChallengeBlock:(void (^)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge))block; +- (void)setWillSendRequestForAuthenticationChallengeBlock:(void (^)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge))block; /** Sets a block to be executed when the server redirects the request from one URL to another URL, or when the request URL changed by the `NSURLProtocol` subclass handling the request in order to standardize its format, as handled by the `NSURLConnectionDelegate` method `connection:willSendRequest:redirectResponse:`. - + @param block A block object to be executed when the request URL was changed. The block returns an `NSURLRequest` object, the URL request to redirect, and takes three arguments: the URL connection object, the the proposed redirected request, and the URL response that caused the redirect. */ - (void)setRedirectResponseBlock:(NSURLRequest * (^)(NSURLConnection *connection, NSURLRequest *request, NSURLResponse *redirectResponse))block; @@ -273,11 +291,20 @@ /** Sets a block to be executed to modify the response a connection will cache, if any, as handled by the `NSURLConnectionDelegate` method `connection:willCacheResponse:`. - + @param block A block object to be executed to determine what response a connection will cache, if any. The block returns an `NSCachedURLResponse` object, the cached response to store in memory or `nil` to prevent the response from being cached, and takes two arguments: the URL connection object, and the cached response provided for the request. */ - (void)setCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLConnection *connection, NSCachedURLResponse *cachedResponse))block; +/// + +/** + + */ ++ (NSArray *)batchOfRequestOperations:(NSArray *)operations + progressBlock:(void (^)(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations))progressBlock + completionBlock:(void (^)(NSArray *operations))completionBlock; + @end ///---------------- @@ -285,29 +312,48 @@ ///---------------- /** - ## User info dictionary keys + ## SSL Pinning Options + + The following constants are provided by `AFURLConnectionOperation` as possible SSL Pinning options. + + enum { + AFSSLPinningModeNone, + AFSSLPinningModePublicKey, + AFSSLPinningModeCertificate, + } + `AFSSLPinningModeNone` + Do not pin SSL connections + + `AFSSLPinningModePublicKey` + Pin SSL connections to certificate public key (SPKI). + + `AFSSLPinningModeCertificate` + Pin SSL connections to exact certificate. This may cause problems when your certificate expires and needs re-issuance. + + ## User info dictionary keys + These keys may exist in the user info dictionary, in addition to those defined for NSError. - + - `NSString * const AFNetworkingOperationFailingURLRequestErrorKey` - `NSString * const AFNetworkingOperationFailingURLResponseErrorKey` - + ### Constants - + `AFNetworkingOperationFailingURLRequestErrorKey` The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFNetworkingErrorDomain`. - + `AFNetworkingOperationFailingURLResponseErrorKey` The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFNetworkingErrorDomain`. - + ## Error Domains - + The following error domain is predefined. - + - `NSString * const AFNetworkingErrorDomain` - + ### Constants - + `AFNetworkingErrorDomain` AFNetworking errors. Error codes for `AFNetworkingErrorDomain` correspond to codes in `NSURLErrorDomain`. */ diff --git a/AFNetworking/AFURLConnectionOperation.m b/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m old mode 100755 new mode 100644 similarity index 67% rename from AFNetworking/AFURLConnectionOperation.m rename to Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m index 17c98c9..37993ca --- a/AFNetworking/AFURLConnectionOperation.m +++ b/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m @@ -1,17 +1,17 @@ // AFURLConnectionOperation.m // -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -23,7 +23,7 @@ #import "AFURLConnectionOperation.h" #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - #import +#import #endif #if !__has_feature(objc_arc) @@ -31,14 +31,12 @@ // You can turn on ARC for only AFNetworking files by adding -fobjc-arc to the build phase for each of its files. #endif -typedef enum { +typedef NS_ENUM(NSInteger, AFOperationState) { AFOperationPausedState = -1, AFOperationReadyState = 1, AFOperationExecutingState = 2, AFOperationFinishedState = 3, -} _AFOperationState; - -typedef signed short AFOperationState; +}; #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) typedef UIBackgroundTaskIdentifier AFBackgroundTaskIdentifier; @@ -46,6 +44,16 @@ typedef id AFBackgroundTaskIdentifier; #endif +static dispatch_group_t url_request_operation_completion_group() { + static dispatch_group_t af_url_request_operation_completion_group; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + af_url_request_operation_completion_group = dispatch_group_create(); + }); + + return af_url_request_operation_completion_group; +} + static NSString * const kAFNetworkingLockName = @"com.alamofire.networking.operation.lock"; NSString * const AFNetworkingErrorDomain = @"AFNetworkingErrorDomain"; @@ -56,7 +64,6 @@ NSString * const AFNetworkingOperationDidFinishNotification = @"com.alamofire.networking.operation.finish"; typedef void (^AFURLConnectionOperationProgressBlock)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected); -typedef BOOL (^AFURLConnectionOperationAuthenticationAgainstProtectionSpaceBlock)(NSURLConnection *connection, NSURLProtectionSpace *protectionSpace); typedef void (^AFURLConnectionOperationAuthenticationChallengeBlock)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge); typedef NSCachedURLResponse * (^AFURLConnectionOperationCacheResponseBlock)(NSURLConnection *connection, NSCachedURLResponse *cachedResponse); typedef NSURLRequest * (^AFURLConnectionOperationRedirectResponseBlock)(NSURLConnection *connection, NSURLRequest *request, NSURLResponse *redirectResponse); @@ -120,7 +127,6 @@ @interface AFURLConnectionOperation () @property (readwrite, nonatomic, assign) AFBackgroundTaskIdentifier backgroundTaskIdentifier; @property (readwrite, nonatomic, copy) AFURLConnectionOperationProgressBlock uploadProgress; @property (readwrite, nonatomic, copy) AFURLConnectionOperationProgressBlock downloadProgress; -@property (readwrite, nonatomic, copy) AFURLConnectionOperationAuthenticationAgainstProtectionSpaceBlock authenticationAgainstProtectionSpace; @property (readwrite, nonatomic, copy) AFURLConnectionOperationAuthenticationChallengeBlock authenticationChallenge; @property (readwrite, nonatomic, copy) AFURLConnectionOperationCacheResponseBlock cacheResponse; @property (readwrite, nonatomic, copy) AFURLConnectionOperationRedirectResponseBlock redirectResponse; @@ -131,43 +137,21 @@ - (void)cancelConnection; @end @implementation AFURLConnectionOperation -@synthesize state = _state; -@synthesize cancelled = _cancelled; -@synthesize connection = _connection; -@synthesize runLoopModes = _runLoopModes; -@synthesize request = _request; -@synthesize response = _response; -@synthesize error = _error; -@synthesize responseData = _responseData; -@synthesize responseString = _responseString; -@synthesize responseStringEncoding = _responseStringEncoding; -@synthesize totalBytesRead = _totalBytesRead; -@dynamic inputStream; @synthesize outputStream = _outputStream; -@synthesize credential = _credential; -@synthesize shouldUseCredentialStorage = _shouldUseCredentialStorage; -@synthesize userInfo = _userInfo; -@synthesize backgroundTaskIdentifier = _backgroundTaskIdentifier; -@synthesize uploadProgress = _uploadProgress; -@synthesize downloadProgress = _downloadProgress; -@synthesize authenticationAgainstProtectionSpace = _authenticationAgainstProtectionSpace; -@synthesize authenticationChallenge = _authenticationChallenge; -@synthesize cacheResponse = _cacheResponse; -@synthesize redirectResponse = _redirectResponse; -@synthesize lock = _lock; - -+ (void) __attribute__((noreturn)) networkRequestThreadEntryPoint:(id)__unused object { - do { - @autoreleasepool { - [[NSRunLoop currentRunLoop] run]; - } - } while (YES); + ++ (void)networkRequestThreadEntryPoint:(id)__unused object { + @autoreleasepool { + [[NSThread currentThread] setName:@"AFNetworking"]; + + NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; + [runLoop addPort:[NSMachPort port] forMode:NSDefaultRunLoopMode]; + [runLoop run]; + } } + (NSThread *)networkRequestThread { static NSThread *_networkRequestThread = nil; static dispatch_once_t oncePredicate; - dispatch_once(&oncePredicate, ^{ _networkRequestThread = [[NSThread alloc] initWithTarget:self selector:@selector(networkRequestThreadEntryPoint:) object:nil]; [_networkRequestThread start]; @@ -176,25 +160,9 @@ + (NSThread *)networkRequestThread { return _networkRequestThread; } -+ (NSArray *)pinnedCertificates { - static NSArray *_pinnedCertificates = nil; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"."]; - NSMutableArray *certificates = [NSMutableArray array]; - for (NSString *path in paths) { - NSData *certificateData = [NSData dataWithContentsOfFile:path]; - [certificates addObject:certificateData]; - } - _pinnedCertificates = [[NSArray alloc] initWithArray:certificates]; - }); - - return _pinnedCertificates; -} +- (instancetype)initWithRequest:(NSURLRequest *)urlRequest { + NSParameterAssert(urlRequest); -- (id)initWithRequest:(NSURLRequest *)urlRequest { self = [super init]; if (!self) { return nil; @@ -206,13 +174,13 @@ - (id)initWithRequest:(NSURLRequest *)urlRequest { self.runLoopModes = [NSSet setWithObject:NSRunLoopCommonModes]; self.request = urlRequest; - - self.shouldUseCredentialStorage = YES; - self.outputStream = [NSOutputStream outputStreamToMemory]; + self.shouldUseCredentialStorage = YES; self.state = AFOperationReadyState; - + + self.securityPolicy = [AFSecurityPolicy defaultPolicy]; + return self; } @@ -221,7 +189,7 @@ - (void)dealloc { [_outputStream close]; _outputStream = nil; } - + #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) if (_backgroundTaskIdentifier) { [[UIApplication sharedApplication] endBackgroundTask:_backgroundTaskIdentifier]; @@ -239,12 +207,23 @@ - (void)setCompletionBlock:(void (^)(void))block { if (!block) { [super setCompletionBlock:nil]; } else { - __weak __typeof(&*self)weakSelf = self; + __weak __typeof(self)weakSelf = self; [super setCompletionBlock:^ { - __strong __typeof(&*weakSelf)strongSelf = weakSelf; - - block(); - [strongSelf setCompletionBlock:nil]; + __strong __typeof(weakSelf)strongSelf = weakSelf; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + dispatch_group_t group = strongSelf.completionGroup ?: url_request_operation_completion_group(); + dispatch_queue_t queue = strongSelf.completionQueue ?: dispatch_get_main_queue(); +#pragma clang diagnostic pop + + dispatch_group_async(group, queue, ^{ + block(); + }); + + dispatch_group_notify(group, queue, ^{ + [strongSelf setCompletionBlock:nil]; + }); }]; } [self.lock unlock]; @@ -262,27 +241,35 @@ - (void)setInputStream:(NSInputStream *)inputStream { [self didChangeValueForKey:@"inputStream"]; } -- (void)setOutputStream:(NSOutputStream *)outputStream { - if (outputStream == _outputStream) { - return; +- (NSOutputStream *)outputStream { + if (!_outputStream) { + self.outputStream = [NSOutputStream outputStreamToMemory]; } - - [self willChangeValueForKey:@"outputStream"]; - if (_outputStream) { - [_outputStream close]; + + return _outputStream; +} + +- (void)setOutputStream:(NSOutputStream *)outputStream { + [self.lock lock]; + if (outputStream != _outputStream) { + [self willChangeValueForKey:@"outputStream"]; + if (_outputStream) { + [_outputStream close]; + } + _outputStream = outputStream; + [self didChangeValueForKey:@"outputStream"]; } - _outputStream = outputStream; - [self didChangeValueForKey:@"outputStream"]; + [self.lock unlock]; } #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) - (void)setShouldExecuteAsBackgroundTaskWithExpirationHandler:(void (^)(void))handler { [self.lock lock]; - if (!self.backgroundTaskIdentifier) { + if (!self.backgroundTaskIdentifier) { UIApplication *application = [UIApplication sharedApplication]; - __weak __typeof(&*self)weakSelf = self; + __weak __typeof(self)weakSelf = self; self.backgroundTaskIdentifier = [application beginBackgroundTaskWithExpirationHandler:^{ - __strong __typeof(&*weakSelf)strongSelf = weakSelf; + __strong __typeof(weakSelf)strongSelf = weakSelf; if (handler) { handler(); @@ -308,11 +295,7 @@ - (void)setDownloadProgressBlock:(void (^)(NSUInteger bytesRead, long long total self.downloadProgress = block; } -- (void)setAuthenticationAgainstProtectionSpaceBlock:(BOOL (^)(NSURLConnection *, NSURLProtectionSpace *))block { - self.authenticationAgainstProtectionSpace = block; -} - -- (void)setAuthenticationChallengeBlock:(void (^)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge))block { +- (void)setWillSendRequestForAuthenticationChallengeBlock:(void (^)(NSURLConnection *connection, NSURLAuthenticationChallenge *challenge))block { self.authenticationChallenge = block; } @@ -325,30 +308,19 @@ - (void)setRedirectResponseBlock:(NSURLRequest * (^)(NSURLConnection *connection } - (void)setState:(AFOperationState)state { - [self.lock lock]; - if (AFStateTransitionIsValid(self.state, state, [self isCancelled])) { - NSString *oldStateKey = AFKeyPathFromOperationState(self.state); - NSString *newStateKey = AFKeyPathFromOperationState(state); - - [self willChangeValueForKey:newStateKey]; - [self willChangeValueForKey:oldStateKey]; - _state = state; - [self didChangeValueForKey:oldStateKey]; - [self didChangeValueForKey:newStateKey]; - - dispatch_async(dispatch_get_main_queue(), ^{ - switch (state) { - case AFOperationExecutingState: - [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidStartNotification object:self]; - break; - case AFOperationFinishedState: - [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self]; - break; - default: - break; - } - }); + if (!AFStateTransitionIsValid(self.state, state, [self isCancelled])) { + return; } + + [self.lock lock]; + NSString *oldStateKey = AFKeyPathFromOperationState(self.state); + NSString *newStateKey = AFKeyPathFromOperationState(state); + + [self willChangeValueForKey:newStateKey]; + [self willChangeValueForKey:oldStateKey]; + _state = state; + [self didChangeValueForKey:oldStateKey]; + [self didChangeValueForKey:newStateKey]; [self.lock unlock]; } @@ -364,7 +336,7 @@ - (NSString *)responseString { - (NSStringEncoding)responseStringEncoding { [self.lock lock]; - if (!_responseStringEncoding) { + if (!_responseStringEncoding && self.response) { NSStringEncoding stringEncoding = NSUTF8StringEncoding; if (self.response.textEncodingName) { CFStringEncoding IANAEncoding = CFStringConvertIANACharSetNameToEncoding((__bridge CFStringRef)self.response.textEncodingName); @@ -391,12 +363,13 @@ - (void)pause { [self.connection performSelector:@selector(cancel) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]]; dispatch_async(dispatch_get_main_queue(), ^{ - [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self]; + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + [notificationCenter postNotificationName:AFNetworkingOperationDidFinishNotification object:self]; }); } self.state = AFOperationPausedState; - + [self.lock unlock]; } @@ -446,9 +419,7 @@ - (void)start { - (void)operationDidStart { [self.lock lock]; - if ([self isCancelled]) { - [self finish]; - } else { + if (! [self isCancelled]) { self.connection = [[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO]; NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; @@ -457,13 +428,25 @@ - (void)operationDidStart { [self.outputStream scheduleInRunLoop:runLoop forMode:runLoopMode]; } - [self.connection start]; + [self.connection start]; } [self.lock unlock]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidStartNotification object:self]; + }); + + if ([self isCancelled]) { + [self finish]; + } } - (void)finish { self.state = AFOperationFinishedState; + + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingOperationDidFinishNotification object:self]; + }); } - (void)cancel { @@ -473,8 +456,8 @@ - (void)cancel { _cancelled = YES; [super cancel]; [self didChangeValueForKey:@"isCancelled"]; - - // Cancel the connection on the thread it runs on to prevent race conditions + + // Cancel the connection on the thread it runs on to prevent race conditions [self performSelector:@selector(cancelConnection) onThread:[[self class] networkRequestThread] withObject:nil waitUntilDone:NO modes:[self.runLoopModes allObjects]]; } [self.lock unlock]; @@ -485,88 +468,88 @@ - (void)cancelConnection { if ([self.request URL]) { userInfo = [NSDictionary dictionaryWithObject:[self.request URL] forKey:NSURLErrorFailingURLErrorKey]; } - self.error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo]; + NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo]; - if (self.connection) { + if (![self isFinished] && self.connection) { [self.connection cancel]; - - // Manually send this delegate message since `[self.connection cancel]` causes the connection to never send another message to its delegate - [self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:self.error]; + [self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:error]; } } -#pragma mark - NSURLConnectionDelegate +#pragma mark - -#ifdef _AFNETWORKING_PIN_SSL_CERTIFICATES_ -- (void)connection:(NSURLConnection *)connection -willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge ++ (NSArray *)batchOfRequestOperations:(NSArray *)operations + progressBlock:(void (^)(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations))progressBlock + completionBlock:(void (^)(NSArray *operations))completionBlock { - if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - SecTrustRef serverTrust = challenge.protectionSpace.serverTrust; - SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, 0); - NSData *certificateData = (__bridge_transfer NSData *)SecCertificateCopyData(certificate); - - if ([[[self class] pinnedCertificates] containsObject:certificateData]) { - NSURLCredential *credential = [NSURLCredential credentialForTrust:serverTrust]; - [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; - } else { - [[challenge sender] cancelAuthenticationChallenge:challenge]; - } + if (!operations || [operations count] == 0) { + return 0; } -} -#endif -- (BOOL)connection:(NSURLConnection *)connection -canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace -{ -#ifdef _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ - if ([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - return YES; - } -#endif - - if (self.authenticationAgainstProtectionSpace) { - return self.authenticationAgainstProtectionSpace(connection, protectionSpace); - } else if ([protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust] || [protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodClientCertificate]) { - return NO; - } else { - return YES; + __block dispatch_group_t group = dispatch_group_create(); + NSBlockOperation *batchedOperation = [NSBlockOperation blockOperationWithBlock:^{ + dispatch_group_notify(group, dispatch_get_main_queue(), ^{ + if (completionBlock) { + completionBlock(operations); + } + }); + }]; + + for (AFURLConnectionOperation *operation in operations) { + operation.completionGroup = group; + void (^originalCompletionBlock)(void) = [operation.completionBlock copy]; + __weak __typeof(operation)weakOperation = operation; + operation.completionBlock = ^{ + __strong __typeof(weakOperation)strongOperation = weakOperation; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + dispatch_queue_t queue = strongOperation.completionQueue ?: dispatch_get_main_queue(); +#pragma clang diagnostic pop + dispatch_group_async(group, queue, ^{ + if (originalCompletionBlock) { + originalCompletionBlock(); + } + + NSUInteger numberOfFinishedOperations = [[operations indexesOfObjectsPassingTest:^BOOL(id op, NSUInteger __unused idx, BOOL __unused *stop) { + return [op isFinished]; + }] count]; + + if (progressBlock) { + progressBlock(numberOfFinishedOperations, [operations count]); + } + + dispatch_group_leave(group); + }); + }; + + dispatch_group_enter(group); + [batchedOperation addDependency:operation]; } + + return [operations arrayByAddingObject:batchedOperation]; } -- (void)connection:(NSURLConnection *)connection -didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge +#pragma mark - NSURLConnectionDelegate + +- (void)connection:(NSURLConnection *)connection +willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge { -#ifdef _AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_ - if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { - [challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge]; - return; - } -#endif - if (self.authenticationChallenge) { self.authenticationChallenge(connection, challenge); + return; + } + + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust]) { + NSURLCredential *credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; + [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; + } else { + [[challenge sender] cancelAuthenticationChallenge:challenge]; + } } else { if ([challenge previousFailureCount] == 0) { - NSURLCredential *credential = nil; - - NSString *username = (__bridge_transfer NSString *)CFURLCopyUserName((__bridge CFURLRef)[self.request URL]); - NSString *password = (__bridge_transfer NSString *)CFURLCopyPassword((__bridge CFURLRef)[self.request URL]); - - if (username && password) { - credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceNone]; - } else if (username) { - credential = [[[NSURLCredentialStorage sharedCredentialStorage] credentialsForProtectionSpace:[challenge protectionSpace]] objectForKey:username]; - } else { - credential = [[NSURLCredentialStorage sharedCredentialStorage] defaultCredentialForProtectionSpace:[challenge protectionSpace]]; - } - - if (!credential) { - credential = self.credential; - } - - if (credential) { - [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge]; + if (self.credential) { + [[challenge sender] useCredential:self.credential forAuthenticationChallenge:challenge]; } else { [[challenge sender] continueWithoutCredentialForAuthenticationChallenge:challenge]; } @@ -580,16 +563,6 @@ - (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection __unused *)connect return self.shouldUseCredentialStorage; } -- (NSInputStream *)connection:(NSURLConnection __unused *)connection - needNewBodyStream:(NSURLRequest *)request -{ - if ([request.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) { - return [request.HTTPBodyStream copy]; - } - - return nil; -} - - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse @@ -603,7 +576,7 @@ - (NSURLRequest *)connection:(NSURLConnection *)connection - (void)connection:(NSURLConnection __unused *)connection didSendBodyData:(NSInteger)bytesWritten - totalBytesWritten:(NSInteger)totalBytesWritten + totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite { if (self.uploadProgress) { @@ -614,7 +587,7 @@ - (void)connection:(NSURLConnection __unused *)connection } - (void)connection:(NSURLConnection __unused *)connection -didReceiveResponse:(NSURLResponse *)response +didReceiveResponse:(NSURLResponse *)response { self.response = response; @@ -624,18 +597,35 @@ - (void)connection:(NSURLConnection __unused *)connection - (void)connection:(NSURLConnection __unused *)connection didReceiveData:(NSData *)data { - self.totalBytesRead += [data length]; - - if ([self.outputStream hasSpaceAvailable]) { - const uint8_t *dataBuffer = (uint8_t *) [data bytes]; - [self.outputStream write:&dataBuffer[0] maxLength:[data length]]; - } - - if (self.downloadProgress) { - dispatch_async(dispatch_get_main_queue(), ^{ - self.downloadProgress([data length], self.totalBytesRead, self.response.expectedContentLength); - }); + NSUInteger length = [data length]; + while (YES) { + NSInteger totalNumberOfBytesWritten = 0; + if ([self.outputStream hasSpaceAvailable]) { + const uint8_t *dataBuffer = (uint8_t *)[data bytes]; + + NSInteger numberOfBytesWritten = 0; + while (totalNumberOfBytesWritten < (NSInteger)length) { + numberOfBytesWritten = [self.outputStream write:&dataBuffer[0] maxLength:length]; + if (numberOfBytesWritten == -1) { + [self.connection cancel]; + [self performSelector:@selector(connection:didFailWithError:) withObject:self.connection withObject:self.outputStream.streamError]; + return; + } else { + totalNumberOfBytesWritten += numberOfBytesWritten; + } + } + + break; + } } + + dispatch_async(dispatch_get_main_queue(), ^{ + self.totalBytesRead += length; + + if (self.downloadProgress) { + self.downloadProgress(length, self.totalBytesRead, self.response.expectedContentLength); + } + }); } - (void)connectionDidFinishLoading:(NSURLConnection __unused *)connection { @@ -644,24 +634,24 @@ - (void)connectionDidFinishLoading:(NSURLConnection __unused *)connection { [self.outputStream close]; [self finish]; - + self.connection = nil; } - (void)connection:(NSURLConnection __unused *)connection - didFailWithError:(NSError *)error -{ + didFailWithError:(NSError *)error +{ self.error = error; [self.outputStream close]; [self finish]; - + self.connection = nil; } -- (NSCachedURLResponse *)connection:(NSURLConnection *)connection - willCacheResponse:(NSCachedURLResponse *)cachedResponse +- (NSCachedURLResponse *)connection:(NSURLConnection *)connection + willCacheResponse:(NSCachedURLResponse *)cachedResponse { if (self.cacheResponse) { return self.cacheResponse(connection, cachedResponse); @@ -670,7 +660,7 @@ - (NSCachedURLResponse *)connection:(NSURLConnection *)connection return nil; } - return cachedResponse; + return cachedResponse; } } @@ -683,14 +673,14 @@ - (id)initWithCoder:(NSCoder *)aDecoder { if (!self) { return nil; } - + self.state = (AFOperationState)[aDecoder decodeIntegerForKey:@"state"]; self.cancelled = [aDecoder decodeBoolForKey:@"isCancelled"]; self.response = [aDecoder decodeObjectForKey:@"response"]; self.error = [aDecoder decodeObjectForKey:@"error"]; self.responseData = [aDecoder decodeObjectForKey:@"responseData"]; - self.totalBytesRead = [[aDecoder decodeObjectForKey:@"totalBytesRead"] longLongValue]; - + self.totalBytesRead = [aDecoder decodeInt64ForKey:@"totalBytesRead"]; + return self; } @@ -698,7 +688,7 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { [self pause]; [aCoder encodeObject:self.request forKey:@"request"]; - + switch (self.state) { case AFOperationExecutingState: case AFOperationPausedState: @@ -713,21 +703,22 @@ - (void)encodeWithCoder:(NSCoder *)aCoder { [aCoder encodeObject:self.response forKey:@"response"]; [aCoder encodeObject:self.error forKey:@"error"]; [aCoder encodeObject:self.responseData forKey:@"responseData"]; - [aCoder encodeObject:[NSNumber numberWithLongLong:self.totalBytesRead] forKey:@"totalBytesRead"]; + [aCoder encodeInt64:self.totalBytesRead forKey:@"totalBytesRead"]; } #pragma mark - NSCopying - (id)copyWithZone:(NSZone *)zone { AFURLConnectionOperation *operation = [(AFURLConnectionOperation *)[[self class] allocWithZone:zone] initWithRequest:self.request]; - + operation.uploadProgress = self.uploadProgress; operation.downloadProgress = self.downloadProgress; - operation.authenticationAgainstProtectionSpace = self.authenticationAgainstProtectionSpace; operation.authenticationChallenge = self.authenticationChallenge; operation.cacheResponse = self.cacheResponse; operation.redirectResponse = self.redirectResponse; - + operation.completionQueue = self.completionQueue; + operation.completionGroup = self.completionGroup; + return operation; } diff --git a/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h b/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h new file mode 100644 index 0000000..90f37a7 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.h @@ -0,0 +1,345 @@ +// AFSerialization.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +#import +#endif + +/** + The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary. + + For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`. + */ +@protocol AFURLRequestSerialization + +/** + Returns a request with the specified parameters encoded into a copy of the original request. + + @param request The original request. + @param parameters The parameters to be encoded. + @param error The error that occurred while attempting to encode the request parameters. + + @return A serialized request. + */ +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(NSDictionary *)parameters + error:(NSError *__autoreleasing *)error; + +@end + +#pragma mark - + +/** + + */ +typedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) { + AFHTTPRequestQueryStringDefaultStyle = 0, +}; + +@protocol AFMultipartFormData; + +/** + `AFHTTPSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation. + + Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPSerializer` in order to ensure consistent default behavior. + */ +@interface AFHTTPRequestSerializer : NSObject + +/** + The string encoding used to serialize parameters. + */ +@property (nonatomic, assign) NSStringEncoding stringEncoding; + +///--------------------------------------- +/// @name Configuring HTTP Request Headers +///--------------------------------------- + +/** + Default HTTP header field values to be applied to serialized requests. + */ +@property (readonly, nonatomic, strong) NSDictionary *HTTPRequestHeaders; + +/** + Creates and returns a serializer with default configuration. + */ ++ (instancetype)serializer; + +/** + Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header. + + @param field The HTTP header to set a default value for + @param value The value set as default for the specified header, or `nil` + */ +- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field; + +/** + Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header. + + @param username The HTTP basic auth username + @param password The HTTP basic auth password + */ +- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username + password:(NSString *)password; + +/** + Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a token-based authentication value, such as an OAuth access token. This overwrites any existing value for this header. + + @param token The authentication token + */ +- (void)setAuthorizationHeaderFieldWithToken:(NSString *)token; + + +/** + Clears any existing value for the "Authorization" HTTP header. + */ +- (void)clearAuthorizationHeader; + +///------------------------------------------------------- +/// @name Configuring Query String Parameter Serialization +///------------------------------------------------------- + +/** + HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default. + */ +@property (nonatomic, strong) NSSet *HTTPMethodsEncodingParametersInURI; + +/** + Set the method of query string serialization according to one of the pre-defined styles. + + @param style The serialization style. + + @see AFHTTPRequestQueryStringSerializationStyle + */ +- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style; + +/** + Set the a custom method of query string serialization according to the specified block. + + @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request. + */ +- (void)setQueryStringSerializationWithBlock:(NSString * (^)(NSURLRequest *request, NSDictionary *parameters, NSError *__autoreleasing *error))block; + +///------------------------------- +/// @name Creating Request Objects +///------------------------------- + +/** + Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string. + + If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body. + + @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`. + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body. + + @return An `NSMutableURLRequest` object. + */ +- (NSMutableURLRequest *)requestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(NSDictionary *)parameters; + +/** + Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2 + + Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream. + + @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`. + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded and set in the request HTTP body. + @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. + + @return An `NSMutableURLRequest` object + */ +- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(NSDictionary *)parameters + constructingBodyWithBlock:(void (^)(id formData))block; + +@end + +#pragma mark - + +extern NSUInteger const kAFUploadStream3GSuggestedPacketSize; +extern NSTimeInterval const kAFUploadStream3GSuggestedDelay; + +/** + The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`. + */ +@protocol AFMultipartFormData + +/** + Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary. + + The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively. + + @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`. + @param name The name to be associated with the specified data. This parameter must not be `nil`. + @param error If an error occurs, upon return contains an `NSError` object that describes the problem. + + @return `YES` if the file data was successfully appended, otherwise `NO`. + */ +- (BOOL)appendPartWithFileURL:(NSURL *)fileURL + name:(NSString *)name + error:(NSError * __autoreleasing *)error; + +/** + Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary. + + @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`. + @param name The name to be associated with the specified data. This parameter must not be `nil`. + @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`. + @param mimeType The declared MIME type of the file data. This parameter must not be `nil`. + @param error If an error occurs, upon return contains an `NSError` object that describes the problem. + + @return `YES` if the file data was successfully appended otherwise `NO`. + */ +- (BOOL)appendPartWithFileURL:(NSURL *)fileURL + name:(NSString *)name + fileName:(NSString *)fileName + mimeType:(NSString *)mimeType + error:(NSError * __autoreleasing *)error; + +/** + Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary. + + @param inputStream The input stream to be appended to the form data + @param name The name to be associated with the specified input stream. This parameter must not be `nil`. + @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`. + @param length The length of the specified input stream in bytes. + @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`. + */ +- (void)appendPartWithInputStream:(NSInputStream *)inputStream + name:(NSString *)name + fileName:(NSString *)fileName + length:(int64_t)length + mimeType:(NSString *)mimeType; + +/** + Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary. + + @param data The data to be encoded and appended to the form data. + @param name The name to be associated with the specified data. This parameter must not be `nil`. + @param fileName The filename to be associated with the specified data. This parameter must not be `nil`. + @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`. + */ +- (void)appendPartWithFileData:(NSData *)data + name:(NSString *)name + fileName:(NSString *)fileName + mimeType:(NSString *)mimeType; + +/** + Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary. + + @param data The data to be encoded and appended to the form data. + @param name The name to be associated with the specified data. This parameter must not be `nil`. + */ + +- (void)appendPartWithFormData:(NSData *)data + name:(NSString *)name; + + +/** + Appends HTTP headers, followed by the encoded data and the multipart form boundary. + + @param headers The HTTP headers to be appended to the form data. + @param body The data to be encoded and appended to the form data. + */ +- (void)appendPartWithHeaders:(NSDictionary *)headers + body:(NSData *)body; + +/** + Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream. + + When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, there is no definite way to distinguish between a 3G, EDGE, or LTE connection over `NSURLConnection`. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth. + + @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 16kb. + @param delay Duration of delay each time a packet is read. By default, no delay is set. + */ +- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes + delay:(NSTimeInterval)delay; + +@end + +///---------------- +/// @name Constants +///---------------- + +/** + ## Throttling Bandwidth for HTTP Request Input Streams + + @see -throttleBandwidthWithPacketSize:delay: + + `kAFUploadStream3GSuggestedPacketSize` + Maximum packet size, in number of bytes. Equal to 16kb. + + `kAFUploadStream3GSuggestedDelay` + Duration of delay each time a packet is read. Equal to 0.2 seconds. + */ + +#pragma mark - + +@interface AFJSONRequestSerializer : AFHTTPRequestSerializer + +/** + The property list format. Possible values are described in "NSPropertyListFormat". + */ +@property (nonatomic, assign) NSPropertyListFormat format; + +/** + Options for writing the request JSON data from Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONWritingOptions". `0` by default. + */ +@property (nonatomic, assign) NSJSONWritingOptions writingOptions; + +/** + Creates and returns a JSON serializer with specified reading and writing options. + + @param writingOptions The specified JSON writing options. + */ ++ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions; + +@end + +@interface AFPropertyListRequestSerializer : AFHTTPRequestSerializer + +/** + The property list format. Possible values are described in "NSPropertyListFormat". + */ +@property (nonatomic, assign) NSPropertyListFormat format; + +/** + @warning The `writeOptions` property is currently unused. + */ +@property (nonatomic, assign) NSPropertyListWriteOptions writeOptions; + +/** + Creates and returns a property list serializer with a specified format, read options, and write options. + + @param format The property list format. + @param writeOptions The property list write options. + + @warning The `writeOptions` property is currently unused. + */ ++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format + writeOptions:(NSPropertyListWriteOptions)writeOptions; + +@end diff --git a/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m b/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m new file mode 100755 index 0000000..37dab31 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFURLRequestSerialization.m @@ -0,0 +1,1135 @@ +// AFSerialization.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFURLRequestSerialization.h" + +extern NSString * const AFNetworkingErrorDomain; + +typedef NSString * (^AFQueryStringSerializationBlock)(NSURLRequest *request, NSDictionary *parameters, NSError *__autoreleasing *error); + +static NSString * AFBase64EncodedStringFromString(NSString *string) { + NSData *data = [NSData dataWithBytes:[string UTF8String] length:[string lengthOfBytesUsingEncoding:NSUTF8StringEncoding]]; + NSUInteger length = [data length]; + NSMutableData *mutableData = [NSMutableData dataWithLength:((length + 2) / 3) * 4]; + + uint8_t *input = (uint8_t *)[data bytes]; + uint8_t *output = (uint8_t *)[mutableData mutableBytes]; + + for (NSUInteger i = 0; i < length; i += 3) { + NSUInteger value = 0; + for (NSUInteger j = i; j < (i + 3); j++) { + value <<= 8; + if (j < length) { + value |= (0xFF & input[j]); + } + } + + static uint8_t const kAFBase64EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; + + NSUInteger idx = (i / 3) * 4; + output[idx + 0] = kAFBase64EncodingTable[(value >> 18) & 0x3F]; + output[idx + 1] = kAFBase64EncodingTable[(value >> 12) & 0x3F]; + output[idx + 2] = (i + 1) < length ? kAFBase64EncodingTable[(value >> 6) & 0x3F] : '='; + output[idx + 3] = (i + 2) < length ? kAFBase64EncodingTable[(value >> 0) & 0x3F] : '='; + } + + return [[NSString alloc] initWithData:mutableData encoding:NSASCIIStringEncoding]; +} + +static NSString * const kAFCharactersToBeEscapedInQueryString = @":/?&=;+!@#$()',*"; + +static NSString * AFPercentEscapedQueryStringKeyFromStringWithEncoding(NSString *string, NSStringEncoding encoding) { + static NSString * const kAFCharactersToLeaveUnescapedInQueryStringPairKey = @"[]."; + + return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, (__bridge CFStringRef)kAFCharactersToLeaveUnescapedInQueryStringPairKey, (__bridge CFStringRef)kAFCharactersToBeEscapedInQueryString, CFStringConvertNSStringEncodingToEncoding(encoding)); +} + +static NSString * AFPercentEscapedQueryStringValueFromStringWithEncoding(NSString *string, NSStringEncoding encoding) { + return (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)string, NULL, (__bridge CFStringRef)kAFCharactersToBeEscapedInQueryString, CFStringConvertNSStringEncodingToEncoding(encoding)); +} + +#pragma mark - + +@interface AFQueryStringPair : NSObject +@property (readwrite, nonatomic, strong) id field; +@property (readwrite, nonatomic, strong) id value; + +- (id)initWithField:(id)field value:(id)value; + +- (NSString *)URLEncodedStringValueWithEncoding:(NSStringEncoding)stringEncoding; +@end + +@implementation AFQueryStringPair + +- (id)initWithField:(id)field value:(id)value { + self = [super init]; + if (!self) { + return nil; + } + + self.field = field; + self.value = value; + + return self; +} + +- (NSString *)URLEncodedStringValueWithEncoding:(NSStringEncoding)stringEncoding { + if (!self.value || [self.value isEqual:[NSNull null]]) { + return AFPercentEscapedQueryStringKeyFromStringWithEncoding([self.field description], stringEncoding); + } else { + return [NSString stringWithFormat:@"%@=%@", AFPercentEscapedQueryStringKeyFromStringWithEncoding([self.field description], stringEncoding), AFPercentEscapedQueryStringValueFromStringWithEncoding([self.value description], stringEncoding)]; + } +} + +@end + +#pragma mark - + +extern NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary); +extern NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value); + +static NSString * AFQueryStringFromParametersWithEncoding(NSDictionary *parameters, NSStringEncoding stringEncoding) { + NSMutableArray *mutablePairs = [NSMutableArray array]; + for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { + [mutablePairs addObject:[pair URLEncodedStringValueWithEncoding:stringEncoding]]; + } + + return [mutablePairs componentsJoinedByString:@"&"]; +} + +NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) { + return AFQueryStringPairsFromKeyAndValue(nil, dictionary); +} + +NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) { + NSMutableArray *mutableQueryStringComponents = [NSMutableArray array]; + + if ([value isKindOfClass:[NSDictionary class]]) { + NSDictionary *dictionary = value; + // Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries + NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(caseInsensitiveCompare:)]; + for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) { + id nestedValue = [dictionary objectForKey:nestedKey]; + if (nestedValue) { + [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)]; + } + } + } else if ([value isKindOfClass:[NSArray class]]) { + NSArray *array = value; + for (id nestedValue in array) { + [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)]; + } + } else if ([value isKindOfClass:[NSSet class]]) { + NSSet *set = value; + for (id obj in set) { + [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)]; + } + } else { + [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]]; + } + + return mutableQueryStringComponents; +} + +#pragma mark - + +@interface AFStreamingMultipartFormData : NSObject +- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest + stringEncoding:(NSStringEncoding)encoding; + +- (NSMutableURLRequest *)requestByFinalizingMultipartFormData; +@end + +#pragma mark - + +@interface AFHTTPRequestSerializer () +@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders; +@property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle; +@property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization; +@end + +@implementation AFHTTPRequestSerializer + ++ (instancetype)serializer { + return [[self alloc] init]; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.stringEncoding = NSUTF8StringEncoding; + + self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary]; + + // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 + NSMutableArray *acceptLanguagesComponents = [NSMutableArray array]; + [[NSLocale preferredLanguages] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + float q = 1.0f - (idx * 0.1f); + [acceptLanguagesComponents addObject:[NSString stringWithFormat:@"%@;q=%0.1g", obj, q]]; + *stop = q <= 0.5f; + }]; + [self setValue:[acceptLanguagesComponents componentsJoinedByString:@", "] forHTTPHeaderField:@"Accept-Language"]; + + NSString *userAgent = nil; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 + userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey], (__bridge id)CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(), kCFBundleVersionKey) ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] ? [[UIScreen mainScreen] scale] : 1.0f)]; +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) + userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleExecutableKey] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey], [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] ?: [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]; +#endif +#pragma clang diagnostic pop + if (userAgent) { + if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) { + NSMutableString *mutableUserAgent = [userAgent mutableCopy]; + CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false); + userAgent = mutableUserAgent; + } + [self setValue:userAgent forHTTPHeaderField:@"User-Agent"]; + } + + // HTTP Method Definitions; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html + self.HTTPMethodsEncodingParametersInURI = [NSSet setWithObjects:@"GET", @"HEAD", @"DELETE", nil]; + + return self; +} + +#pragma mark - + +- (NSDictionary *)HTTPRequestHeaders { + return [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders]; +} + +- (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field { + [self.mutableHTTPRequestHeaders setValue:value forKey:field]; +} + +- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username password:(NSString *)password { + NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", username, password]; + [self setValue:[NSString stringWithFormat:@"Basic %@", AFBase64EncodedStringFromString(basicAuthCredentials)] forHTTPHeaderField:@"Authorization"]; +} + +- (void)setAuthorizationHeaderFieldWithToken:(NSString *)token { + [self setValue:[NSString stringWithFormat:@"Token token=\"%@\"", token] forHTTPHeaderField:@"Authorization"]; +} + +- (void)clearAuthorizationHeader { + [self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"]; +} + +#pragma mark - + +- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style { + self.queryStringSerializationStyle = style; + self.queryStringSerialization = nil; +} + +- (void)setQueryStringSerializationWithBlock:(NSString *(^)(NSURLRequest *, NSDictionary *, NSError *__autoreleasing *))block { + self.queryStringSerialization = block; +} + +#pragma mark - + +- (NSMutableURLRequest *)requestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(NSDictionary *)parameters +{ + NSParameterAssert(method); + NSParameterAssert(URLString); + + NSURL *url = [NSURL URLWithString:URLString]; + + NSParameterAssert(url); + + NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:url]; + [request setHTTPMethod:method]; + + request = [[self requestBySerializingRequest:request withParameters:parameters error:nil] mutableCopy]; + + return request; +} + +- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(NSDictionary *)parameters + constructingBodyWithBlock:(void (^)(id formData))block +{ + NSParameterAssert(method); + NSParameterAssert(![method isEqualToString:@"GET"] && ![method isEqualToString:@"HEAD"]); + + NSMutableURLRequest *request = [self requestWithMethod:method URLString:URLString parameters:nil]; + + __block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:request stringEncoding:NSUTF8StringEncoding]; + + if (parameters) { + for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { + NSData *data = nil; + if ([pair.value isKindOfClass:[NSData class]]) { + data = pair.value; + } else if ([pair.value isEqual:[NSNull null]]) { + data = [NSData data]; + } else { + data = [[pair.value description] dataUsingEncoding:self.stringEncoding]; + } + + if (data) { + [formData appendPartWithFormData:data name:[pair.field description]]; + } + } + } + + if (block) { + block(formData); + } + + return [formData requestByFinalizingMultipartFormData]; +} + +#pragma mark - AFURLRequestSerialization + +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(NSDictionary *)parameters + error:(NSError *__autoreleasing *)error +{ + NSParameterAssert(request); + + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { + if (![request valueForHTTPHeaderField:field]) { + [mutableRequest setValue:value forHTTPHeaderField:field]; + } + }]; + + if (!parameters) { + return mutableRequest; + } + + NSString *query = nil; + if (self.queryStringSerialization) { + query = self.queryStringSerialization(request, parameters, error); + } else { + switch (self.queryStringSerializationStyle) { + case AFHTTPRequestQueryStringDefaultStyle: + query = AFQueryStringFromParametersWithEncoding(parameters, self.stringEncoding); + break; + default: + break; + } + } + + if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { + mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @"&%@" : @"?%@", AFQueryStringFromParametersWithEncoding(parameters, self.stringEncoding)]]; + } else { + NSString *charset = (__bridge NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(self.stringEncoding)); + [mutableRequest setValue:[NSString stringWithFormat:@"application/x-www-form-urlencoded; charset=%@", charset] forHTTPHeaderField:@"Content-Type"]; + [mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]]; + } + + return mutableRequest; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [self init]; + if (!self) { + return nil; + } + + self.mutableHTTPRequestHeaders = [aDecoder decodeObjectForKey:@"mutableHTTPRequestHeaders"]; + self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[aDecoder decodeIntegerForKey:@"queryStringSerializationStyle"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [aCoder encodeObject:self.mutableHTTPRequestHeaders forKey:@"mutableHTTPRequestHeaders"]; + [aCoder encodeInteger:self.queryStringSerializationStyle forKey:@"queryStringSerializationStyle"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone]; + serializer.queryStringSerializationStyle = self.queryStringSerializationStyle; + serializer.queryStringSerialization = self.queryStringSerialization; + + return serializer; +} + +@end + +#pragma mark - + +static NSString * const kAFMultipartFormBoundary = @"Boundary+0xAbCdEfGbOuNdArY"; + +static NSString * const kAFMultipartFormCRLF = @"\r\n"; + +static NSInteger const kAFStreamToStreamBufferSize = 1024 * 1024; //1 meg default + +static inline NSString * AFMultipartFormInitialBoundary() { + return [NSString stringWithFormat:@"--%@%@", kAFMultipartFormBoundary, kAFMultipartFormCRLF]; +} + +static inline NSString * AFMultipartFormEncapsulationBoundary() { + return [NSString stringWithFormat:@"%@--%@%@", kAFMultipartFormCRLF, kAFMultipartFormBoundary, kAFMultipartFormCRLF]; +} + +static inline NSString * AFMultipartFormFinalBoundary() { + return [NSString stringWithFormat:@"%@--%@--%@", kAFMultipartFormCRLF, kAFMultipartFormBoundary, kAFMultipartFormCRLF]; +} + +static inline NSString * AFContentTypeForPathExtension(NSString *extension) { +#ifdef __UTTYPE__ + NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL); + NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType); + if (!contentType) { + return @"application/octet-stream"; + } else { + return contentType; + } +#else + return @"application/octet-stream"; +#endif +} + +NSUInteger const kAFUploadStream3GSuggestedPacketSize = 1024 * 16; +NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2; + +@interface AFHTTPBodyPart : NSObject +@property (nonatomic, assign) NSStringEncoding stringEncoding; +@property (nonatomic, strong) NSDictionary *headers; +@property (nonatomic, strong) id body; +@property (nonatomic, assign) unsigned long long bodyContentLength; +@property (nonatomic, strong) NSInputStream *inputStream; + +@property (nonatomic, assign) BOOL hasInitialBoundary; +@property (nonatomic, assign) BOOL hasFinalBoundary; + +@property (nonatomic, readonly, getter = hasBytesAvailable) BOOL bytesAvailable; +@property (nonatomic, readonly) unsigned long long contentLength; + +- (NSInteger)read:(uint8_t *)buffer + maxLength:(NSUInteger)length; +@end + +@interface AFMultipartBodyStream : NSInputStream +@property (nonatomic, assign) NSUInteger numberOfBytesInPacket; +@property (nonatomic, assign) NSTimeInterval delay; +@property (nonatomic, strong) NSInputStream *inputStream; +@property (nonatomic, readonly) unsigned long long contentLength; +@property (nonatomic, readonly, getter = isEmpty) BOOL empty; + +- (id)initWithStringEncoding:(NSStringEncoding)encoding; +- (void)setInitialAndFinalBoundaries; +- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart; +@end + +#pragma mark - + +@interface AFStreamingMultipartFormData () +@property (readwrite, nonatomic, copy) NSMutableURLRequest *request; +@property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream; +@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding; +@end + +@implementation AFStreamingMultipartFormData + +- (id)initWithURLRequest:(NSMutableURLRequest *)urlRequest + stringEncoding:(NSStringEncoding)encoding +{ + self = [super init]; + if (!self) { + return nil; + } + + self.request = urlRequest; + self.stringEncoding = encoding; + self.bodyStream = [[AFMultipartBodyStream alloc] initWithStringEncoding:encoding]; + + return self; +} + +- (BOOL)appendPartWithFileURL:(NSURL *)fileURL + name:(NSString *)name + error:(NSError * __autoreleasing *)error +{ + NSParameterAssert(fileURL); + NSParameterAssert(name); + + NSString *fileName = [fileURL lastPathComponent]; + NSString *mimeType = AFContentTypeForPathExtension([fileURL pathExtension]); + + return [self appendPartWithFileURL:fileURL name:name fileName:fileName mimeType:mimeType error:error]; +} + +- (BOOL)appendPartWithFileURL:(NSURL *)fileURL + name:(NSString *)name + fileName:(NSString *)fileName + mimeType:(NSString *)mimeType + error:(NSError * __autoreleasing *)error +{ + NSParameterAssert(fileURL); + NSParameterAssert(name); + NSParameterAssert(fileName); + NSParameterAssert(mimeType); + + if (![fileURL isFileURL]) { + NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"AFNetworking", nil) forKey:NSLocalizedFailureReasonErrorKey]; + if (error != NULL) { + *error = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; + } + + return NO; + } else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) { + NSDictionary *userInfo = [NSDictionary dictionaryWithObject:NSLocalizedStringFromTable(@"File URL not reachable.", @"AFNetworking", nil) forKey:NSLocalizedFailureReasonErrorKey]; + if (error != NULL) { + *error = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; + } + + return NO; + } + + NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; + [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; + + AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; + bodyPart.stringEncoding = self.stringEncoding; + bodyPart.headers = mutableHeaders; + bodyPart.body = fileURL; + + NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:nil]; + bodyPart.bodyContentLength = [[fileAttributes objectForKey:NSFileSize] unsignedLongLongValue]; + + [self.bodyStream appendHTTPBodyPart:bodyPart]; + + return YES; +} + + +- (void)appendPartWithInputStream:(NSInputStream *)inputStream + name:(NSString *)name + fileName:(NSString *)fileName + length:(int64_t)length + mimeType:(NSString *)mimeType +{ + NSParameterAssert(name); + NSParameterAssert(fileName); + NSParameterAssert(mimeType); + + NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; + [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; + + + AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; + bodyPart.stringEncoding = self.stringEncoding; + bodyPart.headers = mutableHeaders; + bodyPart.body = inputStream; + + bodyPart.bodyContentLength = length; + + [self.bodyStream appendHTTPBodyPart:bodyPart]; +} + +- (void)appendPartWithFileData:(NSData *)data + name:(NSString *)name + fileName:(NSString *)fileName + mimeType:(NSString *)mimeType +{ + NSParameterAssert(name); + NSParameterAssert(fileName); + NSParameterAssert(mimeType); + + NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; + [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; + + [self appendPartWithHeaders:mutableHeaders body:data]; +} + +- (void)appendPartWithFormData:(NSData *)data + name:(NSString *)name +{ + NSParameterAssert(name); + + NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"]; + + [self appendPartWithHeaders:mutableHeaders body:data]; +} + +- (void)appendPartWithHeaders:(NSDictionary *)headers + body:(NSData *)body +{ + NSParameterAssert(body); + + AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; + bodyPart.stringEncoding = self.stringEncoding; + bodyPart.headers = headers; + bodyPart.bodyContentLength = [body length]; + bodyPart.body = body; + + [self.bodyStream appendHTTPBodyPart:bodyPart]; +} + +- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes + delay:(NSTimeInterval)delay +{ + self.bodyStream.numberOfBytesInPacket = numberOfBytes; + self.bodyStream.delay = delay; +} + +- (NSMutableURLRequest *)requestByFinalizingMultipartFormData { + if ([self.bodyStream isEmpty]) { + return self.request; + } + + // Reset the initial and final boundaries to ensure correct Content-Length + [self.bodyStream setInitialAndFinalBoundaries]; + + [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", kAFMultipartFormBoundary] forHTTPHeaderField:@"Content-Type"]; + [self.request setValue:[NSString stringWithFormat:@"%llu", [self.bodyStream contentLength]] forHTTPHeaderField:@"Content-Length"]; + [self.request setHTTPBodyStream:self.bodyStream]; + + return self.request; +} + +@end + +#pragma mark - + +@interface AFMultipartBodyStream () +@property (nonatomic, assign) NSStreamStatus streamStatus; +@property (nonatomic, strong) NSError *streamError; +@property (nonatomic, assign) NSStringEncoding stringEncoding; +@property (nonatomic, strong) NSMutableArray *HTTPBodyParts; +@property (nonatomic, strong) NSEnumerator *HTTPBodyPartEnumerator; +@property (nonatomic, strong) AFHTTPBodyPart *currentHTTPBodyPart; +@property (nonatomic, strong) NSOutputStream *outputStream; +@property (nonatomic, strong) NSMutableData *buffer; +@end + +@implementation AFMultipartBodyStream + +- (id)initWithStringEncoding:(NSStringEncoding)encoding { + self = [super init]; + if (!self) { + return nil; + } + + self.stringEncoding = encoding; + self.HTTPBodyParts = [NSMutableArray array]; + self.numberOfBytesInPacket = NSIntegerMax; + + return self; +} + +- (void)setInitialAndFinalBoundaries { + if ([self.HTTPBodyParts count] > 0) { + for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { + bodyPart.hasInitialBoundary = NO; + bodyPart.hasFinalBoundary = NO; + } + + [[self.HTTPBodyParts objectAtIndex:0] setHasInitialBoundary:YES]; + [[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES]; + } +} + +- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart { + [self.HTTPBodyParts addObject:bodyPart]; +} + +- (BOOL)isEmpty { + return [self.HTTPBodyParts count] == 0; +} + +#pragma mark - NSInputStream + +- (NSInteger)read:(uint8_t *)buffer + maxLength:(NSUInteger)length +{ + if ([self streamStatus] == NSStreamStatusClosed) { + return 0; + } + + NSInteger totalNumberOfBytesRead = 0; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) { + if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) { + if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) { + break; + } + } else { + NSUInteger maxLength = length - (NSUInteger)totalNumberOfBytesRead; + NSInteger numberOfBytesRead = [self.currentHTTPBodyPart read:&buffer[totalNumberOfBytesRead] maxLength:maxLength]; + if (numberOfBytesRead == -1) { + self.streamError = self.currentHTTPBodyPart.inputStream.streamError; + break; + } else { + totalNumberOfBytesRead += numberOfBytesRead; + + if (self.delay > 0.0f) { + [NSThread sleepForTimeInterval:self.delay]; + } + } + } + } +#pragma clang diagnostic pop + + return totalNumberOfBytesRead; +} + +- (BOOL)getBuffer:(__unused uint8_t **)buffer + length:(__unused NSUInteger *)len +{ + return NO; +} + +- (BOOL)hasBytesAvailable { + return [self streamStatus] == NSStreamStatusOpen; +} + +#pragma mark - NSStream + +- (void)open { + if (self.streamStatus == NSStreamStatusOpen) { + return; + } + + self.streamStatus = NSStreamStatusOpen; + + [self setInitialAndFinalBoundaries]; + self.HTTPBodyPartEnumerator = [self.HTTPBodyParts objectEnumerator]; +} + +- (void)close { + self.streamStatus = NSStreamStatusClosed; +} + +- (id)propertyForKey:(__unused NSString *)key { + return nil; +} + +- (BOOL)setProperty:(__unused id)property + forKey:(__unused NSString *)key +{ + return NO; +} + +- (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop + forMode:(__unused NSString *)mode +{} + +- (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop + forMode:(__unused NSString *)mode +{} + +- (unsigned long long)contentLength { + unsigned long long length = 0; + for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { + length += [bodyPart contentLength]; + } + + return length; +} + +#pragma mark - Undocumented CFReadStream Bridged Methods + +- (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop + forMode:(__unused CFStringRef)aMode +{} + +- (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop + forMode:(__unused CFStringRef)aMode +{} + +- (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags + callback:(__unused CFReadStreamClientCallBack)inCallback + context:(__unused CFStreamClientContext *)inContext { + return NO; +} + +#pragma mark - NSCopying + +-(id)copyWithZone:(NSZone *)zone { + AFMultipartBodyStream *bodyStreamCopy = [[[self class] allocWithZone:zone] initWithStringEncoding:self.stringEncoding]; + + for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { + [bodyStreamCopy appendHTTPBodyPart:[bodyPart copy]]; + } + + [bodyStreamCopy setInitialAndFinalBoundaries]; + + return bodyStreamCopy; +} + +@end + +#pragma mark - + +typedef enum { + AFEncapsulationBoundaryPhase = 1, + AFHeaderPhase = 2, + AFBodyPhase = 3, + AFFinalBoundaryPhase = 4, +} AFHTTPBodyPartReadPhase; + +@interface AFHTTPBodyPart () { + AFHTTPBodyPartReadPhase _phase; + NSInputStream *_inputStream; + unsigned long long _phaseReadOffset; +} + +- (BOOL)transitionToNextPhase; +- (NSInteger)readData:(NSData *)data + intoBuffer:(uint8_t *)buffer + maxLength:(NSUInteger)length; +@end + +@implementation AFHTTPBodyPart + +- (id)init { + self = [super init]; + if (!self) { + return nil; + } + + [self transitionToNextPhase]; + + return self; +} + +- (void)dealloc { + if (_inputStream) { + [_inputStream close]; + _inputStream = nil; + } +} + +- (NSInputStream *)inputStream { + if (!_inputStream) { + if ([self.body isKindOfClass:[NSData class]]) { + _inputStream = [NSInputStream inputStreamWithData:self.body]; + } else if ([self.body isKindOfClass:[NSURL class]]) { + _inputStream = [NSInputStream inputStreamWithURL:self.body]; + } else if ([self.body isKindOfClass:[NSInputStream class]]) { + _inputStream = self.body; + } + } + + return _inputStream; +} + +- (NSString *)stringForHeaders { + NSMutableString *headerString = [NSMutableString string]; + for (NSString *field in [self.headers allKeys]) { + [headerString appendString:[NSString stringWithFormat:@"%@: %@%@", field, [self.headers valueForKey:field], kAFMultipartFormCRLF]]; + } + [headerString appendString:kAFMultipartFormCRLF]; + + return [NSString stringWithString:headerString]; +} + +- (unsigned long long)contentLength { + unsigned long long length = 0; + + NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary() : AFMultipartFormEncapsulationBoundary()) dataUsingEncoding:self.stringEncoding]; + length += [encapsulationBoundaryData length]; + + NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding]; + length += [headersData length]; + + length += _bodyContentLength; + + NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary() dataUsingEncoding:self.stringEncoding] : [NSData data]); + length += [closingBoundaryData length]; + + return length; +} + +- (BOOL)hasBytesAvailable { + // Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the available buffer + if (_phase == AFFinalBoundaryPhase) { + return YES; + } + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcovered-switch-default" + switch (self.inputStream.streamStatus) { + case NSStreamStatusNotOpen: + case NSStreamStatusOpening: + case NSStreamStatusOpen: + case NSStreamStatusReading: + case NSStreamStatusWriting: + return YES; + case NSStreamStatusAtEnd: + case NSStreamStatusClosed: + case NSStreamStatusError: + default: + return NO; + } +#pragma clang diagnostic pop +} + +- (NSInteger)read:(uint8_t *)buffer + maxLength:(NSUInteger)length +{ + NSInteger totalNumberOfBytesRead = 0; + + if (_phase == AFEncapsulationBoundaryPhase) { + NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary() : AFMultipartFormEncapsulationBoundary()) dataUsingEncoding:self.stringEncoding]; + totalNumberOfBytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; + } + + if (_phase == AFHeaderPhase) { + NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding]; + totalNumberOfBytesRead += [self readData:headersData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; + } + + if (_phase == AFBodyPhase) { + NSInteger numberOfBytesRead = 0; + + numberOfBytesRead = [self.inputStream read:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; + if (numberOfBytesRead == -1) { + return -1; + } else { + totalNumberOfBytesRead += numberOfBytesRead; + + if ([self.inputStream streamStatus] >= NSStreamStatusAtEnd) { + [self transitionToNextPhase]; + } + } + } + + if (_phase == AFFinalBoundaryPhase) { + NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary() dataUsingEncoding:self.stringEncoding] : [NSData data]); + totalNumberOfBytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; + } + + return totalNumberOfBytesRead; +} + +- (NSInteger)readData:(NSData *)data + intoBuffer:(uint8_t *)buffer + maxLength:(NSUInteger)length +{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length)); + [data getBytes:buffer range:range]; +#pragma clang diagnostic pop + + _phaseReadOffset += range.length; + + if (((NSUInteger)_phaseReadOffset) >= [data length]) { + [self transitionToNextPhase]; + } + + return (NSInteger)range.length; +} + +- (BOOL)transitionToNextPhase { + if (![[NSThread currentThread] isMainThread]) { + [self performSelectorOnMainThread:@selector(transitionToNextPhase) withObject:nil waitUntilDone:YES]; + return YES; + } + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcovered-switch-default" + switch (_phase) { + case AFEncapsulationBoundaryPhase: + _phase = AFHeaderPhase; + break; + case AFHeaderPhase: + [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; + [self.inputStream open]; + _phase = AFBodyPhase; + break; + case AFBodyPhase: + [self.inputStream close]; + _phase = AFFinalBoundaryPhase; + break; + case AFFinalBoundaryPhase: + default: + _phase = AFEncapsulationBoundaryPhase; + break; + } + _phaseReadOffset = 0; +#pragma clang diagnostic pop + + return YES; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFHTTPBodyPart *bodyPart = [[[self class] allocWithZone:zone] init]; + + bodyPart.stringEncoding = self.stringEncoding; + bodyPart.headers = self.headers; + bodyPart.bodyContentLength = self.bodyContentLength; + bodyPart.body = self.body; + + return bodyPart; +} + +@end + +#pragma mark - + +@implementation AFJSONRequestSerializer + ++ (instancetype)serializer { + return [self serializerWithWritingOptions:0]; +} + ++ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions +{ + AFJSONRequestSerializer *serializer = [[self alloc] init]; + serializer.writingOptions = writingOptions; + + return serializer; +} + +#pragma mark - AFURLRequestSerialization + +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(NSDictionary *)parameters + error:(NSError *__autoreleasing *)error +{ + NSParameterAssert(request); + + if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } + + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { + if (![request valueForHTTPHeaderField:field]) { + [mutableRequest setValue:value forHTTPHeaderField:field]; + } + }]; + + if (!parameters) { + return mutableRequest; + } + + NSString *charset = (__bridge NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)); + + [mutableRequest setValue:[NSString stringWithFormat:@"application/json; charset=%@", charset] forHTTPHeaderField:@"Content-Type"]; + [mutableRequest setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error]]; + + return mutableRequest; +} + +@end + +#pragma mark - + +@implementation AFPropertyListRequestSerializer + ++ (instancetype)serializer { + return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 writeOptions:0]; +} + ++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format + writeOptions:(NSPropertyListWriteOptions)writeOptions +{ + AFPropertyListRequestSerializer *serializer = [[self alloc] init]; + serializer.format = format; + serializer.writeOptions = writeOptions; + + return serializer; +} + +#pragma mark - AFURLRequestSerializer + +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(NSDictionary *)parameters + error:(NSError *__autoreleasing *)error +{ + NSParameterAssert(request); + + if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } + + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { + if (![request valueForHTTPHeaderField:field]) { + [mutableRequest setValue:value forHTTPHeaderField:field]; + } + }]; + + NSString *charset = (__bridge NSString *)CFStringConvertEncodingToIANACharSetName(CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)); + + [mutableRequest setValue:[NSString stringWithFormat:@"application/x-plist; charset=%@", charset] forHTTPHeaderField:@"Content-Type"]; + [mutableRequest setHTTPBody:[NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error]]; + + return mutableRequest; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (!self) { + return nil; + } + + self.format = (NSPropertyListFormat)[aDecoder decodeIntegerForKey:@"format"]; + self.writeOptions = [aDecoder decodeIntegerForKey:@"writeOptions"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + + [aCoder encodeInteger:self.format forKey:@"format"]; + [aCoder encodeInteger:(NSInteger)self.writeOptions forKey:@"writeOptions"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFPropertyListRequestSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.format = self.format; + serializer.writeOptions = self.writeOptions; + + return serializer; +} + +@end diff --git a/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h b/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h new file mode 100644 index 0000000..7728089 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.h @@ -0,0 +1,257 @@ +// AFSerialization.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import + +/** + The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data. + + For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object. + */ +@protocol AFURLResponseSerialization + +/** + The response object decoded from the data associated with a specified response. + + @param response The response to be processed. + @param data The response data to be decoded. + @param error The error that occurred while attempting to decode the response data. + + @return The object decoded from the specified response data. + */ +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error; + +@end + +#pragma mark - + +/** + `AFHTTPSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation. + + Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPSerializer` in order to ensure consistent default behavior. + */ +@interface AFHTTPResponseSerializer : NSObject + +/** + The string encoding used to serialize parameters. + */ +@property (nonatomic, assign) NSStringEncoding stringEncoding; + +/** + Creates and returns a serializer with default configuration. + */ ++ (instancetype)serializer; + +///----------------------------------------- +/// @name Configuring Response Serialization +///----------------------------------------- + +/** + The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation. + + See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html + */ +@property (nonatomic, strong) NSIndexSet *acceptableStatusCodes; + +/** + The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation. + */ +@property (nonatomic, strong) NSSet *acceptableContentTypes; + +/** + Validates the specified response and data. + + In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks. + + @param response The response to be validated. + @param data The data associated with the response. + @param error The error that occurred while attempting to validate the response. + + @return `YES` if the response is valid, otherwise `NO`. + */ +- (BOOL)validateResponse:(NSHTTPURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error; + +@end + +#pragma mark - + + +/** + `AFJSONSerializer` is a subclass of `AFHTTPSerializer` that validates and decodes JSON responses. + + By default, `AFJSONSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types: + + - `application/json` + - `text/json` + - `text/javascript` + */ +@interface AFJSONResponseSerializer : AFHTTPResponseSerializer + +/** + Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. + */ +@property (nonatomic, assign) NSJSONReadingOptions readingOptions; + +/** + Creates and returns a JSON serializer with specified reading and writing options. + + @param readingOptions The specified JSON reading options. + */ ++ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions; + +@end + +#pragma mark - + +/** + `AFXMLParserSerializer` is a subclass of `AFHTTPSerializer` that validates and decodes XML responses as an `NSXMLParser` objects. + + By default, `AFXMLParserSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: + + - `application/xml` + - `text/xml` + */ +@interface AFXMLParserResponseSerializer : AFHTTPResponseSerializer + +@end + +#pragma mark - + +#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED + +/** + `AFXMLDocumentSerializer` is a subclass of `AFHTTPSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. + + By default, `AFXMLDocumentSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: + + - `application/xml` + - `text/xml` + */ +@interface AFXMLDocumentResponseSerializer : AFHTTPResponseSerializer + +/** + Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. + */ +@property (nonatomic, assign) NSUInteger options; + +/** + Creates and returns an XML document serializer with the specified options. + + @param mask The XML document options. + */ ++ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask; + +@end + +#endif + +#pragma mark - + +/** + `AFPropertyListSerializer` is a subclass of `AFHTTPSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. + + By default, `AFPropertyListSerializer` accepts the following MIME types: + + - `application/x-plist` + */ +@interface AFPropertyListResponseSerializer : AFHTTPResponseSerializer + +/** + The property list format. Possible values are described in "NSPropertyListFormat". + */ +@property (nonatomic, assign) NSPropertyListFormat format; + +/** + The property list reading options. Possible values are described in "NSPropertyListMutabilityOptions." + */ +@property (nonatomic, assign) NSPropertyListReadOptions readOptions; + +/** + Creates and returns a property list serializer with a specified format, read options, and write options. + + @param format The property list format. + @param readOptions The property list reading options. + */ ++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format + readOptions:(NSPropertyListReadOptions)readOptions; + +@end + +#pragma mark - + +/** + `AFImageSerializer` is a subclass of `AFHTTPSerializer` that validates and decodes image responses. + + By default, `AFImageSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage: + + - `image/tiff` + - `image/jpeg` + - `image/gif` + - `image/png` + - `image/ico` + - `image/x-icon` + - `image/bmp` + - `image/x-bmp` + - `image/x-xbitmap` + - `image/x-win-bitmap` + */ +@interface AFImageResponseSerializer : AFHTTPResponseSerializer + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +/** + The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance. + */ +@property (nonatomic, assign) CGFloat imageScale; + +/** + Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default. + */ +@property (nonatomic, assign) BOOL automaticallyInflatesResponseImage; +#endif + +@end + +#pragma mark - + +/** + `AFCompoundSerializer` is a subclass of `AFHTTPSerializer` that delegates the response serialization to the first `AFHTTPSerializer` object that returns `YES` to `validateResponse:data:error:`, falling back on the default behavior of `AFHTTPSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer. + */ +@interface AFCompoundResponseSerializer : AFHTTPResponseSerializer + +/** + The component response serializers. + */ +@property (readonly, nonatomic, strong) NSArray *responseSerializers; + +/** + Creates and returns a compound serializer comprised of the specified response serializers. + + @warning Each response serializer specified must be a subclass of `AFHTTPSerializer`, and response to `-validateResponse:data:error:`. + */ ++ (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers; + +@end diff --git a/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m b/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m new file mode 100644 index 0000000..e9bc657 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFURLResponseSerialization.m @@ -0,0 +1,691 @@ +// AFSerialization.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFURLResponseSerialization.h" + +extern NSString * const AFNetworkingErrorDomain; +extern NSString * const AFNetworkingOperationFailingURLResponseErrorKey; + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +#import +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +#import +#endif + +@implementation AFHTTPResponseSerializer + ++ (instancetype)serializer { + return [[self alloc] init]; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.stringEncoding = NSUTF8StringEncoding; + + self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)]; + self.acceptableContentTypes = nil; + + return self; +} + +#pragma mark - + +- (BOOL)validateResponse:(NSHTTPURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (response && [response isKindOfClass:[NSHTTPURLResponse class]]) { + if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode]) { + NSDictionary *userInfo = @{ + NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%d)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], response.statusCode], + NSURLErrorFailingURLErrorKey:[response URL], + AFNetworkingOperationFailingURLResponseErrorKey: response + }; + if (error) { + *error = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorBadServerResponse userInfo:userInfo]; + } + + return NO; + } else if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]]) { + // Don't invalidate content type if there is no content + if ([data length] > 0) { + NSDictionary *userInfo = @{ + NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: unacceptable content-type: %@", @"AFNetworking", nil), [response MIMEType]], + NSURLErrorFailingURLErrorKey:[response URL], + AFNetworkingOperationFailingURLResponseErrorKey: response + }; + if (error) { + *error = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo]; + } + + return NO; + } + } + } + + return YES; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + [self validateResponse:(NSHTTPURLResponse *)response data:data error:error]; + + return data; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [self init]; + if (!self) { + return nil; + } + + self.acceptableStatusCodes = [aDecoder decodeObjectForKey:@"acceptableStatusCodes"]; + self.acceptableContentTypes = [aDecoder decodeObjectForKey:@"acceptableContentTypes"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [aCoder encodeObject:self.acceptableStatusCodes forKey:@"acceptableStatusCodes"]; + [aCoder encodeObject:self.acceptableContentTypes forKey:@"acceptableContentTypes"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFHTTPResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.acceptableStatusCodes = [self.acceptableStatusCodes copyWithZone:zone]; + serializer.acceptableContentTypes = [self.acceptableContentTypes copyWithZone:zone]; + + return serializer; +} + +@end + +#pragma mark - + +@implementation AFJSONResponseSerializer + ++ (instancetype)serializer { + return [self serializerWithReadingOptions:0]; +} + ++ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions { + AFJSONResponseSerializer *serializer = [[self alloc] init]; + serializer.readingOptions = readingOptions; + + return serializer; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil]; + + return self; +} + +#pragma mark - AFURLRequestSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if ([(NSError *)(*error) code] == NSURLErrorCannotDecodeContentData) { + return nil; + } + } + + // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization. + // See https://github.com/rails/rails/issues/1742 + NSStringEncoding stringEncoding = self.stringEncoding; + if (response.textEncodingName) { + CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName); + if (encoding != kCFStringEncodingInvalidId) { + stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding); + } + } + + NSString *responseString = [[NSString alloc] initWithData:data encoding:stringEncoding]; + if (responseString && ![responseString isEqualToString:@" "]) { + // Workaround for a bug in NSJSONSerialization when Unicode character escape codes are used instead of the actual character + // See http://stackoverflow.com/a/12843465/157142 + data = [responseString dataUsingEncoding:NSUTF8StringEncoding]; + + if (data) { + if ([data length] > 0) { + return [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:error]; + } else { + return nil; + } + } else { + NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; + [userInfo setValue:NSLocalizedStringFromTable(@"Data failed decoding as a UTF-8 string", nil, @"AFNetworking") forKey:NSLocalizedDescriptionKey]; + [userInfo setValue:[NSString stringWithFormat:NSLocalizedStringFromTable(@"Could not decode string: %@", nil, @"AFNetworking"), responseString] forKey:NSLocalizedFailureReasonErrorKey]; + if (error) { + *error = [[NSError alloc] initWithDomain:AFNetworkingErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:userInfo]; + } + } + } + + return nil; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (!self) { + return nil; + } + + self.readingOptions = [aDecoder decodeIntegerForKey:@"readingOptions"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + + [aCoder encodeInteger:self.readingOptions forKey:@"readingOptions"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFJSONResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.readingOptions = self.readingOptions; + + return serializer; +} + +@end + +#pragma mark - + +@implementation AFXMLParserResponseSerializer + ++ (instancetype)serializer { + AFXMLParserResponseSerializer *serializer = [[self alloc] init]; + + return serializer; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil]; + + return self; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSHTTPURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if ([(NSError *)(*error) code] == NSURLErrorCannotDecodeContentData) { + return nil; + } + } + + return [[NSXMLParser alloc] initWithData:data]; +} + +@end + +#pragma mark - + +#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED + +@implementation AFXMLDocumentResponseSerializer + ++ (instancetype)serializer { + return [self serializerWithXMLDocumentOptions:0]; +} + ++ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask { + AFXMLDocumentResponseSerializer *serializer = [[self alloc] init]; + serializer.options = mask; + + return serializer; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil]; + + return self; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if ([(NSError *)(*error) code] == NSURLErrorCannotDecodeContentData) { + return nil; + } + } + + return [[NSXMLDocument alloc] initWithData:data options:self.options error:error]; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (!self) { + return nil; + } + + self.options = [aDecoder decodeIntegerForKey:@"options"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + + [aCoder encodeInteger:self.options forKey:@"options"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFXMLDocumentResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.options = self.options; + + return serializer; +} + +@end + +#endif + +#pragma mark - + +@implementation AFPropertyListResponseSerializer + ++ (instancetype)serializer { + return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 readOptions:0]; +} + ++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format + readOptions:(NSPropertyListReadOptions)readOptions +{ + AFPropertyListResponseSerializer *serializer = [[self alloc] init]; + serializer.format = format; + serializer.readOptions = readOptions; + + return serializer; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/x-plist", nil]; + + return self; +} + ++ (NSSet *)acceptablePathExtensions { + static NSSet * _acceptablePathExtension = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _acceptablePathExtension = [[NSSet alloc] initWithObjects:@"plist", nil]; + }); + + return _acceptablePathExtension; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if ([(NSError *)(*error) code] == NSURLErrorCannotDecodeContentData) { + return nil; + } + } + + return [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:error]; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (!self) { + return nil; + } + + self.format = (NSPropertyListFormat)[aDecoder decodeIntegerForKey:@"format"]; + self.readOptions = [aDecoder decodeIntegerForKey:@"readOptions"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + + [aCoder encodeInteger:self.format forKey:@"format"]; + [aCoder encodeInteger:(NSInteger)self.readOptions forKey:@"readOptions"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFPropertyListResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.format = self.format; + serializer.readOptions = self.readOptions; + + return serializer; +} + +@end + +#pragma mark - + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +#import + +static UIImage * AFImageWithDataAtScale(NSData *data, CGFloat scale) { + UIImage *image = [[UIImage alloc] initWithData:data]; + + return [[UIImage alloc] initWithCGImage:[image CGImage] scale:scale orientation:image.imageOrientation]; +} + +static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *response, NSData *data, CGFloat scale) { + if (!data || [data length] == 0) { + return nil; + } + + CGImageRef imageRef = nil; + CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data); + + if ([response.MIMEType isEqualToString:@"image/png"]) { + imageRef = CGImageCreateWithPNGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault); + } else if ([response.MIMEType isEqualToString:@"image/jpeg"]) { + imageRef = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault); + } + + if (!imageRef) { + UIImage *image = AFImageWithDataAtScale(data, scale); + if (image.images) { + CGDataProviderRelease(dataProvider); + + return image; + } + + imageRef = CGImageCreateCopy([image CGImage]); + } + + CGDataProviderRelease(dataProvider); + + if (!imageRef) { + return nil; + } + + size_t width = CGImageGetWidth(imageRef); + size_t height = CGImageGetHeight(imageRef); + + if (width * height > 1024 * 1024) { + CGImageRelease(imageRef); + + return AFImageWithDataAtScale(data, scale); + } + + size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef); + size_t bytesPerRow = 0; // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate() + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); + + if (CGColorSpaceGetNumberOfComponents(colorSpace) == 3) { + uint32_t alpha = (bitmapInfo & kCGBitmapAlphaInfoMask); + if (alpha == kCGImageAlphaNone) { + bitmapInfo &= ~kCGBitmapAlphaInfoMask; + bitmapInfo |= kCGImageAlphaNoneSkipFirst; + } else if (!(alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast)) { + bitmapInfo &= ~kCGBitmapAlphaInfoMask; + bitmapInfo |= kCGImageAlphaPremultipliedFirst; + } + } + + CGContextRef context = CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo); + + CGColorSpaceRelease(colorSpace); + + if (!context) { + CGImageRelease(imageRef); + + return AFImageWithDataAtScale(data, scale); + } + + CGRect rect = CGRectMake(0.0f, 0.0f, width, height); + CGContextDrawImage(context, rect, imageRef); + CGImageRef inflatedImageRef = CGBitmapContextCreateImage(context); + CGContextRelease(context); + + UIImage *inflatedImage = [[UIImage alloc] initWithCGImage:inflatedImageRef scale:scale orientation:UIImageOrientationUp]; + CGImageRelease(inflatedImageRef); + CGImageRelease(imageRef); + + return inflatedImage; +} +#endif + + +@implementation AFImageResponseSerializer + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"image/tiff", @"image/jpeg", @"image/gif", @"image/png", @"image/ico", @"image/x-icon", @"image/bmp", @"image/x-bmp", @"image/x-xbitmap", @"image/x-win-bitmap", nil]; + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + self.imageScale = [[UIScreen mainScreen] scale]; + self.automaticallyInflatesResponseImage = YES; +#endif + + return self; +} + ++ (NSSet *)acceptablePathExtensions { + static NSSet * _acceptablePathExtension = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _acceptablePathExtension = [[NSSet alloc] initWithObjects:@"tif", @"tiff", @"jpg", @"jpeg", @"gif", @"png", @"ico", @"bmp", @"cur", nil]; + }); + + return _acceptablePathExtension; +} + +#pragma mark - AFURLResponseSerializer + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if ([(NSError *)(*error) code] == NSURLErrorCannotDecodeContentData) { + return nil; + } + } + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + if (self.automaticallyInflatesResponseImage) { + return AFInflatedImageFromResponseWithDataAtScale((NSHTTPURLResponse *)response, data, self.imageScale); + } else { + return AFImageWithDataAtScale(data, self.imageScale); + } +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) + // Ensure that the image is set to it's correct pixel width and height + NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:data]; + NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])]; + [image addRepresentation:bitimage]; + + return image; +#endif + + return nil; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (!self) { + return nil; + } + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + self.imageScale = [aDecoder decodeFloatForKey:@"imageScale"]; + self.automaticallyInflatesResponseImage = [aDecoder decodeBoolForKey:@"automaticallyInflatesResponseImage"]; +#endif + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + [aCoder encodeFloat:self.imageScale forKey:@"imageScale"]; + [aCoder encodeBool:self.automaticallyInflatesResponseImage forKey:@"automaticallyInflatesResponseImage"]; +#endif +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFImageResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + serializer.imageScale = self.imageScale; + serializer.automaticallyInflatesResponseImage = self.automaticallyInflatesResponseImage; +#endif + + return serializer; +} + +@end + +#pragma mark - + +@interface AFCompoundResponseSerializer () +@property (readwrite, nonatomic, strong) NSArray *responseSerializers; +@end + +@implementation AFCompoundResponseSerializer + ++ (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers { + AFCompoundResponseSerializer *serializer = [[self alloc] init]; + serializer.responseSerializers = responseSerializers; + + return serializer; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + for (id serializer in self.responseSerializers) { + if (![serializer isKindOfClass:[AFHTTPResponseSerializer class]]) { + continue; + } + + NSError *serializerError = nil; + id responseObject = [serializer responseObjectForResponse:response data:data error:&serializerError]; + if (responseObject) { + *error = serializerError; + return responseObject; + } + } + + return [super responseObjectForResponse:response data:data error:error]; +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + self = [super initWithCoder:aDecoder]; + if (!self) { + return nil; + } + + self.responseSerializers = [aDecoder decodeObjectForKey:@"responseSerializers"]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [super encodeWithCoder:aCoder]; + + [aCoder encodeObject:self.responseSerializers forKey:@"responseSerializers"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + AFCompoundResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.responseSerializers = self.responseSerializers; + + return serializer; +} + +@end diff --git a/Pods/AFNetworking/AFNetworking/AFURLSessionManager.h b/Pods/AFNetworking/AFNetworking/AFURLSessionManager.h new file mode 100644 index 0000000..bff9640 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFURLSessionManager.h @@ -0,0 +1,434 @@ +// AFURLSessionManager.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import "AFURLResponseSerialization.h" +#import "AFURLRequestSerialization.h" +#import "AFSecurityPolicy.h" +#import "AFNetworkReachabilityManager.h" + +/** + `AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``. + + ## Subclassing Notes + + This is the base class for `AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `AFURLSessionManager` specifically for HTTP, consider subclassing `AFHTTPSessionManager` instead. + + ## NSURLSession & NSURLSessionTask Delegate Methods + + `AFURLSessionManager` implements the following delegate methods: + + ### `NSURLSessionDelegate` + + - `URLSession:didBecomeInvalidWithError:` + - `URLSession:didReceiveChallenge:completionHandler:` + + ### `NSURLSessionTaskDelegate` + + - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:` + - `URLSession:task:didReceiveChallenge:completionHandler:` + - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:` + - `URLSession:task:didCompleteWithError:` + + ### `NSURLSessionDataDelegate` + + - `URLSession:dataTask:didReceiveResponse:completionHandler:` + - `URLSession:dataTask:didBecomeDownloadTask:` + - `URLSession:dataTask:didReceiveData:` + - `URLSession:dataTask:willCacheResponse:completionHandler:` + - `URLSessionDidFinishEventsForBackgroundURLSession:` + + ### `NSURLSessionDownloadDelegate` + + - `URLSession:downloadTask:didFinishDownloadingToURL:` + - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:` + - `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:` + + If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first. + + ## Network Reachability Monitoring + + Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details. + + ## NSCoding Caveats + + - Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using `-initWithCoder:` or `NSKeyedUnarchiver`. + + ## NSCopying Caveats + + - `-copy` and `-copyWithZone:` return a new manager with a new `NSURLSession` created from the configuration of the original. + - Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ session manager when copied. + */ + +#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) + +@interface AFURLSessionManager : NSObject + +/** + The managed session. + */ +@property (readonly, nonatomic, strong) NSURLSession *session; + +/** + The operation queue on which delegate callbacks are run. + */ +@property (readonly, nonatomic, strong) NSOperationQueue *operationQueue; + +/** + Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`. + + @warning `responseSerializer` must not be `nil`. + */ +@property (nonatomic, strong) id responseSerializer; + +///------------------------------- +/// @name Managing Security Policy +///------------------------------- + +/** + The security policy used by created request operations to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. + */ +@property (nonatomic, strong) AFSecurityPolicy *securityPolicy; + +///-------------------------------------- +/// @name Monitoring Network Reachability +///-------------------------------------- + +/** + The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default. + */ +@property (readonly, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager; + +///---------------------------- +/// @name Getting Session Tasks +///---------------------------- + +/** + The data, upload, and download tasks currently run by the managed session. + */ +@property (readonly, nonatomic, strong) NSArray *tasks; + +/** + The data tasks currently run by the managed session. + */ +@property (readonly, nonatomic, strong) NSArray *dataTasks; + +/** + The upload tasks currently run by the managed session. + */ +@property (readonly, nonatomic, strong) NSArray *uploadTasks; + +/** + The download tasks currently run by the managed session. + */ +@property (readonly, nonatomic, strong) NSArray *downloadTasks; + +///--------------------------------- +/// @name Managing Callback Queues +///--------------------------------- + +/** + The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used. + */ +@property (nonatomic, strong) dispatch_queue_t completionQueue; + +/** + The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used. + */ +@property (nonatomic, strong) dispatch_group_t completionGroup; + +///--------------------- +/// @name Initialization +///--------------------- + +/** + Creates and returns a manager for a session created with the specified configuration. This is the designated initializer. + + @param configuration The configuration used to create the managed session. + + @return A manager for a newly-created session. + */ +- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration; + +/** + Invalidates the managed session, optionally canceling pending tasks. + + @param cancelPendingTasks Whether or not to cancel pending tasks. + */ +- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks; + +///------------------------- +/// @name Running Data Tasks +///------------------------- + +/** + Creates an `NSURLSessionDataTask` with the specified request. + + @param request The HTTP request for the request. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + */ +- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler; + +///--------------------------- +/// @name Running Upload Tasks +///--------------------------- + +/** + Creates an `NSURLSessionUploadTask` with the specified request for a local file. + + @param request The HTTP request for the request. + @param fileURL A URL to the local file to be uploaded. + @param progress A progress object monitoring the current upload progress. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + */ +- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request + fromFile:(NSURL *)fileURL + progress:(NSProgress * __autoreleasing *)progress + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler; + +/** + Creates an `NSURLSessionUploadTask` with the specified request for an HTTP body. + + @param request The HTTP request for the request. + @param bodyData A data object containing the HTTP body to be uploaded. + @param progress A progress object monitoring the current upload progress. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + */ +- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request + fromData:(NSData *)bodyData + progress:(NSProgress * __autoreleasing *)progress + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler; + +/** + Creates an `NSURLSessionUploadTask` with the specified streaming request. + + @param request The HTTP request for the request. + @param progress A progress object monitoring the current upload progress. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + */ +- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request + progress:(NSProgress * __autoreleasing *)progress + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler; + +///----------------------------- +/// @name Running Download Tasks +///----------------------------- + +/** + Creates an `NSURLSessionDownloadTask` with the specified request. + + @param request The HTTP request for the request. + @param progress A progress object monitoring the current download progress. + @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. + @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. + */ +- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request + progress:(NSProgress * __autoreleasing *)progress + destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler; + +/** + Creates an `NSURLSessionDownloadTask` with the specified resume data. + + @param resumeData The data used to resume downloading. + @param progress A progress object monitoring the current download progress. + @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. + @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. + */ +- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData + progress:(NSProgress * __autoreleasing *)progress + destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler; + +///----------------------------------------- +/// @name Setting Session Delegate Callbacks +///----------------------------------------- + +/** + Sets a block to be executed when the managed session becomes invalid, as handled by the `NSURLSessionDelegate` method `URLSession:didBecomeInvalidWithError:`. + + @param block A block object to be executed when the managed session becomes invalid. The block has no return value, and takes two arguments: the session, and the error related to the cause of invalidation. + */ +- (void)setSessionDidBecomeInvalidBlock:(void (^)(NSURLSession *session, NSError *error))block; + +/** + Sets a block to be executed when a connection level authentication challenge has occurred, as handled by the `NSURLSessionDelegate` method `URLSession:didReceiveChallenge:completionHandler:`. + + @param block A block object to be executed when a connection level authentication challenge has occurred. The block returns the disposition of the authentication challenge, and takes three arguments: the session, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. + */ +- (void)setSessionDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block; + +///-------------------------------------- +/// @name Setting Task Delegate Callbacks +///-------------------------------------- + +/** + Sets a block to be executed when an HTTP request is attempting to perform a redirection to a different URL, as handled by the `NSURLSessionTaskDelegate` method `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`. + + @param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response. + */ +- (void)setTaskWillPerformHTTPRedirectionBlock:(NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block; + +/** + Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`. + + @param block A block object to be executed when a session task has received a request specific authentication challenge. The block returns the disposition of the authentication challenge, and takes four arguments: the session, the task, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. + */ +- (void)setTaskDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block; + +/** + Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`. + + @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread. + */ +- (void)setTaskDidSendBodyDataBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block; + +/** + Sets a block to be executed as the last message related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didCompleteWithError:`. + + @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task. + */ +- (void)setTaskDidCompleteBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, NSError *error))block; + +///------------------------------------------- +/// @name Setting Data Task Delegate Callbacks +///------------------------------------------- + +/** + Sets a block to be executed when a data task has received a response, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveResponse:completionHandler:`. + + @param block A block object to be executed when a data task has received a response. The block returns the disposition of the session response, and takes three arguments: the session, the data task, and the received response. + */ +- (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block; + +/** + Sets a block to be executed when a data task has become a download task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didBecomeDownloadTask:`. + + @param block A block object to be executed when a data task has become a download task. The block has no return value, and takes three arguments: the session, the data task, and the download task it has become. + */ +- (void)setDataTaskDidBecomeDownloadTaskBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block; + +/** + Sets a block to be executed when a data task receives data, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveData:`. + + @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the session, the data task, and the data received. This block may be called multiple times, and will execute on the session manager operation queue. + */ +- (void)setDataTaskDidReceiveDataBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block; + +/** + Sets a block to be executed to determine the caching behavior of a data task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:willCacheResponse:completionHandler:`. + + @param block A block object to be executed to determine the caching behavior of a data task. The block returns the response to cache, and takes three arguments: the session, the data task, and the proposed cached URL response. + */ +- (void)setDataTaskWillCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block; + +/** + Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDataDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`. + + @param block A block object to be executed once all messages enqueued for a session have been delivered. The block has no return value and takes a single argument: the session. + */ +- (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block; + +///----------------------------------------------- +/// @name Setting Download Task Delegate Callbacks +///----------------------------------------------- + +/** + Sets a block to be executed when a download task has completed a download, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didFinishDownloadingToURL:`. + + @param block A block object to be executed when a download task has completed. The block returns the URL the download should be moved to, and takes three arguments: the session, the download task, and the temporary location of the downloaded file. If the file manager encounters an error while attempting to move the temporary file to the destination, an `AFURLSessionDownloadTaskDidFailToMoveFileNotification` will be posted, with the download task as its object, and the user info of the error. + */ +- (void)setDownloadTaskDidFinishDownloadingBlock:(NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block; + +/** + Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`. + + @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes five arguments: the session, the download task, the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the session manager operation queue. + */ +- (void)setDownloadTaskDidWriteDataBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block; + +/** + Sets a block to be executed when a download task has been resumed, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`. + + @param block A block object to be executed when a download task has been resumed. The block has no return value and takes four arguments: the session, the download task, the file offset of the resumed download, and the total number of bytes expected to be downloaded. + */ +- (void)setDownloadTaskDidResumeBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block; + +@end + +#endif + +///-------------------- +/// @name Notifications +///-------------------- + +/** + Posted when a task begins executing. + */ +extern NSString * const AFNetworkingTaskDidStartNotification; + +/** + Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task. + */ +extern NSString * const AFNetworkingTaskDidFinishNotification; + +/** + Posted when a task suspends its execution. + */ +extern NSString * const AFNetworkingTaskDidSuspendNotification; + +/** + Posted when a session is invalidated. + */ +extern NSString * const AFURLSessionDidInvalidateNotification; + +/** + Posted when a session download task encountered an error when moving the temporary download file to a specified destination. + */ +extern NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification; + +/** + The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if response data exists for the task. + */ +extern NSString * const AFNetworkingTaskDidFinishResponseDataKey; + +/** + The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the response was serialized. + */ +extern NSString * const AFNetworkingTaskDidFinishSerializedResponseKey; + +/** + The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if the task has an associated response serializer. + */ +extern NSString * const AFNetworkingTaskDidFinishResponseSerializerKey; + +/** + The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if an the response data has been stored directly to disk. + */ +extern NSString * const AFNetworkingTaskDidFinishAssetPathKey; + +/** + Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidFinishNotification` if an error exists. + */ +extern NSString * const AFNetworkingTaskDidFinishErrorKey; diff --git a/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m b/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m new file mode 100644 index 0000000..e9eb960 --- /dev/null +++ b/Pods/AFNetworking/AFNetworking/AFURLSessionManager.m @@ -0,0 +1,901 @@ +// AFURLSessionManager.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFURLSessionManager.h" + +#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) + +static dispatch_queue_t url_session_manager_processing_queue() { + static dispatch_queue_t af_url_session_manager_processing_queue; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + af_url_session_manager_processing_queue = dispatch_queue_create("com.alamofire.networking.session.manager.processing", DISPATCH_QUEUE_CONCURRENT); + }); + + return af_url_session_manager_processing_queue; +} + +static dispatch_group_t url_session_manager_completion_group() { + static dispatch_group_t af_url_session_manager_completion_group; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + af_url_session_manager_completion_group = dispatch_group_create(); + }); + + return af_url_session_manager_completion_group; +} + +NSString * const AFNetworkingTaskDidStartNotification = @"com.alamofire.networking.task.start"; +NSString * const AFNetworkingTaskDidFinishNotification = @"com.alamofire.networking.task.finish"; +NSString * const AFNetworkingTaskDidFinishResponseDataKey = @"com.alamofire.networking.task.finish.responsedata"; +NSString * const AFNetworkingTaskDidSuspendNotification = @"com.alamofire.networking.task.suspend"; +NSString * const AFURLSessionDidInvalidateNotification = @"com.alamofire.networking.session.invalidate"; +NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification = @"com.alamofire.networking.session.download.file-manager-error"; + +NSString * const AFNetworkingTaskDidFinishSerializedResponseKey = @"com.alamofire.networking.task.finish.serializedresponse"; +NSString * const AFNetworkingTaskDidFinishResponseSerializerKey = @"com.alamofire.networking.task.finish.responseserializer"; +NSString * const AFNetworkingTaskDidFinishErrorKey = @"com.alamofire.networking.task.finish.error"; +NSString * const AFNetworkingTaskDidFinishAssetPathKey = @"com.alamofire.networking.task.finish.assetpath"; + +static NSString * const AFURLSessionManagerLockName = @"com.alamofire.networking.session.manager.lock"; + +static void * AFTaskStateChangedContext = &AFTaskStateChangedContext; + +typedef void (^AFURLSessionDidBecomeInvalidBlock)(NSURLSession *session, NSError *error); +typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential); + +typedef NSURLRequest * (^AFURLSessionTaskWillPerformHTTPRedirectionBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request); +typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionTaskDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential); + +typedef NSInputStream * (^AFURLSessionTaskNeedNewBodyStreamBlock)(NSURLSession *session, NSURLSessionTask *task); +typedef void (^AFURLSessionTaskDidSendBodyDataBlock)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend); +typedef void (^AFURLSessionTaskDidCompleteBlock)(NSURLSession *session, NSURLSessionTask *task, NSError *error); + +typedef NSURLSessionResponseDisposition (^AFURLSessionDataTaskDidReceiveResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response); +typedef void (^AFURLSessionDataTaskDidBecomeDownloadTaskBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask); +typedef void (^AFURLSessionDataTaskDidReceiveDataBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data); +typedef NSCachedURLResponse * (^AFURLSessionDataTaskWillCacheResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse); +typedef void (^AFURLSessionDidFinishEventsForBackgroundURLSessionBlock)(NSURLSession *session); + +typedef NSURL * (^AFURLSessionDownloadTaskDidFinishDownloadingBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location); +typedef void (^AFURLSessionDownloadTaskDidWriteDataBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite); +typedef void (^AFURLSessionDownloadTaskDidResumeBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes); + +typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error); + +#pragma mark - + +@interface AFURLSessionManagerTaskDelegate : NSObject +@property (nonatomic, weak) AFURLSessionManager *manager; +@property (nonatomic, strong) NSMutableData *mutableData; +@property (nonatomic, strong) NSProgress *uploadProgress; +@property (nonatomic, strong) NSProgress *downloadProgress; +@property (nonatomic, copy) NSURL *downloadFileURL; +@property (nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading; +@property (nonatomic, copy) AFURLSessionTaskCompletionHandler completionHandler; + ++ (instancetype)delegateForManager:(AFURLSessionManager *)manager + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler; + +@end + +@implementation AFURLSessionManagerTaskDelegate + ++ (instancetype)delegateForManager:(AFURLSessionManager *)manager + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + AFURLSessionManagerTaskDelegate *delegate = [[self alloc] init]; + delegate.manager = manager; + delegate.completionHandler = completionHandler; + + return delegate; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.mutableData = [NSMutableData data]; + + self.uploadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; + self.downloadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; + + return self; +} + +#pragma mark - NSURLSessionTaskDelegate + +- (void)URLSession:(__unused NSURLSession *)session + task:(__unused NSURLSessionTask *)task + didSendBodyData:(__unused int64_t)bytesSent + totalBytesSent:(int64_t)totalBytesSent +totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend +{ + self.uploadProgress.totalUnitCount = totalBytesExpectedToSend; + self.uploadProgress.completedUnitCount = totalBytesSent; +} + +- (void)URLSession:(__unused NSURLSession *)session + task:(NSURLSessionTask *)task +didCompleteWithError:(NSError *)error +{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + if (self.completionHandler) { + __strong AFURLSessionManager *manager = self.manager; + + __block id responseObject = nil; + + __block NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; + userInfo[AFNetworkingTaskDidFinishResponseSerializerKey] = manager.responseSerializer; + + if (self.downloadFileURL) { + userInfo[AFNetworkingTaskDidFinishAssetPathKey] = self.downloadFileURL; + } else if (self.mutableData) { + userInfo[AFNetworkingTaskDidFinishResponseDataKey] = [NSData dataWithData:self.mutableData]; + } + + if (error) { + userInfo[AFNetworkingTaskDidFinishErrorKey] = error; + + dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{ + if (self.completionHandler) { + self.completionHandler(task.response, responseObject, error); + } + + [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidFinishNotification object:task userInfo:userInfo]; + }); + } else { + dispatch_async(url_session_manager_processing_queue(), ^{ + NSError *serializationError = nil; + if (self.downloadFileURL) { + responseObject = self.downloadFileURL; + } else { + responseObject = [manager.responseSerializer responseObjectForResponse:task.response data:[NSData dataWithData:self.mutableData] error:&serializationError]; + } + + if (responseObject) { + userInfo[AFNetworkingTaskDidFinishSerializedResponseKey] = responseObject; + } + + if (serializationError) { + userInfo[AFNetworkingTaskDidFinishErrorKey] = serializationError; + } + + dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{ + if (self.completionHandler) { + self.completionHandler(task.response, responseObject, serializationError); + } + + [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidFinishNotification object:task userInfo:userInfo]; + }); + }); + } + } +#pragma clang diagnostic pop +} + +#pragma mark - NSURLSessionDataTaskDelegate + +- (void)URLSession:(__unused NSURLSession *)session + dataTask:(__unused NSURLSessionDataTask *)dataTask + didReceiveData:(NSData *)data +{ + [self.mutableData appendData:data]; + + self.downloadProgress.totalUnitCount += [data length]; +} + +#pragma mark - NSURLSessionDownloadTaskDelegate + +- (void)URLSession:(NSURLSession *)session + downloadTask:(NSURLSessionDownloadTask *)downloadTask +didFinishDownloadingToURL:(NSURL *)location +{ + NSError *fileManagerError = nil; + self.downloadFileURL = nil; + + if (self.downloadTaskDidFinishDownloading) { + self.downloadFileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location); + if (self.downloadFileURL) { + [[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError]; + + if (fileManagerError) { + [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:fileManagerError.userInfo]; + } + } + } +} + +- (void)URLSession:(__unused NSURLSession *)session + downloadTask:(__unused NSURLSessionDownloadTask *)downloadTask + didWriteData:(__unused int64_t)bytesWritten + totalBytesWritten:(int64_t)totalBytesWritten +totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite +{ + self.downloadProgress.totalUnitCount = totalBytesExpectedToWrite; + self.downloadProgress.completedUnitCount = totalBytesWritten; +} + +- (void)URLSession:(__unused NSURLSession *)session + downloadTask:(__unused NSURLSessionDownloadTask *)downloadTask + didResumeAtOffset:(int64_t)fileOffset +expectedTotalBytes:(int64_t)expectedTotalBytes { + self.downloadProgress.totalUnitCount = expectedTotalBytes; + self.downloadProgress.completedUnitCount = fileOffset; +} + +@end + +#pragma mark - + +@interface AFURLSessionManager () +@property (readwrite, nonatomic, strong) NSURLSessionConfiguration *sessionConfiguration; +@property (readwrite, nonatomic, strong) NSOperationQueue *operationQueue; +@property (readwrite, nonatomic, strong) NSURLSession *session; +@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableTaskDelegatesKeyedByTaskIdentifier; +@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager; +@property (readwrite, nonatomic, strong) NSLock *lock; +@property (readwrite, nonatomic, copy) AFURLSessionDidBecomeInvalidBlock sessionDidBecomeInvalid; +@property (readwrite, nonatomic, copy) AFURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge; +@property (readwrite, nonatomic, copy) AFURLSessionTaskWillPerformHTTPRedirectionBlock taskWillPerformHTTPRedirection; +@property (readwrite, nonatomic, copy) AFURLSessionTaskDidReceiveAuthenticationChallengeBlock taskDidReceiveAuthenticationChallenge; +@property (readwrite, nonatomic, copy) AFURLSessionTaskNeedNewBodyStreamBlock taskNeedNewBodyStream; +@property (readwrite, nonatomic, copy) AFURLSessionTaskDidSendBodyDataBlock taskDidSendBodyData; +@property (readwrite, nonatomic, copy) AFURLSessionTaskDidCompleteBlock taskDidComplete; +@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveResponseBlock dataTaskDidReceiveResponse; +@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidBecomeDownloadTaskBlock dataTaskDidBecomeDownloadTask; +@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveDataBlock dataTaskDidReceiveData; +@property (readwrite, nonatomic, copy) AFURLSessionDataTaskWillCacheResponseBlock dataTaskWillCacheResponse; +@property (readwrite, nonatomic, copy) AFURLSessionDidFinishEventsForBackgroundURLSessionBlock didFinishEventsForBackgroundURLSession; +@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading; +@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidWriteDataBlock downloadTaskDidWriteData; +@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidResumeBlock downloadTaskDidResume; +@end + +@implementation AFURLSessionManager + +- (instancetype)init { + return [self initWithSessionConfiguration:nil]; +} + +- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration { + self = [super init]; + if (!self) { + return nil; + } + + if (!configuration) { + configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; + } + + self.operationQueue = [[NSOperationQueue alloc] init]; + self.operationQueue.maxConcurrentOperationCount = NSOperationQueueDefaultMaxConcurrentOperationCount; + + self.responseSerializer = [AFJSONResponseSerializer serializer]; + + self.sessionConfiguration = configuration; + self.session = [NSURLSession sessionWithConfiguration:self.sessionConfiguration delegate:self delegateQueue:self.operationQueue]; + + self.mutableTaskDelegatesKeyedByTaskIdentifier = [[NSMutableDictionary alloc] init]; + + self.reachabilityManager = [AFNetworkReachabilityManager sharedManager]; + [self.reachabilityManager startMonitoring]; + + self.lock = [[NSLock alloc] init]; + self.lock.name = AFURLSessionManagerLockName; + + return self; +} + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, self.session, self.operationQueue]; +} + +#pragma mark - + +- (AFURLSessionManagerTaskDelegate *)delegateForTask:(NSURLSessionTask *)task { + NSParameterAssert(task); + + AFURLSessionManagerTaskDelegate *delegate = nil; + [self.lock lock]; + delegate = self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)]; + [self.lock unlock]; + + return delegate; +} + +- (void)setDelegate:(AFURLSessionManagerTaskDelegate *)delegate + forTask:(NSURLSessionTask *)task +{ + NSParameterAssert(task); + + [self.lock lock]; + self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)] = delegate; + [self.lock unlock]; +} + +- (void)removeDelegateForTask:(NSURLSessionTask *)task { + NSParameterAssert(task); + + [self.lock lock]; + [self.mutableTaskDelegatesKeyedByTaskIdentifier removeObjectForKey:@(task.taskIdentifier)]; + [self.lock unlock]; +} + +- (void)removeAllDelegates { + [self.lock lock]; + [self.mutableTaskDelegatesKeyedByTaskIdentifier removeAllObjects]; + [self.lock unlock]; +} + +#pragma mark - + +- (NSArray *)tasksForKeyPath:(NSString *)keyPath { + __block NSArray *tasks = nil; + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(dataTasks))]) { + tasks = dataTasks; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(uploadTasks))]) { + tasks = uploadTasks; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(downloadTasks))]) { + tasks = downloadTasks; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(tasks))]) { + tasks = [@[dataTasks, uploadTasks, downloadTasks] valueForKeyPath:@"@unionOfArrays.self"]; + } + + dispatch_semaphore_signal(semaphore); + }]; + + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); + + return tasks; +} + +- (NSArray *)tasks { + return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; +} + +- (NSArray *)dataTasks { + return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; +} + +- (NSArray *)uploadTasks { + return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; +} + +- (NSArray *)downloadTasks { + return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; +} + +#pragma mark - + +- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks { + if (cancelPendingTasks) { + [self.session invalidateAndCancel]; + } else { + [self.session finishTasksAndInvalidate]; + } +} + +#pragma mark - + +- (void)setResponseSerializer:(id )responseSerializer { + NSParameterAssert(responseSerializer); + + _responseSerializer = responseSerializer; +} + +#pragma mark - + +- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + NSURLSessionDataTask *dataTask = [self.session dataTaskWithRequest:request]; + + AFURLSessionManagerTaskDelegate *delegate = [AFURLSessionManagerTaskDelegate delegateForManager:self completionHandler:completionHandler]; + [self setDelegate:delegate forTask:dataTask]; + + [dataTask addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew context:AFTaskStateChangedContext]; + + return dataTask; +} + +#pragma mark - + +- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request + fromFile:(NSURL *)fileURL + progress:(NSProgress * __autoreleasing *)progress + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL]; + + return [self uploadTaskWithTask:uploadTask progress:progress completionHandler:completionHandler]; +} + +- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request + fromData:(NSData *)bodyData + progress:(NSProgress * __autoreleasing *)progress + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithRequest:request fromData:bodyData]; + + return [self uploadTaskWithTask:uploadTask progress:progress completionHandler:completionHandler]; +} + +- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request + progress:(NSProgress * __autoreleasing *)progress + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + NSURLSessionUploadTask *uploadTask = [self.session uploadTaskWithStreamedRequest:request]; + + return [self uploadTaskWithTask:uploadTask progress:progress completionHandler:completionHandler]; +} + +- (NSURLSessionUploadTask *)uploadTaskWithTask:(NSURLSessionUploadTask *)uploadTask + progress:(NSProgress * __autoreleasing *)progress + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + AFURLSessionManagerTaskDelegate *delegate = [AFURLSessionManagerTaskDelegate delegateForManager:self completionHandler:completionHandler]; + + delegate.uploadProgress = [NSProgress progressWithTotalUnitCount:uploadTask.countOfBytesExpectedToSend]; + delegate.uploadProgress.pausingHandler = ^{ + [uploadTask suspend]; + }; + delegate.uploadProgress.cancellationHandler = ^{ + [uploadTask cancel]; + }; + + if (progress) { + *progress = delegate.uploadProgress; + } + + [self setDelegate:delegate forTask:uploadTask]; + + [uploadTask addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew context:AFTaskStateChangedContext]; + + return uploadTask; +} + +#pragma mark - + +- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request + progress:(NSProgress * __autoreleasing *)progress + destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler +{ + NSURLSessionDownloadTask *downloadTask = [self.session downloadTaskWithRequest:request]; + + return [self downloadTaskWithTask:downloadTask progress:progress destination:destination completionHandler:completionHandler]; +} + +- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData + progress:(NSProgress * __autoreleasing *)progress + destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler +{ + NSURLSessionDownloadTask *downloadTask = [self.session downloadTaskWithResumeData:resumeData]; + + return [self downloadTaskWithTask:downloadTask progress:progress destination:destination completionHandler:completionHandler]; +} + +- (NSURLSessionDownloadTask *)downloadTaskWithTask:(NSURLSessionDownloadTask *)downloadTask + progress:(NSProgress * __autoreleasing *)progress + destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler +{ + AFURLSessionManagerTaskDelegate *delegate = [AFURLSessionManagerTaskDelegate delegateForManager:self completionHandler:completionHandler]; + delegate.downloadTaskDidFinishDownloading = ^NSURL * (NSURLSession * __unused session, NSURLSessionDownloadTask *task, NSURL *location) { + if (destination) { + return destination(location, task.response); + } + + return location; + }; + + if (progress) { + *progress = delegate.downloadProgress; + } + + [self setDelegate:delegate forTask:downloadTask]; + + [downloadTask addObserver:self forKeyPath:@"state" options:NSKeyValueObservingOptionOld|NSKeyValueObservingOptionNew context:AFTaskStateChangedContext]; + + return downloadTask; +} + +#pragma mark - + +- (void)setSessionDidBecomeInvalidBlock:(void (^)(NSURLSession *session, NSError *error))block { + self.sessionDidBecomeInvalid = block; +} + +- (void)setSessionDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block { + self.sessionDidReceiveAuthenticationChallenge = block; +} + +#pragma mark - + +- (void)setTaskWillPerformHTTPRedirectionBlock:(NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block { + self.taskWillPerformHTTPRedirection = block; +} + +- (void)setTaskDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block { + self.taskDidReceiveAuthenticationChallenge = block; +} + +- (void)setTaskDidSendBodyDataBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block { + self.taskDidSendBodyData = block; +} + +- (void)setTaskDidCompleteBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, NSError *error))block { + self.taskDidComplete = block; +} + +#pragma mark - + +- (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block { + self.dataTaskDidReceiveResponse = block; +} + +- (void)setDataTaskDidBecomeDownloadTaskBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block { + self.dataTaskDidBecomeDownloadTask = block; +} + +- (void)setDataTaskDidReceiveDataBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block { + self.dataTaskDidReceiveData = block; +} + +- (void)setDataTaskWillCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block { + self.dataTaskWillCacheResponse = block; +} + +- (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block { + self.didFinishEventsForBackgroundURLSession = block; +} + +#pragma mark - + +- (void)setDownloadTaskDidFinishDownloadingBlock:(NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block { + self.downloadTaskDidFinishDownloading = block; +} + +- (void)setDownloadTaskDidWriteDataBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block { + self.downloadTaskDidWriteData = block; +} + +- (void)setDownloadTaskDidResumeBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block { + self.downloadTaskDidResume = block; +} + +#pragma mark - NSURLSessionDelegate + +- (void)URLSession:(NSURLSession *)session +didBecomeInvalidWithError:(NSError *)error +{ + if (self.sessionDidBecomeInvalid) { + self.sessionDidBecomeInvalid(session, error); + } + + [self removeAllDelegates]; + + [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDidInvalidateNotification object:session]; +} + +- (void)URLSession:(NSURLSession *)session +didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge + completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler +{ + NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; + __block NSURLCredential *credential = nil; + + if (self.sessionDidReceiveAuthenticationChallenge) { + disposition = self.sessionDidReceiveAuthenticationChallenge(session, challenge, &credential); + } else { + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust]) { + credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; + if (credential) { + disposition = NSURLSessionAuthChallengeUseCredential; + } else { + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } + } else { + disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; + } + } else { + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } + } + } + + if (completionHandler) { + completionHandler(disposition, credential); + } +} + +#pragma mark - NSURLSessionTaskDelegate + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task +willPerformHTTPRedirection:(NSHTTPURLResponse *)response + newRequest:(NSURLRequest *)request + completionHandler:(void (^)(NSURLRequest *))completionHandler +{ + NSURLRequest *redirectRequest = request; + + if (self.taskWillPerformHTTPRedirection) { + redirectRequest = self.taskWillPerformHTTPRedirection(session, task, response, request); + } + + if (completionHandler) { + completionHandler(redirectRequest); + } +} + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task +didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge + completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler +{ + NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; + __block NSURLCredential *credential = nil; + + if (self.taskDidReceiveAuthenticationChallenge) { + disposition = self.taskDidReceiveAuthenticationChallenge(session, task, challenge, &credential); + } else { + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust]) { + disposition = NSURLSessionAuthChallengeUseCredential; + credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; + } else { + disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; + } + } else { + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } + } + + if (completionHandler) { + completionHandler(disposition, credential); + } +} + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task + needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler +{ + NSInputStream *inputStream = nil; + + if (self.taskNeedNewBodyStream) { + inputStream = self.taskNeedNewBodyStream(session, task); + } else if (task.originalRequest.HTTPBodyStream && [task.originalRequest.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) { + inputStream = [task.originalRequest.HTTPBodyStream copy]; + } + + if (completionHandler) { + completionHandler(inputStream); + } +} + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task + didSendBodyData:(int64_t)bytesSent + totalBytesSent:(int64_t)totalBytesSent +totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; + [delegate URLSession:session task:task didSendBodyData:bytesSent totalBytesSent:totalBytesSent totalBytesExpectedToSend:totalBytesExpectedToSend]; + + if (self.taskDidSendBodyData) { + self.taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalBytesExpectedToSend); + } +} + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task +didCompleteWithError:(NSError *)error +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; + [delegate URLSession:session task:task didCompleteWithError:error]; + + if (self.taskDidComplete) { + self.taskDidComplete(session, task, error); + } + + [self removeDelegateForTask:task]; +} + +#pragma mark - NSURLSessionDataDelegate + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didReceiveResponse:(NSURLResponse *)response + completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler +{ + NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow; + + if (self.dataTaskDidReceiveResponse) { + disposition = self.dataTaskDidReceiveResponse(session, dataTask, response); + } + + if (completionHandler) { + completionHandler(disposition); + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask +{ + if (self.dataTaskDidBecomeDownloadTask) { + self.dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask); + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask + didReceiveData:(NSData *)data +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask]; + [delegate URLSession:session dataTask:dataTask didReceiveData:data]; + + if (self.dataTaskDidReceiveData) { + self.dataTaskDidReceiveData(session, dataTask, data); + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask + willCacheResponse:(NSCachedURLResponse *)proposedResponse + completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler +{ + NSCachedURLResponse *cachedResponse = proposedResponse; + + if (self.dataTaskWillCacheResponse) { + cachedResponse = self.dataTaskWillCacheResponse(session, dataTask, proposedResponse); + } + + if (completionHandler) { + completionHandler(cachedResponse); + } +} + +- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session { + if (self.didFinishEventsForBackgroundURLSession) { + self.didFinishEventsForBackgroundURLSession(session); + } + + [self removeAllDelegates]; +} + +#pragma mark - NSURLSessionDownloadDelegate + +- (void)URLSession:(NSURLSession *)session + downloadTask:(NSURLSessionDownloadTask *)downloadTask +didFinishDownloadingToURL:(NSURL *)location +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask]; + if (delegate) { + [delegate URLSession:session downloadTask:downloadTask didFinishDownloadingToURL:location]; + } else if (self.downloadTaskDidFinishDownloading) { + NSURL *fileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location); + if (fileURL) { + NSError *error = nil; + [[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error]; + if (error) { + [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:error.userInfo]; + } + } + } +} + +- (void)URLSession:(NSURLSession *)session + downloadTask:(NSURLSessionDownloadTask *)downloadTask + didWriteData:(int64_t)bytesWritten + totalBytesWritten:(int64_t)totalBytesWritten +totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask]; + [delegate URLSession:session downloadTask:downloadTask didWriteData:bytesWritten totalBytesWritten:totalBytesWritten totalBytesExpectedToWrite:totalBytesExpectedToWrite]; + + if (self.downloadTaskDidWriteData) { + self.downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); + } +} + +- (void)URLSession:(NSURLSession *)session + downloadTask:(NSURLSessionDownloadTask *)downloadTask + didResumeAtOffset:(int64_t)fileOffset +expectedTotalBytes:(int64_t)expectedTotalBytes +{ + if (self.downloadTaskDidResume) { + self.downloadTaskDidResume(session, downloadTask, fileOffset, expectedTotalBytes); + } +} + +#pragma mark - NSKeyValueObserving + +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(NSDictionary *)change + context:(void *)context +{ + if (context == AFTaskStateChangedContext && [keyPath isEqualToString:@"state"]) { + NSString *notificationName = nil; + switch ([(NSURLSessionTask *)object state]) { + case NSURLSessionTaskStateRunning: + notificationName = AFNetworkingTaskDidStartNotification; + break; + case NSURLSessionTaskStateSuspended: + notificationName = AFNetworkingTaskDidSuspendNotification; + break; + case NSURLSessionTaskStateCompleted: + // AFNetworkingTaskDidFinishNotification posted by task completion handlers + @try { + [object removeObserver:self forKeyPath:@"state" context:AFTaskStateChangedContext]; + } @catch (NSException *exception) {} + break; + default: + break; + } + + if (notificationName) { + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:notificationName object:object]; + }); + } + } else { + [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; + } +} + +#pragma mark - NSCoding + +- (id)initWithCoder:(NSCoder *)aDecoder { + NSURLSessionConfiguration *configuration = [aDecoder decodeObjectForKey:@"sessionConfiguration"]; + + self = [self initWithSessionConfiguration:configuration]; + if (!self) { + return nil; + } + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)aCoder { + [aCoder encodeObject:self.session.configuration forKey:@"sessionConfiguration"]; +} + +#pragma mark - NSCopying + +- (id)copyWithZone:(NSZone *)zone { + return [[[self class] allocWithZone:zone] initWithSessionConfiguration:self.session.configuration]; +} + +@end + +#endif diff --git a/Pods/AFNetworking/LICENSE b/Pods/AFNetworking/LICENSE new file mode 100644 index 0000000..f20a847 --- /dev/null +++ b/Pods/AFNetworking/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2013 AFNetworking (http://afnetworking.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/Pods/AFNetworking/README.md b/Pods/AFNetworking/README.md new file mode 100644 index 0000000..dafe44c --- /dev/null +++ b/Pods/AFNetworking/README.md @@ -0,0 +1,369 @@ +

+ AFNetworking +

+ +AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the [Foundation URL Loading System](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use. + +Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac. + +Choose AFNetworking for your next project, or migrate over your existing projects—you'll be happy you did! + +## How To Get Started + +- [Download AFNetworking](https://github.com/AFNetworking/AFNetworking/archive/master.zip) and try out the included Mac and iPhone example apps +- Read the ["Getting Started" guide](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking), [FAQ](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ), or [other articles on the Wiki](https://github.com/AFNetworking/AFNetworking/wiki) +- Check out the [documentation](http://cocoadocs.org/docsets/AFNetworking/2.0.0/) for a comprehensive look at all of the APIs available in AFNetworking +- Questions? [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking) is the best place to find answers + +### Installation with CocoaPods + +[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking in your projects. See the ["Getting Started" guide for more information](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking). + +#### Podfile + +```ruby +platform :ios, '7.0' +pod "AFNetworking", "~> 2.0" +``` + +## 2.0 + +AFNetworking 2.0 is a major update to the framework. Building on 2 years of development, this new version introduces powerful new features, while providing an easy upgrade path for existing users. + +**Read the [AFNetworking 2.0 Migration Guide](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-2.0-Migration-Guide) for an overview of the architectural and API changes.** + +### What's New + +- Refactored Architecture +- Support for NSURLSession +- Serialization Modules +- Expanded UIKit Extensions +- Real-time functionality with [Rocket](http://rocket.github.io) + +## Requirements + +AFNetworking 2.0 and higher requires Xcode 5, targeting either iOS 6.0 and above, or Mac OS 10.8 Mountain Lion ([64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)) and above. + +For compatibility with iOS 5 or Mac OS X 10.7, use the [latest 1.x release](https://github.com/AFNetworking/AFNetworking/tree/1.x). + +For compatibility with iOS 4.3 or Mac OS X 10.6, use the [latest 0.10.x release](https://github.com/AFNetworking/AFNetworking/tree/0.10.x). + +## Architecture + +### NSURLConnection + +- `AFURLConnectionOperation` +- `AFHTTPRequestOperation` +- `AFHTTPRequestOperationManager` + +### NSURLSession _(iOS 7 / Mac OS X 10.9)_ + +- `AFURLSessionManager` +- `AFHTTPSessionManager` + +### Serialization + +* `` + - `AFHTTPRequestSerializer` + - `AFJSONRequestSerializer` + - `AFPropertyListRequestSerializer` +* `` + - `AFHTTPResponseSerializer` + - `AFJSONResponseSerializer` + - `AFXMLParserResponseSerializer` + - `AFXMLDocumentResponseSerializer` _(Mac OS X)_ + - `AFPropertyListResponseSerializer` + - `AFImageResponseSerializer` + - `AFCompoundResponseSerializer` + +### Additional Functionality + +- `AFSecurityPolicy` +- `AFNetworkReachabilityManager` + +## Usage + +### HTTP Request Operation Manager + +`AFHTTPRequestOperationManager` encapsulates the common patterns of communicating with a web application over HTTP, including request creation, response serialization, network reachability monitoring, and security, as well as request operation management. + +#### `GET` Request + +```objective-c +AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; +[manager GET:@"http://example.com/resources.json" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) { + NSLog(@"JSON: %@", responseObject); +} failure:^(AFHTTPRequestOperation *operation, NSError *error) { + NSLog(@"Error: %@", error); +}]; +``` + +#### `POST` URL-Form-Encoded Request + +```objective-c +AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; +NSDictionary *parameters = @{@"foo": @"bar"}; +[manager POST:@"http://example.com/resources.json" parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject) { + NSLog(@"JSON: %@", responseObject); +} failure:^(AFHTTPRequestOperation *operation, NSError *error) { + NSLog(@"Error: %@", error); +}]; +``` + +#### `POST` Multi-Part Request + +```objective-c +AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; +NSDictionary *parameters = @{@"foo": @"bar"}; +NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"]; +[manager POST:@"http://example.com/resources.json" parameters:parameters constructingBodyWithBlock:^(id formData) { + [formData appendPartWithFileURL:filePath name:@"image" error:nil]; +} success:^(AFHTTPRequestOperation *operation, id responseObject) { + NSLog(@"Success: %@", responseObject); +} failure:^(AFHTTPRequestOperation *operation, NSError *error) { + NSLog(@"Error: %@", error); +}]; +``` + +--- + +### AFURLSessionManager + +`AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``. + +#### Creating a Download Task + +```objective-c +NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; +AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; + +NSURL *URL = [NSURL URLWithString:@"http://example.com/download.zip"]; +NSURLRequest *request = [NSURLRequest requestWithURL:URL]; + +NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) { + NSURL *documentsDirectoryPath = [NSURL fileURLWithPath:[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject]]; + return [documentsDirectoryPath URLByAppendingPathComponent:[targetPath lastPathComponent]]; +} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) { + NSLog(@"File downloaded to: %@", filePath); +}]; +[downloadTask resume]; +``` + +#### Creating an Upload Task + +```objective-c +NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; +AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; + +NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"]; +NSURLRequest *request = [NSURLRequest requestWithURL:URL]; + +NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"]; +NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + if (error) { + NSLog(@"Error: %@", error); + } else { + NSLog(@"Success: %@ %@", response, responseObject); + } +}]; +[uploadTask resume]; +``` + +#### Creating a Data Task + +```objective-c +NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; +AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; + +NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"]; +NSURLRequest *request = [NSURLRequest requestWithURL:URL]; + +NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + if (error) { + NSLog(@"Error: %@", error); + } else { + NSLog(@"%@ %@", response, responseObject); + } +}]; +[dataTask resume]; +``` + +--- + +### Request Serialization + +Request serializers create requests from URL strings, encoding parameters as either a query string or HTTP body. + +```objective-c +NSString *URLString = @"http://example.com"; +NSDictionary *parameters = @{@"foo": @"bar", @"baz": @[@1, @2, @3]}; +``` + +#### Query String Parameter Encoding + +```objective-c +[[AFHTTPRequestSerializer serializer] requestWithMethod:@"GET" URLString:URLString parameters:parameters]; +``` + + GET http://example.com?foo=bar&baz[]=1&baz[]=2&baz[]=3 + +#### URL Form Parameter Encoding + +```objective-c +[[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters]; +``` + + POST http://example.com/ + Content-Type: application/x-www-form-urlencoded + + foo=bar&baz[]=1&baz[]=2&baz[]=3 + +#### JSON Parameter Encoding + +```objective-c +[[AFJSONRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters]; +``` + + POST http://example.com/ + Content-Type: application/json + + {"foo": "bar", "baz": [1,2,3]} + +--- + +### Network Reachability Manager + +`AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces. + +#### Shared Network Reachability + +```objective-c +[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { + NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status)); +}]; +``` + +#### HTTP Manager with Base URL + +When a `baseURL` is provided, network reachability is scoped to the host of that base URL. + +```objective-c +NSURL *baseURL = [NSURL URLWithString:@"http://example.com/"]; +AFHTTPRequestOperationManager *manager = [[AFHTTPRequestOperationManager alloc] initWithBaseURL:baseURL]; + +NSOperationQueue *operationQueue = manager.operationQueue; +[manager.reachabilityManager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { + switch (status) { + case AFNetworkReachabilityStatusReachableViaWWAN: + case AFNetworkReachabilityStatusReachableViaWiFi: + [operationQueue setSuspended:NO]; + break; + case AFNetworkReachabilityStatusNotReachable: + default: + [operationQueue setSuspended:YES]; + break; + } +}]; +``` + +--- + +### Security Policy + +`AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. + +Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. + +#### Allowing Invalid SSL Certificates + +```objective-c +AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager]; +manager.securityPolicy.allowInvalidCertificates = YES; // not recommended for production +``` + +--- + +### AFHTTPRequestOperation + +`AFHTTPRequestOperation` is a subclass of `AFURLConnectionOperation` for requests using the HTTP or HTTPS protocols. It encapsulates the concept of acceptable status codes and content types, which determine the success or failure of a request. + +Although `AFHTTPRequestOperationManager` is usually the best way to go about making requests, `AFHTTPRequestOperation` can be used by itself. + +#### `GET` with `AFHTTPRequestOperation` + +```objective-c +NSURL *URL = [NSURL URLWithString:@"http://example.com/resources/123.json"]; +NSURLRequest *request = [NSURLRequest requestWithURL:URL]; +AFHTTPRequestOperation *op = [[AFHTTPRequestOperation alloc] initWithRequest:request]; +op.responseSerializer = [AFJSONResponseSerializer serializer]; +[op setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { + NSLog(@"JSON: %@", responseObject); +} failure:^(AFHTTPRequestOperation *operation, NSError *error) { + NSLog(@"Error: %@", error); +}]; +[[NSOperationQueue mainQueue] addOperation:op]; +``` + +#### Batch of Operations + +```objective-c +NSMutableArray *mutableOperations = [NSMutableArray array]; +for (NSURL *fileURL in filesToUpload) { + NSURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://example.com/upload" parameters:nil constructingBodyWithBlock:^(id formData) { + [formData appendPartWithFileURL:fileURL name:@"images[]" error:nil]; + }]; + + AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; + + [mutableOperations addObject:operation]; +} + +NSArray *operations = [AFURLConnectionOperation batchOfRequestOperations:@[...] progressBlock:^(NSUInteger numberOfFinishedOperations, NSUInteger totalNumberOfOperations) { + NSLog(@"%lu of %lu complete", numberOfFinishedOperations, totalNumberOfOperations); +} completionBlock:^(NSArray *operations) { + NSLog(@"All operations in batch complete"); +}]; +[[NSOperationQueue mainQueue] addOperations:operations waitUntilFinished:NO]; +``` + +## Unit Tests + +AFNetworking includes a suite of unit tests within the Tests subdirectory. In order to run the unit tests, you must install the testing dependencies via CocoaPods: + + $ cd Tests + $ pod install + +Once testing dependencies are installed, you can execute the test suite via the 'iOS Tests' and 'OS X Tests' schemes within Xcode. + +### Using xctool + +Tests can also be run from the command line or within a continuous integration environment with [`xctool`](https://github.com/facebook/xctool), which can be installed with [Homebrew](http://brew.sh): + + $ brew update + $ brew install xctool --HEAD + +Once `xctool` is installed, you can execute the suite via `rake test`. + +## Credits + +AFNetworking was originally created by [Scott Raymond](https://github.com/sco/) and [Mattt Thompson](https://github.com/mattt/) in the development of [Gowalla for iPhone](http://en.wikipedia.org/wiki/Gowalla). + +AFNetworking's logo was designed by [Alan Defibaugh](http://www.alandefibaugh.com/). + +And most of all, thanks to AFNetworking's [growing list of contributors](https://github.com/AFNetworking/AFNetworking/contributors). + +## Contact + +Follow AFNetworking on Twitter ([@AFNetworking](https://twitter.com/AFNetworking)) + +### Maintainers + +- [Mattt Thompson](http://github.com/mattt) ([@mattt](https://twitter.com/mattt)) + +## One More Thing... + +**AFNetworking: the Definitive Guide** written by Mattt Thompson and published by [O'Reilly](http://oreilly.com), will be available late 2013 / early 2014. [Sign up here to be notified about updates](http://eepurl.com/Flnvn). + +## License + +AFNetworking is available under the MIT license. See the LICENSE file for more info. diff --git a/AFNetworking/AFNetworkActivityIndicatorManager.h b/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h old mode 100755 new mode 100644 similarity index 89% rename from AFNetworking/AFNetworkActivityIndicatorManager.h rename to Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h index 59cabcd..f43b062 --- a/AFNetworking/AFNetworkActivityIndicatorManager.h +++ b/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h @@ -1,17 +1,17 @@ // AFNetworkActivityIndicatorManager.h // -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -25,37 +25,38 @@ #import #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + #import /** `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a network request operation has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero. - + You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code: - - [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; - + + [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; + By setting `isNetworkActivityIndicatorVisible` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself. - + See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information: http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44 */ @interface AFNetworkActivityIndicatorManager : NSObject /** - A Boolean value indicating whether the manager is enabled. - - @discussion If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO. + A Boolean value indicating whether the manager is enabled. + + If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO. */ @property (nonatomic, assign, getter = isEnabled) BOOL enabled; /** A Boolean value indicating whether the network activity indicator is currently displayed in the status bar. */ -@property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible; +@property (readonly, nonatomic, assign) BOOL isNetworkActivityIndicatorVisible; /** Returns the shared network activity indicator manager object for the system. - + @return The systemwide network activity indicator manager. */ + (instancetype)sharedManager; diff --git a/AFNetworking/AFNetworkActivityIndicatorManager.m b/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m old mode 100755 new mode 100644 similarity index 61% rename from AFNetworking/AFNetworkActivityIndicatorManager.m rename to Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m index 8f4d868..61cc92b --- a/AFNetworking/AFNetworkActivityIndicatorManager.m +++ b/Pods/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m @@ -1,17 +1,17 @@ // AFNetworkActivityIndicatorManager.m // -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -22,24 +22,40 @@ #import "AFNetworkActivityIndicatorManager.h" +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + #import "AFHTTPRequestOperation.h" -#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 +#import "AFURLSessionManager.h" +#endif + static NSTimeInterval const kAFNetworkActivityIndicatorInvisibilityDelay = 0.17; +static NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) { + if ([[notification object] isKindOfClass:[AFURLConnectionOperation class]]) { + return [(AFURLConnectionOperation *)[notification object] request]; + } + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 + if ([[notification object] respondsToSelector:@selector(originalRequest)]) { + return [(NSURLSessionTask *)[notification object] originalRequest]; + } +#endif + + return nil; +} + @interface AFNetworkActivityIndicatorManager () -@property (readwrite, assign) NSInteger activityCount; +@property (readwrite, nonatomic, assign) NSInteger activityCount; @property (readwrite, nonatomic, strong) NSTimer *activityIndicatorVisibilityTimer; -@property (readonly, getter = isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; +@property (readonly, nonatomic, getter = isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; - (void)updateNetworkActivityIndicatorVisibility; - (void)updateNetworkActivityIndicatorVisibilityDelayed; @end @implementation AFNetworkActivityIndicatorManager -@synthesize activityCount = _activityCount; -@synthesize activityIndicatorVisibilityTimer = _activityIndicatorVisibilityTimer; -@synthesize enabled = _enabled; @dynamic networkActivityIndicatorVisible; + (instancetype)sharedManager { @@ -48,7 +64,7 @@ + (instancetype)sharedManager { dispatch_once(&oncePredicate, ^{ _sharedManager = [[self alloc] init]; }); - + return _sharedManager; } @@ -61,18 +77,23 @@ - (id)init { if (!self) { return nil; } - - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(incrementActivityCount) name:AFNetworkingOperationDidStartNotification object:nil]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(decrementActivityCount) name:AFNetworkingOperationDidFinishNotification object:nil]; - + + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingOperationDidStartNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingOperationDidFinishNotification object:nil]; + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidStartNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidFinishNotification object:nil]; +#endif + return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; - + [_activityIndicatorVisibilityTimer invalidate]; - } - (void)updateNetworkActivityIndicatorVisibilityDelayed { @@ -83,29 +104,27 @@ - (void)updateNetworkActivityIndicatorVisibilityDelayed { self.activityIndicatorVisibilityTimer = [NSTimer timerWithTimeInterval:kAFNetworkActivityIndicatorInvisibilityDelay target:self selector:@selector(updateNetworkActivityIndicatorVisibility) userInfo:nil repeats:NO]; [[NSRunLoop mainRunLoop] addTimer:self.activityIndicatorVisibilityTimer forMode:NSRunLoopCommonModes]; } else { - [self performSelectorOnMainThread:@selector(updateNetworkActivityIndicatorVisibility) withObject:nil waitUntilDone:NO modes:[NSArray arrayWithObject:NSRunLoopCommonModes]]; + [self performSelectorOnMainThread:@selector(updateNetworkActivityIndicatorVisibility) withObject:nil waitUntilDone:NO modes:@[NSRunLoopCommonModes]]; } } } - (BOOL)isNetworkActivityIndicatorVisible { - return _activityCount > 0; + return self.activityCount > 0; } - (void)updateNetworkActivityIndicatorVisibility { [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:[self isNetworkActivityIndicatorVisible]]; } -// Not exposed, but used if activityCount is set via KVC. -- (NSInteger)activityCount { - return _activityCount; -} - - (void)setActivityCount:(NSInteger)activityCount { @synchronized(self) { _activityCount = activityCount; } - [self updateNetworkActivityIndicatorVisibilityDelayed]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateNetworkActivityIndicatorVisibilityDelayed]; + }); } - (void)incrementActivityCount { @@ -114,16 +133,37 @@ - (void)incrementActivityCount { _activityCount++; } [self didChangeValueForKey:@"activityCount"]; - [self updateNetworkActivityIndicatorVisibilityDelayed]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateNetworkActivityIndicatorVisibilityDelayed]; + }); } - (void)decrementActivityCount { [self willChangeValueForKey:@"activityCount"]; @synchronized(self) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" _activityCount = MAX(_activityCount - 1, 0); +#pragma clang diagnostic pop } [self didChangeValueForKey:@"activityCount"]; - [self updateNetworkActivityIndicatorVisibilityDelayed]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateNetworkActivityIndicatorVisibilityDelayed]; + }); +} + +- (void)networkRequestDidStart:(NSNotification *)notification { + if ([AFNetworkRequestFromNotification(notification) URL]) { + [self incrementActivityCount]; + } +} + +- (void)networkRequestDidFinish:(NSNotification *)notification { + if ([AFNetworkRequestFromNotification(notification) URL]) { + [self decrementActivityCount]; + } } @end diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h b/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h new file mode 100644 index 0000000..be6382c --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h @@ -0,0 +1,65 @@ +// UIActivityIndicatorView+AFNetworking.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import + + +@class AFURLConnectionOperation; + +/** + This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a request operation or session task. + */ +@interface UIActivityIndicatorView (AFNetworking) + +///---------------------------------- +/// @name Animating for Session Tasks +///---------------------------------- + +/** + Binds the animating state to the state of the specified task. + + @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. + */ +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) +- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task; +#endif + +///--------------------------------------- +/// @name Animating for Request Operations +///--------------------------------------- + +/** + Binds the animating state to the execution state of the specified operation. + + @param operation The operation. If `nil`, automatic updating from any previously specified operation will be disabled. + */ +- (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation; + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m b/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m new file mode 100644 index 0000000..8470ec4 --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m @@ -0,0 +1,97 @@ +// UIActivityIndicatorView+AFNetworking.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIActivityIndicatorView+AFNetworking.h" + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import "AFHTTPRequestOperation.h" + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 +#import "AFURLSessionManager.h" +#endif + +@implementation UIActivityIndicatorView (AFNetworking) + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 +- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + + [notificationCenter removeObserver:self name:AFNetworkingTaskDidStartNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidFinishNotification object:nil]; + + if (task) { + if (task.state != NSURLSessionTaskStateCompleted) { + if (task.state == NSURLSessionTaskStateRunning) { + [self startAnimating]; + } else { + [self stopAnimating]; + } + + [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidStartNotification object:task]; + [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidFinishNotification object:task]; + [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task]; + } + } +} +#endif + +#pragma mark - + +- (void)setAnimatingWithStateOfOperation:(AFURLConnectionOperation *)operation { + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + + [notificationCenter removeObserver:self name:AFNetworkingOperationDidStartNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingOperationDidFinishNotification object:nil]; + + if (operation) { + if (![operation isFinished]) { + if ([operation isExecuting]) { + [self startAnimating]; + } else { + [self stopAnimating]; + } + + [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingOperationDidStartNotification object:operation]; + [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingOperationDidFinishNotification object:operation]; + } + } +} + +#pragma mark - + +- (void)af_startAnimating { + dispatch_async(dispatch_get_main_queue(), ^{ + [self startAnimating]; + }); +} + +- (void)af_stopAnimating { + dispatch_async(dispatch_get_main_queue(), ^{ + [self stopAnimating]; + }); +} + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h b/Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h new file mode 100644 index 0000000..75060c2 --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h @@ -0,0 +1,96 @@ +// UIAlertView+AFNetworking.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import + +@class AFURLConnectionOperation; + +/** + This category adds methods to the UIKit framework's `UIAlertView` class. The methods in this category provide support for automatically showing an alert if a session task or request operation finishes with an error. Alert title and message are filled from the corresponding `localizedDescription` & `localizedRecoverySuggestion` or `localizedFailureReason` of the error. + */ +@interface UIAlertView (AFNetworking) + +///------------------------------------- +/// @name Showing Alert for Session Task +///------------------------------------- + +/** + Shows an alert view with the error of the specified session task, if any. + + @param task The session task. + @param delegate The alert view delegate. + */ +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 ++ (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task + delegate:(id)delegate; +#endif + +/** + Shows an alert view with the error of the specified session task, if any, with a custom cancel button title and other button titles. + + @param task The session task. + @param delegate The alert view delegate. + @param cancelButtonTitle The title of the cancel button or nil if there is no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title. + @param otherButtonTitles The title of another button. Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons. Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see "Temporary Views". Titles of additional buttons to add to the receiver, terminated with `nil`. + */ +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 ++ (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task + delegate:(id)delegate + cancelButtonTitle:(NSString *)cancelButtonTitle + otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; +#endif + +///------------------------------------------ +/// @name Showing Alert for Request Operation +///------------------------------------------ + +/** + Shows an alert view with the error of the specified request operation, if any. + + @param operation The request operation. + @param delegate The alert view delegate. + */ ++ (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation + delegate:(id)delegate; + +/** + Shows an alert view with the error of the specified request operation, if any, with a custom cancel button title and other button titles. + + @param operation The request operation. + @param delegate The alert view delegate. + @param cancelButtonTitle The title of the cancel button or nil if there is no cancel button. Using this argument is equivalent to setting the cancel button index to the value returned by invoking addButtonWithTitle: specifying this title. + @param otherButtonTitles The title of another button. Using this argument is equivalent to invoking addButtonWithTitle: with this title to add more buttons. Too many buttons can cause the alert view to scroll. For guidelines on the best ways to use an alert in an app, see "Temporary Views". Titles of additional buttons to add to the receiver, terminated with `nil`. + */ ++ (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation + delegate:(id)delegate + cancelButtonTitle:(NSString *)cancelButtonTitle + otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.m b/Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.m new file mode 100644 index 0000000..788a25b --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.m @@ -0,0 +1,111 @@ +// UIAlertView+AFNetworking.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIAlertView+AFNetworking.h" + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import "AFURLConnectionOperation.h" + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 +#import "AFURLSessionManager.h" +#endif + +static void AFGetAlertViewTitleAndMessageFromError(NSError *error, NSString * __autoreleasing *title, NSString * __autoreleasing *message) { + if (error.localizedDescription && (error.localizedRecoverySuggestion || error.localizedFailureReason)) { + *title = error.localizedDescription; + + if (error.localizedRecoverySuggestion) { + *message = error.localizedRecoverySuggestion; + } else { + *message = error.localizedFailureReason; + } + } else if (error.localizedDescription) { + *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description"); + *message = error.localizedDescription; + } else { + *title = NSLocalizedStringFromTable(@"Error", @"AFNetworking", @"Fallback Error Description"); + *message = [NSString stringWithFormat:NSLocalizedStringFromTable(@"%@ Error: %d", @"AFNetworking", @"Fallback Error Failure Reason Format"), error.domain, error.code]; + } +} + +@implementation UIAlertView (AFNetworking) + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 ++ (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task + delegate:(id)delegate +{ + [self showAlertViewForTaskWithErrorOnCompletion:task delegate:delegate cancelButtonTitle:NSLocalizedStringFromTable(@"Dismiss", @"AFNetworking", @"UIAlertView Cancel Button Title") otherButtonTitles:nil, nil]; +} + ++ (void)showAlertViewForTaskWithErrorOnCompletion:(NSURLSessionTask *)task + delegate:(id)delegate + cancelButtonTitle:(NSString *)cancelButtonTitle + otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION +{ + __block id observer = [[NSNotificationCenter defaultCenter] addObserverForName:AFNetworkingTaskDidFinishNotification object:task queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { + + NSError *error = notification.userInfo[AFNetworkingTaskDidFinishErrorKey]; + if (error) { + NSString *title, *message; + AFGetAlertViewTitleAndMessageFromError(error, &title, &message); + + [[[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitles, nil] show]; + } + + [[NSNotificationCenter defaultCenter] removeObserver:observer name:AFNetworkingTaskDidFinishNotification object:notification.object]; + }]; +} +#endif + +#pragma mark - + ++ (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation + delegate:(id)delegate +{ + [self showAlertViewForRequestOperationWithErrorOnCompletion:operation delegate:delegate cancelButtonTitle:NSLocalizedStringFromTable(@"Dismiss", @"AFNetworking", @"UIAlert View Cancel Button Title") otherButtonTitles:nil, nil]; +} + ++ (void)showAlertViewForRequestOperationWithErrorOnCompletion:(AFURLConnectionOperation *)operation + delegate:(id)delegate + cancelButtonTitle:(NSString *)cancelButtonTitle + otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION +{ + __block id observer = [[NSNotificationCenter defaultCenter] addObserverForName:AFNetworkingOperationDidFinishNotification object:operation queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notification) { + + if (notification.object && [notification.object isKindOfClass:[AFURLConnectionOperation class]]) { + NSError *error = [(AFURLConnectionOperation *)notification.object error]; + if (error) { + NSString *title, *message; + AFGetAlertViewTitleAndMessageFromError(error, &title, &message); + + [[[UIAlertView alloc] initWithTitle:title message:message delegate:delegate cancelButtonTitle:cancelButtonTitle otherButtonTitles:otherButtonTitles, nil] show]; + } + } + + [[NSNotificationCenter defaultCenter] removeObserver:observer name:AFNetworkingOperationDidFinishNotification object:notification.object]; + }]; +} + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h b/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h new file mode 100644 index 0000000..52649b6 --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h @@ -0,0 +1,146 @@ +// UIButton+AFNetworking.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import + +/** + This category adds methods to the UIKit framework's `UIButton` class. The methods in this category provide support for loading remote images and background images asynchronously from a URL. + */ +@interface UIButton (AFNetworking) + +///-------------------- +/// @name Setting Image +///-------------------- + +/** + Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + @param state The control state. + @param url The URL used for the image request. + */ +- (void)setImageForState:(UIControlState)state + withURL:(NSURL *)url; + +/** + Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + @param state The control state. + @param url The URL used for the image request. + @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes. + */ +- (void)setImageForState:(UIControlState)state + withURL:(NSURL *)url + placeholderImage:(UIImage *)placeholderImage; + +/** + Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setImage:forState:` is applied. + + @param state The control state. + @param urlRequest The URL request used for the image request. + @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes. + @param success A block to be executed when the image request operation finishes successfully. This block has no return value and takes two arguments: the server response and the image. If the image was returned from cache, the request and response parameters will be `nil`. + @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes a single argument: the error that occurred. + */ +- (void)setImageForState:(UIControlState)state + withURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(UIImage *)placeholderImage + success:(void (^)(NSHTTPURLResponse *response, UIImage *image))success + failure:(void (^)(NSError *error))failure; + + +///------------------------------- +/// @name Setting Background Image +///------------------------------- + +/** + Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous background image request for the receiver will be cancelled. + + If the background image is cached locally, the background image is set immediately, otherwise the specified placeholder background image will be set immediately, and then the remote background image will be set once the request is finished. + + @param state The control state. + @param url The URL used for the background image request. + */ +- (void)setBackgroundImageForState:(UIControlState)state + withURL:(NSURL *)url; + +/** + Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + @param state The control state. + @param url The URL used for the background image request. + @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes. + */ +- (void)setBackgroundImageForState:(UIControlState)state + withURL:(NSURL *)url + placeholderImage:(UIImage *)placeholderImage; + +/** + Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setBackgroundImage:forState:` is applied. + + @param state The control state. + @param urlRequest The URL request used for the image request. + @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes. + */ +- (void)setBackgroundImageForState:(UIControlState)state + withURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(UIImage *)placeholderImage + success:(void (^)(NSHTTPURLResponse *response, UIImage *image))success + failure:(void (^)(NSError *error))failure; + + +///------------------------------ +/// @name Canceling Image Loading +///------------------------------ + +/** + Cancels any executing image operation for the receiver, if one exists. + */ +- (void)cancelImageRequestOperation; + +/** + Cancels any executing background image operation for the receiver, if one exists. + */ +- (void)cancelBackgroundImageRequestOperation; + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m b/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m new file mode 100644 index 0000000..5f79d14 --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m @@ -0,0 +1,192 @@ +// UIButton+AFNetworking.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIButton+AFNetworking.h" + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import "AFHTTPRequestOperation.h" + +static char kAFImageRequestOperationKey; +static char kAFBackgroundImageRequestOperationKey; + +@interface UIButton (_AFNetworking) +@property (readwrite, nonatomic, strong, setter = af_setImageRequestOperation:) AFHTTPRequestOperation *af_imageRequestOperation; +@property (readwrite, nonatomic, strong, setter = af_setBackgroundImageRequestOperation:) AFHTTPRequestOperation *af_backgroundImageRequestOperation; +@end + +@implementation UIButton (_AFNetworking) + ++ (NSOperationQueue *)af_sharedImageRequestOperationQueue { + static NSOperationQueue *_af_sharedImageRequestOperationQueue = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _af_sharedImageRequestOperationQueue = [[NSOperationQueue alloc] init]; + _af_sharedImageRequestOperationQueue.maxConcurrentOperationCount = NSOperationQueueDefaultMaxConcurrentOperationCount; + }); + + return _af_sharedImageRequestOperationQueue; +} + +- (AFHTTPRequestOperation *)af_imageRequestOperation { + return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, &kAFImageRequestOperationKey); +} + +- (void)af_setImageRequestOperation:(AFHTTPRequestOperation *)imageRequestOperation { + objc_setAssociatedObject(self, &kAFImageRequestOperationKey, imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (AFHTTPRequestOperation *)af_backgroundImageRequestOperation { + return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, &kAFBackgroundImageRequestOperationKey); +} + +- (void)af_setBackgroundImageRequestOperation:(AFHTTPRequestOperation *)imageRequestOperation { + objc_setAssociatedObject(self, &kAFBackgroundImageRequestOperationKey, imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#pragma mark - + +@implementation UIButton (AFNetworking) + +- (void)setImageForState:(UIControlState)state + withURL:(NSURL *)url +{ + [self setImageForState:state withURL:url placeholderImage:nil]; +} + +- (void)setImageForState:(UIControlState)state + withURL:(NSURL *)url + placeholderImage:(UIImage *)placeholderImage +{ + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; + [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; + + [self setImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; +} + +- (void)setImageForState:(UIControlState)state + withURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(UIImage *)placeholderImage + success:(void (^)(NSHTTPURLResponse *response, UIImage *image))success + failure:(void (^)(NSError *error))failure +{ + [self cancelImageRequestOperation]; + + [self setImage:placeholderImage forState:state]; + + __weak __typeof(self)weakSelf = self; + self.af_imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; + self.af_imageRequestOperation.responseSerializer = [AFImageResponseSerializer serializer]; + [self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([[urlRequest URL] isEqual:[operation.request URL]]) { + if (success) { + success(operation.response, responseObject); + } else if (responseObject) { + [strongSelf setImage:responseObject forState:state]; + } + } else { + + } + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + if ([[urlRequest URL] isEqual:[operation.response URL]]) { + if (failure) { + failure(error); + } + } + }]; + + [[[self class] af_sharedImageRequestOperationQueue] addOperation:self.af_imageRequestOperation]; +} + +#pragma mark - + +- (void)setBackgroundImageForState:(UIControlState)state + withURL:(NSURL *)url +{ + [self setBackgroundImageForState:state withURL:url placeholderImage:nil]; +} + +- (void)setBackgroundImageForState:(UIControlState)state + withURL:(NSURL *)url + placeholderImage:(UIImage *)placeholderImage +{ + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; + [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; + + [self setBackgroundImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; +} + +- (void)setBackgroundImageForState:(UIControlState)state + withURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(UIImage *)placeholderImage + success:(void (^)(NSHTTPURLResponse *response, UIImage *image))success + failure:(void (^)(NSError *error))failure +{ + [self cancelBackgroundImageRequestOperation]; + + [self setBackgroundImage:placeholderImage forState:state]; + + __weak __typeof(self)weakSelf = self; + self.af_backgroundImageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; + self.af_backgroundImageRequestOperation.responseSerializer = [AFImageResponseSerializer serializer]; + [self.af_backgroundImageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([[urlRequest URL] isEqual:[operation.request URL]]) { + if (success) { + success(operation.response, responseObject); + } else if (responseObject) { + [strongSelf setBackgroundImage:responseObject forState:state]; + } + } else { + + } + } failure:^(AFHTTPRequestOperation *operation, NSError *error) { + if ([[urlRequest URL] isEqual:[operation.response URL]]) { + if (failure) { + failure(error); + } + } + }]; + + [[[self class] af_sharedImageRequestOperationQueue] addOperation:self.af_backgroundImageRequestOperation]; +} + +#pragma mark - + +- (void)cancelImageRequestOperation { + [self.af_imageRequestOperation cancel]; + self.af_imageRequestOperation = nil; +} + +- (void)cancelBackgroundImageRequestOperation { + [self.af_backgroundImageRequestOperation cancel]; + self.af_backgroundImageRequestOperation = nil; +} + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h b/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h new file mode 100644 index 0000000..ee117cd --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h @@ -0,0 +1,101 @@ +// UIImageView+AFNetworking.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import + +#import "AFURLResponseSerialization.h" + +/** + This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL. + */ +@interface UIImageView (AFNetworking) + +///------------------------------------ +/// @name Accessing Response Serializer +///------------------------------------ + +/** + The response serializer used to create an image representation from the server response and response data. By default, this is an instance of `AFImageResponseSerializer`. + + @discussion Subclasses of `AFImageResponseSerializer` could be used to perform post-processing, such as color correction, face detection, or other effects. See https://github.com/AFNetworking/AFCoreImageSerializer + */ +@property (nonatomic, strong) AFImageResponseSerializer * imageResponseSerializer; + +///-------------------- +/// @name Setting Image +///-------------------- + +/** + Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + By default, URL requests have a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` + + @param url The URL used for the image request. + */ +- (void)setImageWithURL:(NSURL *)url; + +/** + Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + By default, URL requests have a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` + + @param url The URL used for the image request. + @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. + */ +- (void)setImageWithURL:(NSURL *)url + placeholderImage:(UIImage *)placeholderImage; + +/** + Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied. + + @param urlRequest The URL request used for the image request. + @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. + @param success A block to be executed when the image request operation finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the request and response parameters will be `nil`. + @param failure A block object to be executed when the image request operation finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. + */ +- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(UIImage *)placeholderImage + success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success + failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure; + +/** + Cancels any executing image operation for the receiver, if one exists. + */ +- (void)cancelImageRequestOperation; + +@end + +#endif diff --git a/AFNetworking/UIImageView+AFNetworking.m b/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m old mode 100755 new mode 100644 similarity index 59% rename from AFNetworking/UIImageView+AFNetworking.m rename to Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m index f399c0e..173f52a --- a/AFNetworking/UIImageView+AFNetworking.m +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m @@ -1,17 +1,17 @@ // UIImageView+AFNetworking.m // -// Copyright (c) 2011 Gowalla (http://gowalla.com/) -// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -20,11 +20,13 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -#import +#import "UIImageView+AFNetworking.h" + #import #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) -#import "UIImageView+AFNetworking.h" + +#import "AFHTTPRequestOperation.h" @interface AFImageCache : NSCache - (UIImage *)cachedImageForRequest:(NSURLRequest *)request; @@ -34,37 +36,24 @@ - (void)cacheImage:(UIImage *)image #pragma mark - -static char kAFImageRequestOperationObjectKey; +static char kAFImageRequestOperationKey; +static char kAFResponseSerializerKey; @interface UIImageView (_AFNetworking) -@property (readwrite, nonatomic, strong, setter = af_setImageRequestOperation:) AFImageRequestOperation *af_imageRequestOperation; +@property (readwrite, nonatomic, strong, setter = af_setImageRequestOperation:) AFHTTPRequestOperation *af_imageRequestOperation; @end @implementation UIImageView (_AFNetworking) -@dynamic af_imageRequestOperation; -@end - -#pragma mark - - -@implementation UIImageView (AFNetworking) - -- (AFHTTPRequestOperation *)af_imageRequestOperation { - return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, &kAFImageRequestOperationObjectKey); -} - -- (void)af_setImageRequestOperation:(AFImageRequestOperation *)imageRequestOperation { - objc_setAssociatedObject(self, &kAFImageRequestOperationObjectKey, imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); -} + (NSOperationQueue *)af_sharedImageRequestOperationQueue { - static NSOperationQueue *_af_imageRequestOperationQueue = nil; + static NSOperationQueue *_af_sharedImageRequestOperationQueue = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - _af_imageRequestOperationQueue = [[NSOperationQueue alloc] init]; - [_af_imageRequestOperationQueue setMaxConcurrentOperationCount:NSOperationQueueDefaultMaxConcurrentOperationCount]; + _af_sharedImageRequestOperationQueue = [[NSOperationQueue alloc] init]; + _af_sharedImageRequestOperationQueue.maxConcurrentOperationCount = NSOperationQueueDefaultMaxConcurrentOperationCount; }); - - return _af_imageRequestOperationQueue; + + return _af_sharedImageRequestOperationQueue; } + (AFImageCache *)af_sharedImageCache { @@ -72,70 +61,105 @@ + (AFImageCache *)af_sharedImageCache { static dispatch_once_t oncePredicate; dispatch_once(&oncePredicate, ^{ _af_imageCache = [[AFImageCache alloc] init]; + + [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidReceiveMemoryWarningNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification * __unused notification) { + [_af_imageCache removeAllObjects]; + }]; }); - + return _af_imageCache; } +- (AFHTTPRequestOperation *)af_imageRequestOperation { + return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, &kAFImageRequestOperationKey); +} + +- (void)af_setImageRequestOperation:(AFHTTPRequestOperation *)imageRequestOperation { + objc_setAssociatedObject(self, &kAFImageRequestOperationKey, imageRequestOperation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#pragma mark - + +@implementation UIImageView (AFNetworking) +@dynamic imageResponseSerializer; + +- (id )imageResponseSerializer { + static id _af_defaultImageResponseSerializer = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _af_defaultImageResponseSerializer = [AFImageResponseSerializer serializer]; + }); + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + return objc_getAssociatedObject(self, &kAFResponseSerializerKey) ?: _af_defaultImageResponseSerializer; +#pragma clang diagnostic pop +} + +- (void)setImageResponseSerializer:(id )serializer { + objc_setAssociatedObject(self, &kAFResponseSerializerKey, serializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + #pragma mark - - (void)setImageWithURL:(NSURL *)url { [self setImageWithURL:url placeholderImage:nil]; } -- (void)setImageWithURL:(NSURL *)url +- (void)setImageWithURL:(NSURL *)url placeholderImage:(UIImage *)placeholderImage { NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; - [request setHTTPShouldHandleCookies:NO]; [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; - + [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; } -- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest - placeholderImage:(UIImage *)placeholderImage +- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(UIImage *)placeholderImage success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure { [self cancelImageRequestOperation]; - + UIImage *cachedImage = [[[self class] af_sharedImageCache] cachedImageForRequest:urlRequest]; if (cachedImage) { - self.image = cachedImage; - self.af_imageRequestOperation = nil; - if (success) { success(nil, nil, cachedImage); + } else { + self.image = cachedImage; } + + self.af_imageRequestOperation = nil; } else { self.image = placeholderImage; - - AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest]; - [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { - if ([[urlRequest URL] isEqual:[[self.af_imageRequestOperation request] URL]]) { + + __weak __typeof(self)weakSelf = self; + self.af_imageRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:urlRequest]; + self.af_imageRequestOperation.responseSerializer = self.imageResponseSerializer; + [self.af_imageRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([[urlRequest URL] isEqual:[operation.request URL]]) { if (success) { - success(operation.request, operation.response, responseObject); - } else { - self.image = responseObject; + success(urlRequest, operation.response, responseObject); + } else if (responseObject) { + strongSelf.image = responseObject; } + } else { - self.af_imageRequestOperation = nil; } - [[[self class] af_sharedImageCache] cacheImage:responseObject forRequest:urlRequest]; + [[[strongSelf class] af_sharedImageCache] cacheImage:responseObject forRequest:urlRequest]; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { - if ([[urlRequest URL] isEqual:[[self.af_imageRequestOperation request] URL]]) { + if ([[urlRequest URL] isEqual:[operation.response URL]]) { if (failure) { - failure(operation.request, operation.response, error); + failure(urlRequest, operation.response, error); } - - self.af_imageRequestOperation = nil; } }]; - - self.af_imageRequestOperation = requestOperation; - + [[[self class] af_sharedImageRequestOperationQueue] addOperation:self.af_imageRequestOperation]; } } @@ -163,7 +187,7 @@ - (UIImage *)cachedImageForRequest:(NSURLRequest *)request { default: break; } - + return [self objectForKey:AFImageCacheKeyFromURLRequest(request)]; } diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h b/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h new file mode 100644 index 0000000..d6ea8c2 --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h @@ -0,0 +1,37 @@ +// UIKit+AFNetworking.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#ifndef _UIKIT_AFNETWORKING_ + #define _UIKIT_AFNETWORKING_ + + #import "AFNetworkActivityIndicatorManager.h" + + #import "UIActivityIndicatorView+AFNetworking.h" + #import "UIAlertView+AFNetworking.h" + #import "UIButton+AFNetworking.h" + #import "UIImageView+AFNetworking.h" + #import "UIKit+AFNetworking.h" + #import "UIProgressView+AFNetworking.h" + #import "UIWebView+AFNetworking.h" +#endif /* _UIKIT_AFNETWORKING_ */ diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h b/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h new file mode 100644 index 0000000..3d5d747 --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h @@ -0,0 +1,88 @@ +// UIProgressView+AFNetworking.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import + +@class AFURLConnectionOperation; + +/** + This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task or request operation. + */ +@interface UIProgressView (AFNetworking) + +///------------------------------------ +/// @name Setting Session Task Progress +///------------------------------------ + +/** + Binds the progress to the upload progress of the specified session task. + + @param task The session task. + @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. + */ +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) +- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task + animated:(BOOL)animated; +#endif + +/** + Binds the progress to the download progress of the specified session task. + + @param task The session task. + @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. + */ +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090) +- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task + animated:(BOOL)animated; +#endif + +///------------------------------------ +/// @name Setting Session Task Progress +///------------------------------------ + +/** + Binds the progress to the upload progress of the specified request operation. + + @param operation The request operation. + @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. + */ +- (void)setProgressWithUploadProgressOfOperation:(AFURLConnectionOperation *)operation + animated:(BOOL)animated; + +/** + Binds the progress to the download progress of the specified request operation. + + @param operation The request operation. + @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. + */ +- (void)setProgressWithDownloadProgressOfOperation:(AFURLConnectionOperation *)operation + animated:(BOOL)animated; + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m b/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m new file mode 100644 index 0000000..ff9f24a --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m @@ -0,0 +1,186 @@ +// UIProgressView+AFNetworking.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIProgressView+AFNetworking.h" + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import "AFURLConnectionOperation.h" + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 +#import "AFURLSessionManager.h" +#endif + +static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext; +static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext; + +static char kAFUploadProgressAnimated; +static char kAFDownloadProgressAnimated; + +@interface AFURLConnectionOperation (_UIProgressView) +@property (readwrite, nonatomic, copy) void (^uploadProgress)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected); +@property (readwrite, nonatomic, assign, setter = af_setUploadProgressAnimated:) BOOL af_uploadProgressAnimated; + +@property (readwrite, nonatomic, copy) void (^downloadProgress)(NSUInteger bytes, long long totalBytes, long long totalBytesExpected); +@property (readwrite, nonatomic, assign, setter = af_setDownloadProgressAnimated:) BOOL af_downloadProgressAnimated; +@end + +@implementation AFURLConnectionOperation (_UIProgressView) +@dynamic uploadProgress; // Implemented in AFURLConnectionOperation +@dynamic af_uploadProgressAnimated; + +@dynamic downloadProgress; // Implemented in AFURLConnectionOperation +@dynamic af_downloadProgressAnimated; +@end + +#pragma mark - + +@implementation UIProgressView (AFNetworking) + +- (BOOL)af_uploadProgressAnimated { + return [(NSNumber *)objc_getAssociatedObject(self, &kAFUploadProgressAnimated) boolValue]; +} + +- (void)af_setUploadProgressAnimated:(BOOL)animated { + objc_setAssociatedObject(self, &kAFUploadProgressAnimated, @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (BOOL)af_downloadProgressAnimated { + return [(NSNumber *)objc_getAssociatedObject(self, &kAFDownloadProgressAnimated) boolValue]; +} + +- (void)af_setDownloadProgressAnimated:(BOOL)animated { + objc_setAssociatedObject(self, &kAFDownloadProgressAnimated, @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 + +- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task + animated:(BOOL)animated +{ + [task addObserver:self forKeyPath:@"state" options:0 context:AFTaskCountOfBytesSentContext]; + [task addObserver:self forKeyPath:@"countOfBytesSent" options:0 context:AFTaskCountOfBytesSentContext]; + + [self af_setUploadProgressAnimated:animated]; +} + +- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task + animated:(BOOL)animated +{ + [task addObserver:self forKeyPath:@"state" options:0 context:AFTaskCountOfBytesReceivedContext]; + [task addObserver:self forKeyPath:@"countOfBytesReceived" options:0 context:AFTaskCountOfBytesReceivedContext]; + + [self af_setDownloadProgressAnimated:animated]; +} + +#endif + +#pragma mark - + +- (void)setProgressWithUploadProgressOfOperation:(AFURLConnectionOperation *)operation + animated:(BOOL)animated +{ + __weak __typeof(self)weakSelf = self; + void (^original)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) = [operation.uploadProgress copy]; + [operation setUploadProgressBlock:^(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) { + if (original) { + original(bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); + } + + dispatch_async(dispatch_get_main_queue(), ^{ + if (totalBytesExpectedToWrite > 0) { + [weakSelf setProgress:(totalBytesWritten / (totalBytesExpectedToWrite * 1.0f)) animated:animated]; + } + }); + }]; +} + +- (void)setProgressWithDownloadProgressOfOperation:(AFURLConnectionOperation *)operation + animated:(BOOL)animated +{ + __weak __typeof(self)weakSelf = self; + void (^original)(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) = [operation.downloadProgress copy]; + [operation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead) { + if (original) { + original(bytesRead, totalBytesRead, totalBytesExpectedToRead); + } + + dispatch_async(dispatch_get_main_queue(), ^{ + if (totalBytesExpectedToRead > 0) { + [weakSelf setProgress:(totalBytesRead / (totalBytesExpectedToRead * 1.0f)) animated:animated]; + } + }); + }]; +} + +#pragma mark - NSKeyValueObserving + +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(__unused NSDictionary *)change + context:(void *)context +{ + if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { + if ([object countOfBytesExpectedToSend] > 0) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated]; + }); + } + } + + if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { + if ([object countOfBytesExpectedToReceive] > 0) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated]; + }); + } + } + +#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 70000 + if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) { + if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) { + @try { + [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))]; + + if (context == AFTaskCountOfBytesSentContext) { + [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))]; + } + + if (context == AFTaskCountOfBytesReceivedContext) { + [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))]; + } + } + @catch (NSException * __unused exception) {} + } + } +#endif + } +} + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h b/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h new file mode 100644 index 0000000..1c2b648 --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h @@ -0,0 +1,64 @@ +// UIWebView+AFNetworking.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import + +#import "AFURLRequestSerialization.h" +#import "AFURLResponseSerialization.h" + +/** + This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling. + */ +@interface UIWebView (AFNetworking) + +/** + The request serializer used to serialize requests made with `-loadRequest:progress:success:failure:`. By default, this is an instance of `AFHTTPRequestSerializer`. + */ +@property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; + +/** + The response serializer used to serialize responses made with `-loadRequest:progress:success:failure:`. By default, this is an instance of `AFHTTPResponseSerializer`. + */ +@property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; + +/** + Asynchronously loads the specified request. + + @param request A URL request identifying the location of the content to load. + @param progress A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the main thread. + @param success A block object to be executed when the request finishes loading successfully. This block has no return value and takes two arguments: the response, and the HTML string. + @param failure A block object to be executed when the request operation finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. + */ +- (void)loadRequest:(NSURLRequest *)request + progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress + success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success + failure:(void (^)(NSError *error))failure; + +@end + +#endif diff --git a/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m b/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m new file mode 100644 index 0000000..7d143c2 --- /dev/null +++ b/Pods/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m @@ -0,0 +1,121 @@ +// UIWebView+AFNetworking.m +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIWebView+AFNetworking.h" + +#import + +#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) + +#import "AFHTTPRequestOperation.h" + +static char kAFRequestSerializerKey; +static char kAFResponseSerializerKey; +static char kAFHTTPRequestOperationKey; + +@interface UIWebView (_AFNetworking) +@property (readwrite, nonatomic, strong, setter = af_setHTTPRequestOperation:) AFHTTPRequestOperation *af_HTTPRequestOperation; +@end + +@implementation UIWebView (_AFNetworking) + +- (AFHTTPRequestOperation *)af_HTTPRequestOperation { + return (AFHTTPRequestOperation *)objc_getAssociatedObject(self, &kAFHTTPRequestOperationKey); +} + +- (void)af_setHTTPRequestOperation:(AFHTTPRequestOperation *)operation { + objc_setAssociatedObject(self, &kAFHTTPRequestOperationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#pragma mark - + +@implementation UIWebView (AFNetworking) + +- (AFHTTPRequestSerializer *)requestSerializer { + static AFHTTPRequestSerializer * _af_defaultRequestSerializer = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _af_defaultRequestSerializer = [AFHTTPRequestSerializer serializer]; + }); + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + return objc_getAssociatedObject(self, &kAFRequestSerializerKey) ?: _af_defaultRequestSerializer; +#pragma clang diagnostic pop +} + +- (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { + objc_setAssociatedObject(self, &kAFRequestSerializerKey, requestSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (AFHTTPResponseSerializer *)responseSerializer { + static AFHTTPResponseSerializer * _af_defaultResponseSerializer = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer]; + }); + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + return objc_getAssociatedObject(self, &kAFRequestSerializerKey) ?: _af_defaultResponseSerializer; +#pragma clang diagnostic pop +} + +- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { + objc_setAssociatedObject(self, &kAFResponseSerializerKey, responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - + +- (void)loadRequest:(NSURLRequest *)request + progress:(void (^)(NSUInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite))progress + success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success + failure:(void (^)(NSError *error))failure +{ + if (self.af_HTTPRequestOperation) { + [self.af_HTTPRequestOperation cancel]; + } + + request = [self.requestSerializer requestBySerializingRequest:request withParameters:nil error:nil]; + + self.af_HTTPRequestOperation = [[AFHTTPRequestOperation alloc] initWithRequest:request]; + self.af_HTTPRequestOperation.responseSerializer = self.responseSerializer; + + __weak __typeof(self)weakSelf = self; + [self.af_HTTPRequestOperation setDownloadProgressBlock:progress]; + [self.af_HTTPRequestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id __unused responseObject) { + NSString *HTML = success ? success(operation.response, operation.responseString) : operation.responseString; + [weakSelf loadHTMLString:HTML baseURL:[operation.response URL]]; + } failure:^(AFHTTPRequestOperation * __unused operation, NSError *error) { + if (failure) { + failure(error); + } + }]; + + [self.af_HTTPRequestOperation start]; +} + +@end + +#endif diff --git a/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h b/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h new file mode 120000 index 0000000..d51daed --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFHTTPRequestOperation.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperationManager.h b/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperationManager.h new file mode 120000 index 0000000..6a7fa3a --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperationManager.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFHTTPSessionManager.h b/Pods/BuildHeaders/AFNetworking/AFHTTPSessionManager.h new file mode 120000 index 0000000..dda87e6 --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFHTTPSessionManager.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFHTTPSessionManager.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h b/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h new file mode 120000 index 0000000..2d0d400 --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFNetworkReachabilityManager.h b/Pods/BuildHeaders/AFNetworking/AFNetworkReachabilityManager.h new file mode 120000 index 0000000..14fd177 --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFNetworkReachabilityManager.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFNetworking.h b/Pods/BuildHeaders/AFNetworking/AFNetworking.h new file mode 120000 index 0000000..83dd518 --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFNetworking.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFSecurityPolicy.h b/Pods/BuildHeaders/AFNetworking/AFSecurityPolicy.h new file mode 120000 index 0000000..6a54dc3 --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFSecurityPolicy.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFSecurityPolicy.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h b/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h new file mode 120000 index 0000000..360459d --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFURLConnectionOperation.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFURLRequestSerialization.h b/Pods/BuildHeaders/AFNetworking/AFURLRequestSerialization.h new file mode 120000 index 0000000..32572ec --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFURLRequestSerialization.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFURLRequestSerialization.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFURLResponseSerialization.h b/Pods/BuildHeaders/AFNetworking/AFURLResponseSerialization.h new file mode 120000 index 0000000..4b70627 --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFURLResponseSerialization.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFURLResponseSerialization.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/AFURLSessionManager.h b/Pods/BuildHeaders/AFNetworking/AFURLSessionManager.h new file mode 120000 index 0000000..a206011 --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/AFURLSessionManager.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFURLSessionManager.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/UIActivityIndicatorView+AFNetworking.h b/Pods/BuildHeaders/AFNetworking/UIActivityIndicatorView+AFNetworking.h new file mode 120000 index 0000000..8634d2d --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/UIActivityIndicatorView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/UIAlertView+AFNetworking.h b/Pods/BuildHeaders/AFNetworking/UIAlertView+AFNetworking.h new file mode 120000 index 0000000..3eb67fb --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/UIAlertView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/UIButton+AFNetworking.h b/Pods/BuildHeaders/AFNetworking/UIButton+AFNetworking.h new file mode 120000 index 0000000..32c242d --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/UIButton+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h b/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h new file mode 120000 index 0000000..d3fab3c --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/UIKit+AFNetworking.h b/Pods/BuildHeaders/AFNetworking/UIKit+AFNetworking.h new file mode 120000 index 0000000..6d1d448 --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/UIKit+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/UIProgressView+AFNetworking.h b/Pods/BuildHeaders/AFNetworking/UIProgressView+AFNetworking.h new file mode 120000 index 0000000..f32234c --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/UIProgressView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h \ No newline at end of file diff --git a/Pods/BuildHeaders/AFNetworking/UIWebView+AFNetworking.h b/Pods/BuildHeaders/AFNetworking/UIWebView+AFNetworking.h new file mode 120000 index 0000000..776285f --- /dev/null +++ b/Pods/BuildHeaders/AFNetworking/UIWebView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h \ No newline at end of file diff --git a/Pods/BuildHeaders/RaptureXML/RXMLElement.h b/Pods/BuildHeaders/RaptureXML/RXMLElement.h new file mode 120000 index 0000000..aa0d8f0 --- /dev/null +++ b/Pods/BuildHeaders/RaptureXML/RXMLElement.h @@ -0,0 +1 @@ +../../RaptureXML/RaptureXML/RXMLElement.h \ No newline at end of file diff --git a/Pods/BuildHeaders/SSZipArchive/minizip/SSZipArchive.h b/Pods/BuildHeaders/SSZipArchive/minizip/SSZipArchive.h new file mode 120000 index 0000000..951d734 --- /dev/null +++ b/Pods/BuildHeaders/SSZipArchive/minizip/SSZipArchive.h @@ -0,0 +1 @@ +../../../SSZipArchive/SSZipArchive/SSZipArchive.h \ No newline at end of file diff --git a/Pods/BuildHeaders/SSZipArchive/minizip/crypt.h b/Pods/BuildHeaders/SSZipArchive/minizip/crypt.h new file mode 120000 index 0000000..ef3d494 --- /dev/null +++ b/Pods/BuildHeaders/SSZipArchive/minizip/crypt.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/crypt.h \ No newline at end of file diff --git a/Pods/BuildHeaders/SSZipArchive/minizip/ioapi.h b/Pods/BuildHeaders/SSZipArchive/minizip/ioapi.h new file mode 120000 index 0000000..5b2d43a --- /dev/null +++ b/Pods/BuildHeaders/SSZipArchive/minizip/ioapi.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/ioapi.h \ No newline at end of file diff --git a/Pods/BuildHeaders/SSZipArchive/minizip/mztools.h b/Pods/BuildHeaders/SSZipArchive/minizip/mztools.h new file mode 120000 index 0000000..a397857 --- /dev/null +++ b/Pods/BuildHeaders/SSZipArchive/minizip/mztools.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/mztools.h \ No newline at end of file diff --git a/Pods/BuildHeaders/SSZipArchive/minizip/unzip.h b/Pods/BuildHeaders/SSZipArchive/minizip/unzip.h new file mode 120000 index 0000000..c6d4b37 --- /dev/null +++ b/Pods/BuildHeaders/SSZipArchive/minizip/unzip.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/unzip.h \ No newline at end of file diff --git a/Pods/BuildHeaders/SSZipArchive/minizip/zip.h b/Pods/BuildHeaders/SSZipArchive/minizip/zip.h new file mode 120000 index 0000000..6006e84 --- /dev/null +++ b/Pods/BuildHeaders/SSZipArchive/minizip/zip.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/zip.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h b/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h new file mode 120000 index 0000000..d51daed --- /dev/null +++ b/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFHTTPRequestOperation.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFHTTPRequestOperationManager.h b/Pods/Headers/AFNetworking/AFHTTPRequestOperationManager.h new file mode 120000 index 0000000..6a7fa3a --- /dev/null +++ b/Pods/Headers/AFNetworking/AFHTTPRequestOperationManager.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFHTTPRequestOperationManager.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFHTTPSessionManager.h b/Pods/Headers/AFNetworking/AFHTTPSessionManager.h new file mode 120000 index 0000000..dda87e6 --- /dev/null +++ b/Pods/Headers/AFNetworking/AFHTTPSessionManager.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFHTTPSessionManager.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h b/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h new file mode 120000 index 0000000..2d0d400 --- /dev/null +++ b/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFNetworkReachabilityManager.h b/Pods/Headers/AFNetworking/AFNetworkReachabilityManager.h new file mode 120000 index 0000000..14fd177 --- /dev/null +++ b/Pods/Headers/AFNetworking/AFNetworkReachabilityManager.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFNetworkReachabilityManager.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFNetworking.h b/Pods/Headers/AFNetworking/AFNetworking.h new file mode 120000 index 0000000..83dd518 --- /dev/null +++ b/Pods/Headers/AFNetworking/AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFNetworking.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFSecurityPolicy.h b/Pods/Headers/AFNetworking/AFSecurityPolicy.h new file mode 120000 index 0000000..6a54dc3 --- /dev/null +++ b/Pods/Headers/AFNetworking/AFSecurityPolicy.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFSecurityPolicy.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFURLConnectionOperation.h b/Pods/Headers/AFNetworking/AFURLConnectionOperation.h new file mode 120000 index 0000000..360459d --- /dev/null +++ b/Pods/Headers/AFNetworking/AFURLConnectionOperation.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFURLConnectionOperation.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFURLRequestSerialization.h b/Pods/Headers/AFNetworking/AFURLRequestSerialization.h new file mode 120000 index 0000000..32572ec --- /dev/null +++ b/Pods/Headers/AFNetworking/AFURLRequestSerialization.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFURLRequestSerialization.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFURLResponseSerialization.h b/Pods/Headers/AFNetworking/AFURLResponseSerialization.h new file mode 120000 index 0000000..4b70627 --- /dev/null +++ b/Pods/Headers/AFNetworking/AFURLResponseSerialization.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFURLResponseSerialization.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/AFURLSessionManager.h b/Pods/Headers/AFNetworking/AFURLSessionManager.h new file mode 120000 index 0000000..a206011 --- /dev/null +++ b/Pods/Headers/AFNetworking/AFURLSessionManager.h @@ -0,0 +1 @@ +../../AFNetworking/AFNetworking/AFURLSessionManager.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/UIActivityIndicatorView+AFNetworking.h b/Pods/Headers/AFNetworking/UIActivityIndicatorView+AFNetworking.h new file mode 120000 index 0000000..8634d2d --- /dev/null +++ b/Pods/Headers/AFNetworking/UIActivityIndicatorView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/UIAlertView+AFNetworking.h b/Pods/Headers/AFNetworking/UIAlertView+AFNetworking.h new file mode 120000 index 0000000..3eb67fb --- /dev/null +++ b/Pods/Headers/AFNetworking/UIAlertView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIAlertView+AFNetworking.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/UIButton+AFNetworking.h b/Pods/Headers/AFNetworking/UIButton+AFNetworking.h new file mode 120000 index 0000000..32c242d --- /dev/null +++ b/Pods/Headers/AFNetworking/UIButton+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h b/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h new file mode 120000 index 0000000..d3fab3c --- /dev/null +++ b/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/UIKit+AFNetworking.h b/Pods/Headers/AFNetworking/UIKit+AFNetworking.h new file mode 120000 index 0000000..6d1d448 --- /dev/null +++ b/Pods/Headers/AFNetworking/UIKit+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/UIProgressView+AFNetworking.h b/Pods/Headers/AFNetworking/UIProgressView+AFNetworking.h new file mode 120000 index 0000000..f32234c --- /dev/null +++ b/Pods/Headers/AFNetworking/UIProgressView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h \ No newline at end of file diff --git a/Pods/Headers/AFNetworking/UIWebView+AFNetworking.h b/Pods/Headers/AFNetworking/UIWebView+AFNetworking.h new file mode 120000 index 0000000..776285f --- /dev/null +++ b/Pods/Headers/AFNetworking/UIWebView+AFNetworking.h @@ -0,0 +1 @@ +../../AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h \ No newline at end of file diff --git a/Pods/Headers/RaptureXML/RXMLElement.h b/Pods/Headers/RaptureXML/RXMLElement.h new file mode 120000 index 0000000..aa0d8f0 --- /dev/null +++ b/Pods/Headers/RaptureXML/RXMLElement.h @@ -0,0 +1 @@ +../../RaptureXML/RaptureXML/RXMLElement.h \ No newline at end of file diff --git a/Pods/Headers/SSZipArchive/minizip/SSZipArchive.h b/Pods/Headers/SSZipArchive/minizip/SSZipArchive.h new file mode 120000 index 0000000..951d734 --- /dev/null +++ b/Pods/Headers/SSZipArchive/minizip/SSZipArchive.h @@ -0,0 +1 @@ +../../../SSZipArchive/SSZipArchive/SSZipArchive.h \ No newline at end of file diff --git a/Pods/Headers/SSZipArchive/minizip/crypt.h b/Pods/Headers/SSZipArchive/minizip/crypt.h new file mode 120000 index 0000000..ef3d494 --- /dev/null +++ b/Pods/Headers/SSZipArchive/minizip/crypt.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/crypt.h \ No newline at end of file diff --git a/Pods/Headers/SSZipArchive/minizip/ioapi.h b/Pods/Headers/SSZipArchive/minizip/ioapi.h new file mode 120000 index 0000000..5b2d43a --- /dev/null +++ b/Pods/Headers/SSZipArchive/minizip/ioapi.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/ioapi.h \ No newline at end of file diff --git a/Pods/Headers/SSZipArchive/minizip/mztools.h b/Pods/Headers/SSZipArchive/minizip/mztools.h new file mode 120000 index 0000000..a397857 --- /dev/null +++ b/Pods/Headers/SSZipArchive/minizip/mztools.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/mztools.h \ No newline at end of file diff --git a/Pods/Headers/SSZipArchive/minizip/unzip.h b/Pods/Headers/SSZipArchive/minizip/unzip.h new file mode 120000 index 0000000..c6d4b37 --- /dev/null +++ b/Pods/Headers/SSZipArchive/minizip/unzip.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/unzip.h \ No newline at end of file diff --git a/Pods/Headers/SSZipArchive/minizip/zip.h b/Pods/Headers/SSZipArchive/minizip/zip.h new file mode 120000 index 0000000..6006e84 --- /dev/null +++ b/Pods/Headers/SSZipArchive/minizip/zip.h @@ -0,0 +1 @@ +../../../SSZipArchive/minizip/zip.h \ No newline at end of file diff --git a/Pods/Manifest.lock b/Pods/Manifest.lock new file mode 100644 index 0000000..b3b83ce --- /dev/null +++ b/Pods/Manifest.lock @@ -0,0 +1,35 @@ +PODS: + - AFNetworking (2.0.1): + - AFNetworking/NSURLConnection + - AFNetworking/NSURLSession + - AFNetworking/Reachability + - AFNetworking/Security + - AFNetworking/Serialization + - AFNetworking/UIKit + - AFNetworking/NSURLConnection (2.0.1): + - AFNetworking/Reachability + - AFNetworking/Security + - AFNetworking/Serialization + - AFNetworking/NSURLSession (2.0.1): + - AFNetworking/Reachability + - AFNetworking/Security + - AFNetworking/Serialization + - AFNetworking/Reachability (2.0.1) + - AFNetworking/Security (2.0.1) + - AFNetworking/Serialization (2.0.1) + - AFNetworking/UIKit (2.0.1): + - AFNetworking/NSURLConnection + - RaptureXML (1.0.1) + - SSZipArchive (0.3.1) + +DEPENDENCIES: + - AFNetworking + - RaptureXML + - SSZipArchive + +SPEC CHECKSUMS: + AFNetworking: a6f11ac4ac087303e6ff87adc1ba57b0dac20ef8 + RaptureXML: ef017fda62eb95c60300108366d1f0cd0c28cbd4 + SSZipArchive: 47d0589a15452311749a4eeecb97e12800d127de + +COCOAPODS: 0.25.0 diff --git a/Pods/Pods-AFNetworking-Private.xcconfig b/Pods/Pods-AFNetworking-Private.xcconfig new file mode 100644 index 0000000..ed89727 --- /dev/null +++ b/Pods/Pods-AFNetworking-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-AFNetworking.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/AFNetworking" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/RaptureXML" "${PODS_ROOT}/Headers/SSZipArchive" "${PODS_ROOT}/Headers/SSZipArchive/minizip" +OTHER_LDFLAGS = -ObjC ${PODS_AFNETWORKING_OTHER_LDFLAGS} +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/Pods/Pods-AFNetworking-dummy.m b/Pods/Pods-AFNetworking-dummy.m new file mode 100644 index 0000000..c50a8c6 --- /dev/null +++ b/Pods/Pods-AFNetworking-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_AFNetworking : NSObject +@end +@implementation PodsDummy_Pods_AFNetworking +@end diff --git a/Pods/Pods-AFNetworking-prefix.pch b/Pods/Pods-AFNetworking-prefix.pch new file mode 100644 index 0000000..73f7e08 --- /dev/null +++ b/Pods/Pods-AFNetworking-prefix.pch @@ -0,0 +1,11 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-environment.h" + + + + + + diff --git a/Pods/Pods-AFNetworking.xcconfig b/Pods/Pods-AFNetworking.xcconfig new file mode 100644 index 0000000..13e3dff --- /dev/null +++ b/Pods/Pods-AFNetworking.xcconfig @@ -0,0 +1 @@ +PODS_AFNETWORKING_OTHER_LDFLAGS = -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration \ No newline at end of file diff --git a/Pods/Pods-RaptureXML-Private.xcconfig b/Pods/Pods-RaptureXML-Private.xcconfig new file mode 100644 index 0000000..e1aeb3c --- /dev/null +++ b/Pods/Pods-RaptureXML-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-RaptureXML.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/RaptureXML" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/RaptureXML" "${PODS_ROOT}/Headers/SSZipArchive" "${PODS_ROOT}/Headers/SSZipArchive/minizip" ${PODS_RAPTUREXML_HEADER_SEARCH_PATHS} +OTHER_LDFLAGS = -ObjC ${PODS_RAPTUREXML_OTHER_LDFLAGS} +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/Pods/Pods-RaptureXML-dummy.m b/Pods/Pods-RaptureXML-dummy.m new file mode 100644 index 0000000..1cf5b97 --- /dev/null +++ b/Pods/Pods-RaptureXML-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_RaptureXML : NSObject +@end +@implementation PodsDummy_Pods_RaptureXML +@end diff --git a/Pods/Pods-RaptureXML-prefix.pch b/Pods/Pods-RaptureXML-prefix.pch new file mode 100644 index 0000000..95cf11d --- /dev/null +++ b/Pods/Pods-RaptureXML-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-environment.h" diff --git a/Pods/Pods-RaptureXML.xcconfig b/Pods/Pods-RaptureXML.xcconfig new file mode 100644 index 0000000..8a41e1e --- /dev/null +++ b/Pods/Pods-RaptureXML.xcconfig @@ -0,0 +1,2 @@ +PODS_RAPTUREXML_HEADER_SEARCH_PATHS = $(SDKROOT)/usr/include/libxml2 +PODS_RAPTUREXML_OTHER_LDFLAGS = -lxml2 -lz \ No newline at end of file diff --git a/Pods/Pods-SSZipArchive-Private.xcconfig b/Pods/Pods-SSZipArchive-Private.xcconfig new file mode 100644 index 0000000..12b5cb8 --- /dev/null +++ b/Pods/Pods-SSZipArchive-Private.xcconfig @@ -0,0 +1,5 @@ +#include "Pods-SSZipArchive.xcconfig" +GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/SSZipArchive" "${PODS_ROOT}/BuildHeaders/SSZipArchive/minizip" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/RaptureXML" "${PODS_ROOT}/Headers/SSZipArchive" "${PODS_ROOT}/Headers/SSZipArchive/minizip" +OTHER_LDFLAGS = -ObjC ${PODS_SSZIPARCHIVE_OTHER_LDFLAGS} +PODS_ROOT = ${SRCROOT} \ No newline at end of file diff --git a/Pods/Pods-SSZipArchive-dummy.m b/Pods/Pods-SSZipArchive-dummy.m new file mode 100644 index 0000000..b6a36fa --- /dev/null +++ b/Pods/Pods-SSZipArchive-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_SSZipArchive : NSObject +@end +@implementation PodsDummy_Pods_SSZipArchive +@end diff --git a/Pods/Pods-SSZipArchive-prefix.pch b/Pods/Pods-SSZipArchive-prefix.pch new file mode 100644 index 0000000..95cf11d --- /dev/null +++ b/Pods/Pods-SSZipArchive-prefix.pch @@ -0,0 +1,5 @@ +#ifdef __OBJC__ +#import +#endif + +#import "Pods-environment.h" diff --git a/Pods/Pods-SSZipArchive.xcconfig b/Pods/Pods-SSZipArchive.xcconfig new file mode 100644 index 0000000..669c3f4 --- /dev/null +++ b/Pods/Pods-SSZipArchive.xcconfig @@ -0,0 +1 @@ +PODS_SSZIPARCHIVE_OTHER_LDFLAGS = -lz \ No newline at end of file diff --git a/Pods/Pods-acknowledgements.markdown b/Pods/Pods-acknowledgements.markdown new file mode 100644 index 0000000..caf6ff9 --- /dev/null +++ b/Pods/Pods-acknowledgements.markdown @@ -0,0 +1,60 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## AFNetworking + +Copyright (c) 2013 AFNetworking (http://afnetworking.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + +## RaptureXML + +Copyright (c) 2013 John Blanco + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +## SSZipArchive + +Copyright (c) 2010-2013 Sam Soffes, http://soff.es + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Generated by CocoaPods - http://cocoapods.org diff --git a/Pods/Pods-acknowledgements.plist b/Pods/Pods-acknowledgements.plist new file mode 100644 index 0000000..4d4397a --- /dev/null +++ b/Pods/Pods-acknowledgements.plist @@ -0,0 +1,98 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2013 AFNetworking (http://afnetworking.com/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + Title + AFNetworking + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2013 John Blanco + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + Title + RaptureXML + Type + PSGroupSpecifier + + + FooterText + Copyright (c) 2010-2013 Sam Soffes, http://soff.es + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + Title + SSZipArchive + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - http://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/Pods/Pods-dummy.m b/Pods/Pods-dummy.m new file mode 100644 index 0000000..ade64bd --- /dev/null +++ b/Pods/Pods-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods : NSObject +@end +@implementation PodsDummy_Pods +@end diff --git a/Pods/Pods-environment.h b/Pods/Pods-environment.h new file mode 100644 index 0000000..88bcba5 --- /dev/null +++ b/Pods/Pods-environment.h @@ -0,0 +1,62 @@ + +// To check if a library is compiled with CocoaPods you +// can use the `COCOAPODS` macro definition which is +// defined in the xcconfigs so it is available in +// headers also when they are imported in the client +// project. + + +// AFNetworking +#define COCOAPODS_POD_AVAILABLE_AFNetworking +#define COCOAPODS_VERSION_MAJOR_AFNetworking 2 +#define COCOAPODS_VERSION_MINOR_AFNetworking 0 +#define COCOAPODS_VERSION_PATCH_AFNetworking 1 + +// AFNetworking/NSURLConnection +#define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLConnection +#define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLConnection 2 +#define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLConnection 0 +#define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLConnection 1 + +// AFNetworking/NSURLSession +#define COCOAPODS_POD_AVAILABLE_AFNetworking_NSURLSession +#define COCOAPODS_VERSION_MAJOR_AFNetworking_NSURLSession 2 +#define COCOAPODS_VERSION_MINOR_AFNetworking_NSURLSession 0 +#define COCOAPODS_VERSION_PATCH_AFNetworking_NSURLSession 1 + +// AFNetworking/Reachability +#define COCOAPODS_POD_AVAILABLE_AFNetworking_Reachability +#define COCOAPODS_VERSION_MAJOR_AFNetworking_Reachability 2 +#define COCOAPODS_VERSION_MINOR_AFNetworking_Reachability 0 +#define COCOAPODS_VERSION_PATCH_AFNetworking_Reachability 1 + +// AFNetworking/Security +#define COCOAPODS_POD_AVAILABLE_AFNetworking_Security +#define COCOAPODS_VERSION_MAJOR_AFNetworking_Security 2 +#define COCOAPODS_VERSION_MINOR_AFNetworking_Security 0 +#define COCOAPODS_VERSION_PATCH_AFNetworking_Security 1 + +// AFNetworking/Serialization +#define COCOAPODS_POD_AVAILABLE_AFNetworking_Serialization +#define COCOAPODS_VERSION_MAJOR_AFNetworking_Serialization 2 +#define COCOAPODS_VERSION_MINOR_AFNetworking_Serialization 0 +#define COCOAPODS_VERSION_PATCH_AFNetworking_Serialization 1 + +// AFNetworking/UIKit +#define COCOAPODS_POD_AVAILABLE_AFNetworking_UIKit +#define COCOAPODS_VERSION_MAJOR_AFNetworking_UIKit 2 +#define COCOAPODS_VERSION_MINOR_AFNetworking_UIKit 0 +#define COCOAPODS_VERSION_PATCH_AFNetworking_UIKit 1 + +// RaptureXML +#define COCOAPODS_POD_AVAILABLE_RaptureXML +#define COCOAPODS_VERSION_MAJOR_RaptureXML 1 +#define COCOAPODS_VERSION_MINOR_RaptureXML 0 +#define COCOAPODS_VERSION_PATCH_RaptureXML 1 + +// SSZipArchive +#define COCOAPODS_POD_AVAILABLE_SSZipArchive +#define COCOAPODS_VERSION_MAJOR_SSZipArchive 0 +#define COCOAPODS_VERSION_MINOR_SSZipArchive 3 +#define COCOAPODS_VERSION_PATCH_SSZipArchive 1 + diff --git a/Pods/Pods-resources.sh b/Pods/Pods-resources.sh new file mode 100755 index 0000000..d6513b8 --- /dev/null +++ b/Pods/Pods-resources.sh @@ -0,0 +1,47 @@ +#!/bin/sh +set -e + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +install_resource() +{ + case $1 in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" + ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" + ;; + *.framework) + echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" + xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" + ;; + /*) + echo "$1" + echo "$1" >> "$RESOURCES_TO_COPY" + ;; + *) + echo "${PODS_ROOT}/$1" + echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]]; then + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" diff --git a/Pods/Pods.xcconfig b/Pods/Pods.xcconfig new file mode 100644 index 0000000..2f722af --- /dev/null +++ b/Pods/Pods.xcconfig @@ -0,0 +1,4 @@ +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/AFNetworking" "${PODS_ROOT}/Headers/RaptureXML" "${PODS_ROOT}/Headers/SSZipArchive" "${PODS_ROOT}/Headers/SSZipArchive/minizip" $(SDKROOT)/usr/include/libxml2 +OTHER_LDFLAGS = -ObjC -lxml2 -lz -framework CoreGraphics -framework MobileCoreServices -framework Security -framework SystemConfiguration +PODS_ROOT = ${SRCROOT}/Pods \ No newline at end of file diff --git a/Pods/Pods.xcodeproj/project.pbxproj b/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..dfadd88 --- /dev/null +++ b/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,1201 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 075AC9AEC81343BE9F53DC4F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EED232A022414079A9C739B7 /* Foundation.framework */; }; + 0AE295D1E4254F3392591619 /* SSZipArchive.h in Headers */ = {isa = PBXBuildFile; fileRef = 92093FE975D14193BC2BA6F6 /* SSZipArchive.h */; }; + 10A5B86E5DD74920AA427E96 /* UIActivityIndicatorView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = CCD88B796C7C4F0F8B7BC168 /* UIActivityIndicatorView+AFNetworking.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 10EC446D58E64E7CBEF47FFD /* AFURLSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = AFF00124AE3D41AA91890C0A /* AFURLSessionManager.h */; }; + 1240EC82F92E4B6CA55967ED /* RXMLElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 501BD9C77D454970BB6523CE /* RXMLElement.h */; }; + 1568167434394B20A08E3920 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B56F7F6481B8449C93690590 /* SystemConfiguration.framework */; }; + 16803A4B3D064245A98ADA21 /* UIAlertView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = F9A1482524314B7C971FCD4D /* UIAlertView+AFNetworking.h */; }; + 1768B42DD305451A9F61A244 /* UIActivityIndicatorView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = F77D6D0D12A345C0BA283399 /* UIActivityIndicatorView+AFNetworking.h */; }; + 1785B547C0594AB6814ECA84 /* UIAlertView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = DEB0720282AE48FFA3ECFD0A /* UIAlertView+AFNetworking.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 1E1302BAC95A46D3B9D51291 /* AFSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C018B123B3D4CEAA1EE43E1 /* AFSecurityPolicy.h */; }; + 2000CFC9062F4280A14C3A92 /* crypt.h in Headers */ = {isa = PBXBuildFile; fileRef = AB51F4F6DBC84E3D8D3B6402 /* crypt.h */; }; + 2412DC23841D4004A0FA504F /* UIButton+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 767EE684B69E443991CF9078 /* UIButton+AFNetworking.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 2DA95F849CDF4AAAA9D81A95 /* AFURLConnectionOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = BA401CFE364947B0855205C8 /* AFURLConnectionOperation.h */; }; + 3478D2BCCBE44AC0A5A2BB4B /* AFURLResponseSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 63BEF7579A2E4418B388A586 /* AFURLResponseSerialization.h */; }; + 3575E219EE29443598D56545 /* Pods-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 621A22F00A4E48839B23599F /* Pods-dummy.m */; }; + 3A7A0FDF788D4007829A5E57 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D95A45F0CD7F42FD86B10ED0 /* MobileCoreServices.framework */; }; + 3AFE503B81CE4D97B8360295 /* AFSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 67A2630C579E44139DC83E86 /* AFSecurityPolicy.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 466F8B7BAE334B42A082966C /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EED232A022414079A9C739B7 /* Foundation.framework */; }; + 4773D4A7ED0E4B51A4EDAF98 /* AFHTTPRequestOperationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 83564B50A88746209404A3EF /* AFHTTPRequestOperationManager.h */; }; + 4E0C764366BE469EA19C2AFB /* UIImageView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = A83FCFC730654220974EE924 /* UIImageView+AFNetworking.h */; }; + 51CE69C7C01A48D495A02F51 /* AFNetworkReachabilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F53D90B0C8C4356B6EF3943 /* AFNetworkReachabilityManager.h */; }; + 531CBC02A9224B758EF727BA /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 0800F4875A984DD59FCEA06E /* zip.c */; }; + 5409EDAAAB72496E9BA75267 /* UIKit+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 56AC05EB15CF45738092964B /* UIKit+AFNetworking.h */; }; + 54F2C565267545A685034CE7 /* unzip.h in Headers */ = {isa = PBXBuildFile; fileRef = 210C38D103024788A8A875F2 /* unzip.h */; }; + 5AB8AE3AB60F4C68A1C65A8C /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 05BF5923126B4E8395D473F5 /* AFURLResponseSerialization.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 5E6767B8AA4040A1B6E17110 /* UIProgressView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2236F9BEF91441249AFD7421 /* UIProgressView+AFNetworking.h */; }; + 5E745C8C40224F9188FE1211 /* Pods-RaptureXML-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 14327CD8A0144AE7B87EA432 /* Pods-RaptureXML-dummy.m */; }; + 6682CD99505B4659AAC6F365 /* UIButton+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 1988A6C9F2BC49E3A361531F /* UIButton+AFNetworking.h */; }; + 671DB8F6035A4681A4DEEAFE /* zip.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D797549A84748BE8AB304C6 /* zip.h */; }; + 6845407E33834D10A79598A2 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3442445983D347D0B3F1441D /* Security.framework */; }; + 70534EB2612943CA9545C6CD /* libPods-AFNetworking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6B85C268F3044B2484ED0A0A /* libPods-AFNetworking.a */; }; + 74E00F6E122F4A29824E7F7A /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 946FBB1FBDC549C4BDFF2C03 /* AFHTTPRequestOperation.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 7E22D85A3926448CAD05DDF7 /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 388D40524862418893B31A80 /* AFNetworkActivityIndicatorManager.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 8215F191EB3140E983A8F090 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EED232A022414079A9C739B7 /* Foundation.framework */; }; + 85B738A7BED04367A02CE882 /* AFURLRequestSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = D0A3F12A1D31450DBDA3F523 /* AFURLRequestSerialization.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 8BF91A8F33B94815BCE9351C /* AFHTTPRequestOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = 5499A2306C5C4304A8420F0C /* AFHTTPRequestOperation.h */; }; + 94A1117D6C114929B7D17BAD /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = EB58526F47D8445B8F50E518 /* mztools.c */; }; + 98F510F6A30E462B93B68F34 /* AFHTTPSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2616857BF00E49578246BDBC /* AFHTTPSessionManager.h */; }; + 99B9C3514DF146CCA0AC2F90 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 37EA236707ED489D82E93EBD /* ioapi.c */; }; + 9DA567EBA6B24EC58367B01B /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C46F4C346A6645BA8FBF98DF /* AFHTTPSessionManager.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + 9F227F1CA081442AA1BDE8F5 /* AFURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4168969FB1DB47E8B70DA2A0 /* AFURLSessionManager.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + A670F8A6568C4EE9B2FF4636 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 36DF87D29EF744ED9D1B4F5F /* UIImageView+AFNetworking.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + AC5BB9EBC6E94A91B51169A7 /* UIWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 613EF01C0946461E98FDAA10 /* UIWebView+AFNetworking.h */; }; + B6B6A7A6D63A48139EE3AF7F /* libPods-SSZipArchive.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 79D3B674899C4E76B5C34D75 /* libPods-SSZipArchive.a */; }; + BAAF8FBBD62241A282AC3293 /* AFNetworkActivityIndicatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = B7C2DE959C1C4CCE8AA8272A /* AFNetworkActivityIndicatorManager.h */; }; + BE2D8D3EB8AF42D798962AB0 /* Pods-AFNetworking-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = E70583FB69404FE798348A79 /* Pods-AFNetworking-dummy.m */; }; + BFB28267BE764AD08A8C29D0 /* RXMLElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 324BC05A3EED474AB5D49DF5 /* RXMLElement.m */; settings = {COMPILER_FLAGS = "-fobjc-arc -DOS_OBJECT_USE_OBJC=0"; }; }; + C000C17C74984780BE434839 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 975142301A8B4EEC8C9A42D9 /* CoreGraphics.framework */; }; + C36CDC909E6D40C9BFF2B0D6 /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6E9176FE703044C3A0531E22 /* AFNetworkReachabilityManager.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + C59EBC243576462FA244D99B /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = FB5C4FA826BC458AAFB6DE1F /* UIWebView+AFNetworking.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + C6A8D4AAD72342198F45F4AC /* Pods-SSZipArchive-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 89A48C99A0F6444997D9D381 /* Pods-SSZipArchive-dummy.m */; }; + CCD3C47FCC8C454688A83D30 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EED232A022414079A9C739B7 /* Foundation.framework */; }; + D81A2EEF85974D4EB96B41BD /* libPods-RaptureXML.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D16545665674B8AAAB1CC2D /* libPods-RaptureXML.a */; }; + DC9DC0E470F549BE881C76DB /* ioapi.h in Headers */ = {isa = PBXBuildFile; fileRef = CBE2F54E0D044FFC8CE66C73 /* ioapi.h */; }; + E3FE53B6E92D4CB394CFFB5D /* AFURLRequestSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = BF86410306A94F46A5AE2A0A /* AFURLRequestSerialization.h */; }; + E4F6A2035A4D4C75A9D4DD38 /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 5203B1A950F54AB0A2A53EF5 /* unzip.c */; }; + E515220C59BD4C6A88C159DF /* AFHTTPRequestOperationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 6A4108F3A76742C4B6ECE134 /* AFHTTPRequestOperationManager.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + E5B9FD02FE7943368FD4F1B1 /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 7079181CEFA9408BB7749873 /* AFURLConnectionOperation.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + E66C0B7651724D9C8AEEEF65 /* mztools.h in Headers */ = {isa = PBXBuildFile; fileRef = 8F0CC2B669344D70A0D02E2F /* mztools.h */; }; + E9E7F8B953E344AAAC54AC4D /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = D5D373F13D874190876FBCBF /* SSZipArchive.m */; }; + F2FE0D978F654B218399C270 /* UIProgressView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D19AD4DC4114575B18CDD0F /* UIProgressView+AFNetworking.m */; settings = {COMPILER_FLAGS = "-fobjc-arc"; }; }; + FD7015D9793C4944AB6082F1 /* AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 06685B748EDB4C0EA14D2443 /* AFNetworking.h */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 0D5C437D16DE49AABAF52FA5 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33EBB81E91D84613A5DF3ADE /* Project object */; + proxyType = 1; + remoteGlobalIDString = F5EE314403C3473B85C48DAC; + remoteInfo = "Pods-AFNetworking"; + }; + 859182332FB74039AE6DB66B /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33EBB81E91D84613A5DF3ADE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 189DA2BFF9E24FD28C6F5631; + remoteInfo = "Pods-RaptureXML"; + }; + F77E042F3D6845C3A0AE433A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 33EBB81E91D84613A5DF3ADE /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8C7D29C83FBF4F5695451A47; + remoteInfo = "Pods-SSZipArchive"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 05BF5923126B4E8395D473F5 /* AFURLResponseSerialization.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFURLResponseSerialization.m; path = AFNetworking/AFURLResponseSerialization.m; sourceTree = ""; }; + 06685B748EDB4C0EA14D2443 /* AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFNetworking.h; path = AFNetworking/AFNetworking.h; sourceTree = ""; }; + 0800F4875A984DD59FCEA06E /* zip.c */ = {isa = PBXFileReference; includeInIndex = 1; name = zip.c; path = minizip/zip.c; sourceTree = ""; }; + 14327CD8A0144AE7B87EA432 /* Pods-RaptureXML-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-RaptureXML-dummy.m"; sourceTree = ""; }; + 1988A6C9F2BC49E3A361531F /* UIButton+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIButton+AFNetworking.h"; path = "UIKit+AFNetworking/UIButton+AFNetworking.h"; sourceTree = ""; }; + 1A85ADFDD6194A758363809D /* Pods-AFNetworking-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AFNetworking-Private.xcconfig"; sourceTree = ""; }; + 210C38D103024788A8A875F2 /* unzip.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = unzip.h; path = minizip/unzip.h; sourceTree = ""; }; + 2236F9BEF91441249AFD7421 /* UIProgressView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIProgressView+AFNetworking.h"; path = "UIKit+AFNetworking/UIProgressView+AFNetworking.h"; sourceTree = ""; }; + 2616857BF00E49578246BDBC /* AFHTTPSessionManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFHTTPSessionManager.h; path = AFNetworking/AFHTTPSessionManager.h; sourceTree = ""; }; + 2E6401CBDAE7457892DFF74E /* Pods-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-acknowledgements.markdown"; sourceTree = ""; }; + 32428E417ACA4F6E90F06881 /* Pods-SSZipArchive-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-SSZipArchive-Private.xcconfig"; sourceTree = ""; }; + 324BC05A3EED474AB5D49DF5 /* RXMLElement.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = RXMLElement.m; path = RaptureXML/RXMLElement.m; sourceTree = ""; }; + 330D42EC63AD4B59A123988A /* Pods-environment.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-environment.h"; sourceTree = ""; }; + 3442445983D347D0B3F1441D /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + 36DF87D29EF744ED9D1B4F5F /* UIImageView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIImageView+AFNetworking.m"; path = "UIKit+AFNetworking/UIImageView+AFNetworking.m"; sourceTree = ""; }; + 37EA236707ED489D82E93EBD /* ioapi.c */ = {isa = PBXFileReference; includeInIndex = 1; name = ioapi.c; path = minizip/ioapi.c; sourceTree = ""; }; + 388D40524862418893B31A80 /* AFNetworkActivityIndicatorManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFNetworkActivityIndicatorManager.m; path = "UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m"; sourceTree = ""; }; + 3C018B123B3D4CEAA1EE43E1 /* AFSecurityPolicy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFSecurityPolicy.h; path = AFNetworking/AFSecurityPolicy.h; sourceTree = ""; }; + 3D16545665674B8AAAB1CC2D /* libPods-RaptureXML.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RaptureXML.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 3D797549A84748BE8AB304C6 /* zip.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = zip.h; path = minizip/zip.h; sourceTree = ""; }; + 4168969FB1DB47E8B70DA2A0 /* AFURLSessionManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFURLSessionManager.m; path = AFNetworking/AFURLSessionManager.m; sourceTree = ""; }; + 439C2B36132A4F27826B0120 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 4E8C2A71E9964D6792B5E708 /* Pods-SSZipArchive.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-SSZipArchive.xcconfig"; sourceTree = ""; }; + 501BD9C77D454970BB6523CE /* RXMLElement.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = RXMLElement.h; path = RaptureXML/RXMLElement.h; sourceTree = ""; }; + 5203B1A950F54AB0A2A53EF5 /* unzip.c */ = {isa = PBXFileReference; includeInIndex = 1; name = unzip.c; path = minizip/unzip.c; sourceTree = ""; }; + 5499A2306C5C4304A8420F0C /* AFHTTPRequestOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFHTTPRequestOperation.h; path = AFNetworking/AFHTTPRequestOperation.h; sourceTree = ""; }; + 5570A54032714BBB992D6312 /* Pods-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-acknowledgements.plist"; sourceTree = ""; }; + 56AC05EB15CF45738092964B /* UIKit+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIKit+AFNetworking.h"; path = "UIKit+AFNetworking/UIKit+AFNetworking.h"; sourceTree = ""; }; + 613EF01C0946461E98FDAA10 /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIWebView+AFNetworking.h"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.h"; sourceTree = ""; }; + 621A22F00A4E48839B23599F /* Pods-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-dummy.m"; sourceTree = ""; }; + 63BEF7579A2E4418B388A586 /* AFURLResponseSerialization.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLResponseSerialization.h; path = AFNetworking/AFURLResponseSerialization.h; sourceTree = ""; }; + 67A2630C579E44139DC83E86 /* AFSecurityPolicy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFSecurityPolicy.m; path = AFNetworking/AFSecurityPolicy.m; sourceTree = ""; }; + 6A4108F3A76742C4B6ECE134 /* AFHTTPRequestOperationManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFHTTPRequestOperationManager.m; path = AFNetworking/AFHTTPRequestOperationManager.m; sourceTree = ""; }; + 6B85C268F3044B2484ED0A0A /* libPods-AFNetworking.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-AFNetworking.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 6D19AD4DC4114575B18CDD0F /* UIProgressView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIProgressView+AFNetworking.m"; path = "UIKit+AFNetworking/UIProgressView+AFNetworking.m"; sourceTree = ""; }; + 6DA4768461B74291B3919FBC /* Pods-RaptureXML-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-RaptureXML-prefix.pch"; sourceTree = ""; }; + 6E9176FE703044C3A0531E22 /* AFNetworkReachabilityManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFNetworkReachabilityManager.m; path = AFNetworking/AFNetworkReachabilityManager.m; sourceTree = ""; }; + 6F53D90B0C8C4356B6EF3943 /* AFNetworkReachabilityManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFNetworkReachabilityManager.h; path = AFNetworking/AFNetworkReachabilityManager.h; sourceTree = ""; }; + 7079181CEFA9408BB7749873 /* AFURLConnectionOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFURLConnectionOperation.m; path = AFNetworking/AFURLConnectionOperation.m; sourceTree = ""; }; + 767EE684B69E443991CF9078 /* UIButton+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIButton+AFNetworking.m"; path = "UIKit+AFNetworking/UIButton+AFNetworking.m"; sourceTree = ""; }; + 79D3B674899C4E76B5C34D75 /* libPods-SSZipArchive.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SSZipArchive.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 7A5F15BD1F4246F9B159E9C1 /* Pods-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-resources.sh"; sourceTree = ""; }; + 806C3582840D40A3B5C817B4 /* Podfile */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 83564B50A88746209404A3EF /* AFHTTPRequestOperationManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFHTTPRequestOperationManager.h; path = AFNetworking/AFHTTPRequestOperationManager.h; sourceTree = ""; }; + 89A48C99A0F6444997D9D381 /* Pods-SSZipArchive-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-SSZipArchive-dummy.m"; sourceTree = ""; }; + 8F0CC2B669344D70A0D02E2F /* mztools.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = mztools.h; path = minizip/mztools.h; sourceTree = ""; }; + 92093FE975D14193BC2BA6F6 /* SSZipArchive.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SSZipArchive.h; path = SSZipArchive/SSZipArchive.h; sourceTree = ""; }; + 940BB25776D943C6BF133F4A /* Pods-SSZipArchive-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-SSZipArchive-prefix.pch"; sourceTree = ""; }; + 946FBB1FBDC549C4BDFF2C03 /* AFHTTPRequestOperation.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFHTTPRequestOperation.m; path = AFNetworking/AFHTTPRequestOperation.m; sourceTree = ""; }; + 975142301A8B4EEC8C9A42D9 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 98A53C9C1AEB43C78F9782B3 /* Pods-RaptureXML.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-RaptureXML.xcconfig"; sourceTree = ""; }; + A83FCFC730654220974EE924 /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIImageView+AFNetworking.h"; path = "UIKit+AFNetworking/UIImageView+AFNetworking.h"; sourceTree = ""; }; + AB51F4F6DBC84E3D8D3B6402 /* crypt.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = crypt.h; path = minizip/crypt.h; sourceTree = ""; }; + AFF00124AE3D41AA91890C0A /* AFURLSessionManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLSessionManager.h; path = AFNetworking/AFURLSessionManager.h; sourceTree = ""; }; + B56F7F6481B8449C93690590 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + B76154D7ECE94DF7A72E9CC5 /* Pods-AFNetworking.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-AFNetworking.xcconfig"; sourceTree = ""; }; + B7C2DE959C1C4CCE8AA8272A /* AFNetworkActivityIndicatorManager.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFNetworkActivityIndicatorManager.h; path = "UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h"; sourceTree = ""; }; + BA401CFE364947B0855205C8 /* AFURLConnectionOperation.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLConnectionOperation.h; path = AFNetworking/AFURLConnectionOperation.h; sourceTree = ""; }; + BF86410306A94F46A5AE2A0A /* AFURLRequestSerialization.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = AFURLRequestSerialization.h; path = AFNetworking/AFURLRequestSerialization.h; sourceTree = ""; }; + C46F4C346A6645BA8FBF98DF /* AFHTTPSessionManager.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFHTTPSessionManager.m; path = AFNetworking/AFHTTPSessionManager.m; sourceTree = ""; }; + C67FB33168474E15BCC74541 /* Pods-RaptureXML-Private.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-RaptureXML-Private.xcconfig"; sourceTree = ""; }; + CA16C71EAF21476DBBC8153A /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = Pods.xcconfig; sourceTree = ""; }; + CBE2F54E0D044FFC8CE66C73 /* ioapi.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = ioapi.h; path = minizip/ioapi.h; sourceTree = ""; }; + CCD88B796C7C4F0F8B7BC168 /* UIActivityIndicatorView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIActivityIndicatorView+AFNetworking.m"; path = "UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m"; sourceTree = ""; }; + D0A3F12A1D31450DBDA3F523 /* AFURLRequestSerialization.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = AFURLRequestSerialization.m; path = AFNetworking/AFURLRequestSerialization.m; sourceTree = ""; }; + D4AC2BA4A9A94508AA6307B9 /* Pods-AFNetworking-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-AFNetworking-prefix.pch"; sourceTree = ""; }; + D5D373F13D874190876FBCBF /* SSZipArchive.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SSZipArchive.m; path = SSZipArchive/SSZipArchive.m; sourceTree = ""; }; + D95A45F0CD7F42FD86B10ED0 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + DEB0720282AE48FFA3ECFD0A /* UIAlertView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIAlertView+AFNetworking.m"; path = "UIKit+AFNetworking/UIAlertView+AFNetworking.m"; sourceTree = ""; }; + E70583FB69404FE798348A79 /* Pods-AFNetworking-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-AFNetworking-dummy.m"; sourceTree = ""; }; + EB58526F47D8445B8F50E518 /* mztools.c */ = {isa = PBXFileReference; includeInIndex = 1; name = mztools.c; path = minizip/mztools.c; sourceTree = ""; }; + EED232A022414079A9C739B7 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + F77D6D0D12A345C0BA283399 /* UIActivityIndicatorView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIActivityIndicatorView+AFNetworking.h"; path = "UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h"; sourceTree = ""; }; + F9A1482524314B7C971FCD4D /* UIAlertView+AFNetworking.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "UIAlertView+AFNetworking.h"; path = "UIKit+AFNetworking/UIAlertView+AFNetworking.h"; sourceTree = ""; }; + FB5C4FA826BC458AAFB6DE1F /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "UIWebView+AFNetworking.m"; path = "UIKit+AFNetworking/UIWebView+AFNetworking.m"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 73D1935BA42946578E1B45A3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 075AC9AEC81343BE9F53DC4F /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 747C1FE7283D4EAFAC23BCD1 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C000C17C74984780BE434839 /* CoreGraphics.framework in Frameworks */, + 8215F191EB3140E983A8F090 /* Foundation.framework in Frameworks */, + 3A7A0FDF788D4007829A5E57 /* MobileCoreServices.framework in Frameworks */, + 6845407E33834D10A79598A2 /* Security.framework in Frameworks */, + 1568167434394B20A08E3920 /* SystemConfiguration.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7AC8AA5C79A5472799DF8ADB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 466F8B7BAE334B42A082966C /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D91DC8E818614E508D120C1A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + CCD3C47FCC8C454688A83D30 /* Foundation.framework in Frameworks */, + 70534EB2612943CA9545C6CD /* libPods-AFNetworking.a in Frameworks */, + D81A2EEF85974D4EB96B41BD /* libPods-RaptureXML.a in Frameworks */, + B6B6A7A6D63A48139EE3AF7F /* libPods-SSZipArchive.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0A9E1B18338C4867BD8634C4 /* Products */ = { + isa = PBXGroup; + children = ( + 3D16545665674B8AAAB1CC2D /* libPods-RaptureXML.a */, + ); + name = Products; + sourceTree = ""; + }; + 201455526D9848D490D5DE82 /* Reachability */ = { + isa = PBXGroup; + children = ( + D9DF5643273F43EB80E8F00B /* Source Files */, + ); + name = Reachability; + sourceTree = ""; + }; + 22AE3466A6484482A6F6AD3C /* Products */ = { + isa = PBXGroup; + children = ( + 439C2B36132A4F27826B0120 /* libPods.a */, + ); + name = Products; + sourceTree = ""; + }; + 3161782FDBDD4B17A9DA661B /* UIKit */ = { + isa = PBXGroup; + children = ( + A3BDCAC0C1FD4D25BB74E076 /* Source Files */, + ); + name = UIKit; + sourceTree = ""; + }; + 3226C757E28F4557A9F0A013 /* Security */ = { + isa = PBXGroup; + children = ( + 99A78ED2841F45898BE4D04F /* Source Files */, + ); + name = Security; + sourceTree = ""; + }; + 34226925C053483982BCBCB2 /* Source Files */ = { + isa = PBXGroup; + children = ( + 5499A2306C5C4304A8420F0C /* AFHTTPRequestOperation.h */, + 83564B50A88746209404A3EF /* AFHTTPRequestOperationManager.h */, + BA401CFE364947B0855205C8 /* AFURLConnectionOperation.h */, + 946FBB1FBDC549C4BDFF2C03 /* AFHTTPRequestOperation.m */, + 6A4108F3A76742C4B6ECE134 /* AFHTTPRequestOperationManager.m */, + 7079181CEFA9408BB7749873 /* AFURLConnectionOperation.m */, + ); + name = "Source Files"; + sourceTree = ""; + }; + 3B95E49762D24CE48B391426 /* AFNetworking */ = { + isa = PBXGroup; + children = ( + BF43E308D0A6466FB3A86246 /* Products */, + 58581BD55BFF4323B5A05F29 /* Source Files */, + 6D36B899BC1048B8920AC745 /* Subspecs */, + 9AC80E9AC409485BBFAAF7A1 /* Support Files */, + ); + name = AFNetworking; + path = AFNetworking; + sourceTree = ""; + }; + 3BE9091A7A18444EA0C595A3 /* Source Files */ = { + isa = PBXGroup; + children = ( + 2616857BF00E49578246BDBC /* AFHTTPSessionManager.h */, + AFF00124AE3D41AA91890C0A /* AFURLSessionManager.h */, + C46F4C346A6645BA8FBF98DF /* AFHTTPSessionManager.m */, + 4168969FB1DB47E8B70DA2A0 /* AFURLSessionManager.m */, + ); + name = "Source Files"; + sourceTree = ""; + }; + 48CA7E1AA27C4F8EA4949D4C /* Frameworks */ = { + isa = PBXGroup; + children = ( + 975142301A8B4EEC8C9A42D9 /* CoreGraphics.framework */, + EED232A022414079A9C739B7 /* Foundation.framework */, + D95A45F0CD7F42FD86B10ED0 /* MobileCoreServices.framework */, + 3442445983D347D0B3F1441D /* Security.framework */, + B56F7F6481B8449C93690590 /* SystemConfiguration.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 58581BD55BFF4323B5A05F29 /* Source Files */ = { + isa = PBXGroup; + children = ( + 06685B748EDB4C0EA14D2443 /* AFNetworking.h */, + ); + name = "Source Files"; + sourceTree = ""; + }; + 6144F31C61614493A3A43E2D /* NSURLConnection */ = { + isa = PBXGroup; + children = ( + 34226925C053483982BCBCB2 /* Source Files */, + ); + name = NSURLConnection; + sourceTree = ""; + }; + 63E1382AC94D45AEA6C003C9 = { + isa = PBXGroup; + children = ( + 48CA7E1AA27C4F8EA4949D4C /* Frameworks */, + E64370A559814FE8AC9F1249 /* Pods */, + 22AE3466A6484482A6F6AD3C /* Products */, + FA7237B8DAED41DC88AF3F06 /* Targets Support Files */, + 806C3582840D40A3B5C817B4 /* Podfile */, + ); + sourceTree = ""; + }; + 6D36B899BC1048B8920AC745 /* Subspecs */ = { + isa = PBXGroup; + children = ( + 6144F31C61614493A3A43E2D /* NSURLConnection */, + C60683988865437BA05B7FD8 /* NSURLSession */, + 201455526D9848D490D5DE82 /* Reachability */, + 3226C757E28F4557A9F0A013 /* Security */, + F628848A1D9444D08C7BA5C4 /* Serialization */, + 3161782FDBDD4B17A9DA661B /* UIKit */, + ); + name = Subspecs; + sourceTree = ""; + }; + 7041599EAD1A49BEB875A478 /* Support Files */ = { + isa = PBXGroup; + children = ( + 14327CD8A0144AE7B87EA432 /* Pods-RaptureXML-dummy.m */, + 6DA4768461B74291B3919FBC /* Pods-RaptureXML-prefix.pch */, + 98A53C9C1AEB43C78F9782B3 /* Pods-RaptureXML.xcconfig */, + C67FB33168474E15BCC74541 /* Pods-RaptureXML-Private.xcconfig */, + ); + name = "Support Files"; + sourceTree = SOURCE_ROOT; + }; + 7A510AE12A7249679BF6E01A /* Pods */ = { + isa = PBXGroup; + children = ( + 330D42EC63AD4B59A123988A /* Pods-environment.h */, + 621A22F00A4E48839B23599F /* Pods-dummy.m */, + 2E6401CBDAE7457892DFF74E /* Pods-acknowledgements.markdown */, + 5570A54032714BBB992D6312 /* Pods-acknowledgements.plist */, + 7A5F15BD1F4246F9B159E9C1 /* Pods-resources.sh */, + CA16C71EAF21476DBBC8153A /* Pods.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + 85238EC2354942ECB8E2B4ED /* Source Files */ = { + isa = PBXGroup; + children = ( + 37EA236707ED489D82E93EBD /* ioapi.c */, + EB58526F47D8445B8F50E518 /* mztools.c */, + 5203B1A950F54AB0A2A53EF5 /* unzip.c */, + 0800F4875A984DD59FCEA06E /* zip.c */, + 92093FE975D14193BC2BA6F6 /* SSZipArchive.h */, + AB51F4F6DBC84E3D8D3B6402 /* crypt.h */, + CBE2F54E0D044FFC8CE66C73 /* ioapi.h */, + 8F0CC2B669344D70A0D02E2F /* mztools.h */, + 210C38D103024788A8A875F2 /* unzip.h */, + 3D797549A84748BE8AB304C6 /* zip.h */, + D5D373F13D874190876FBCBF /* SSZipArchive.m */, + ); + name = "Source Files"; + sourceTree = ""; + }; + 8C31CA715EF6442B8D6E0644 /* Source Files */ = { + isa = PBXGroup; + children = ( + BF86410306A94F46A5AE2A0A /* AFURLRequestSerialization.h */, + 63BEF7579A2E4418B388A586 /* AFURLResponseSerialization.h */, + D0A3F12A1D31450DBDA3F523 /* AFURLRequestSerialization.m */, + 05BF5923126B4E8395D473F5 /* AFURLResponseSerialization.m */, + ); + name = "Source Files"; + sourceTree = ""; + }; + 99A78ED2841F45898BE4D04F /* Source Files */ = { + isa = PBXGroup; + children = ( + 3C018B123B3D4CEAA1EE43E1 /* AFSecurityPolicy.h */, + 67A2630C579E44139DC83E86 /* AFSecurityPolicy.m */, + ); + name = "Source Files"; + sourceTree = ""; + }; + 9AC80E9AC409485BBFAAF7A1 /* Support Files */ = { + isa = PBXGroup; + children = ( + E70583FB69404FE798348A79 /* Pods-AFNetworking-dummy.m */, + D4AC2BA4A9A94508AA6307B9 /* Pods-AFNetworking-prefix.pch */, + B76154D7ECE94DF7A72E9CC5 /* Pods-AFNetworking.xcconfig */, + 1A85ADFDD6194A758363809D /* Pods-AFNetworking-Private.xcconfig */, + ); + name = "Support Files"; + sourceTree = SOURCE_ROOT; + }; + A3BDCAC0C1FD4D25BB74E076 /* Source Files */ = { + isa = PBXGroup; + children = ( + B7C2DE959C1C4CCE8AA8272A /* AFNetworkActivityIndicatorManager.h */, + F77D6D0D12A345C0BA283399 /* UIActivityIndicatorView+AFNetworking.h */, + F9A1482524314B7C971FCD4D /* UIAlertView+AFNetworking.h */, + 1988A6C9F2BC49E3A361531F /* UIButton+AFNetworking.h */, + A83FCFC730654220974EE924 /* UIImageView+AFNetworking.h */, + 56AC05EB15CF45738092964B /* UIKit+AFNetworking.h */, + 2236F9BEF91441249AFD7421 /* UIProgressView+AFNetworking.h */, + 613EF01C0946461E98FDAA10 /* UIWebView+AFNetworking.h */, + 388D40524862418893B31A80 /* AFNetworkActivityIndicatorManager.m */, + CCD88B796C7C4F0F8B7BC168 /* UIActivityIndicatorView+AFNetworking.m */, + DEB0720282AE48FFA3ECFD0A /* UIAlertView+AFNetworking.m */, + 767EE684B69E443991CF9078 /* UIButton+AFNetworking.m */, + 36DF87D29EF744ED9D1B4F5F /* UIImageView+AFNetworking.m */, + 6D19AD4DC4114575B18CDD0F /* UIProgressView+AFNetworking.m */, + FB5C4FA826BC458AAFB6DE1F /* UIWebView+AFNetworking.m */, + ); + name = "Source Files"; + sourceTree = ""; + }; + BF43E308D0A6466FB3A86246 /* Products */ = { + isa = PBXGroup; + children = ( + 6B85C268F3044B2484ED0A0A /* libPods-AFNetworking.a */, + ); + name = Products; + sourceTree = ""; + }; + C60683988865437BA05B7FD8 /* NSURLSession */ = { + isa = PBXGroup; + children = ( + 3BE9091A7A18444EA0C595A3 /* Source Files */, + ); + name = NSURLSession; + sourceTree = ""; + }; + CC88D799274B4E628BF0EB63 /* Products */ = { + isa = PBXGroup; + children = ( + 79D3B674899C4E76B5C34D75 /* libPods-SSZipArchive.a */, + ); + name = Products; + sourceTree = ""; + }; + D9DF5643273F43EB80E8F00B /* Source Files */ = { + isa = PBXGroup; + children = ( + 6F53D90B0C8C4356B6EF3943 /* AFNetworkReachabilityManager.h */, + 6E9176FE703044C3A0531E22 /* AFNetworkReachabilityManager.m */, + ); + name = "Source Files"; + sourceTree = ""; + }; + DD1B24E9A3024927A50ACFB6 /* SSZipArchive */ = { + isa = PBXGroup; + children = ( + CC88D799274B4E628BF0EB63 /* Products */, + 85238EC2354942ECB8E2B4ED /* Source Files */, + E7B9E8EBA86140618BA8BBF1 /* Support Files */, + ); + name = SSZipArchive; + path = SSZipArchive; + sourceTree = ""; + }; + DDD5B052273E498289B6C377 /* Source Files */ = { + isa = PBXGroup; + children = ( + 501BD9C77D454970BB6523CE /* RXMLElement.h */, + 324BC05A3EED474AB5D49DF5 /* RXMLElement.m */, + ); + name = "Source Files"; + sourceTree = ""; + }; + DFF12B0BB7A34340A562B4A9 /* RaptureXML */ = { + isa = PBXGroup; + children = ( + 0A9E1B18338C4867BD8634C4 /* Products */, + DDD5B052273E498289B6C377 /* Source Files */, + 7041599EAD1A49BEB875A478 /* Support Files */, + ); + name = RaptureXML; + path = RaptureXML; + sourceTree = ""; + }; + E64370A559814FE8AC9F1249 /* Pods */ = { + isa = PBXGroup; + children = ( + 3B95E49762D24CE48B391426 /* AFNetworking */, + DFF12B0BB7A34340A562B4A9 /* RaptureXML */, + DD1B24E9A3024927A50ACFB6 /* SSZipArchive */, + ); + name = Pods; + sourceTree = ""; + }; + E7B9E8EBA86140618BA8BBF1 /* Support Files */ = { + isa = PBXGroup; + children = ( + 89A48C99A0F6444997D9D381 /* Pods-SSZipArchive-dummy.m */, + 940BB25776D943C6BF133F4A /* Pods-SSZipArchive-prefix.pch */, + 4E8C2A71E9964D6792B5E708 /* Pods-SSZipArchive.xcconfig */, + 32428E417ACA4F6E90F06881 /* Pods-SSZipArchive-Private.xcconfig */, + ); + name = "Support Files"; + sourceTree = SOURCE_ROOT; + }; + F628848A1D9444D08C7BA5C4 /* Serialization */ = { + isa = PBXGroup; + children = ( + 8C31CA715EF6442B8D6E0644 /* Source Files */, + ); + name = Serialization; + sourceTree = ""; + }; + FA7237B8DAED41DC88AF3F06 /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + 7A510AE12A7249679BF6E01A /* Pods */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 0F5EFA52FDD34EC0B7A29B8F /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 8BF91A8F33B94815BCE9351C /* AFHTTPRequestOperation.h in Headers */, + 4773D4A7ED0E4B51A4EDAF98 /* AFHTTPRequestOperationManager.h in Headers */, + 98F510F6A30E462B93B68F34 /* AFHTTPSessionManager.h in Headers */, + BAAF8FBBD62241A282AC3293 /* AFNetworkActivityIndicatorManager.h in Headers */, + 51CE69C7C01A48D495A02F51 /* AFNetworkReachabilityManager.h in Headers */, + FD7015D9793C4944AB6082F1 /* AFNetworking.h in Headers */, + 1E1302BAC95A46D3B9D51291 /* AFSecurityPolicy.h in Headers */, + 2DA95F849CDF4AAAA9D81A95 /* AFURLConnectionOperation.h in Headers */, + E3FE53B6E92D4CB394CFFB5D /* AFURLRequestSerialization.h in Headers */, + 3478D2BCCBE44AC0A5A2BB4B /* AFURLResponseSerialization.h in Headers */, + 10EC446D58E64E7CBEF47FFD /* AFURLSessionManager.h in Headers */, + 1768B42DD305451A9F61A244 /* UIActivityIndicatorView+AFNetworking.h in Headers */, + 16803A4B3D064245A98ADA21 /* UIAlertView+AFNetworking.h in Headers */, + 6682CD99505B4659AAC6F365 /* UIButton+AFNetworking.h in Headers */, + 4E0C764366BE469EA19C2AFB /* UIImageView+AFNetworking.h in Headers */, + 5409EDAAAB72496E9BA75267 /* UIKit+AFNetworking.h in Headers */, + 5E6767B8AA4040A1B6E17110 /* UIProgressView+AFNetworking.h in Headers */, + AC5BB9EBC6E94A91B51169A7 /* UIWebView+AFNetworking.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1E2DFB8D7BA44C989EDD662B /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 0AE295D1E4254F3392591619 /* SSZipArchive.h in Headers */, + 2000CFC9062F4280A14C3A92 /* crypt.h in Headers */, + DC9DC0E470F549BE881C76DB /* ioapi.h in Headers */, + E66C0B7651724D9C8AEEEF65 /* mztools.h in Headers */, + 54F2C565267545A685034CE7 /* unzip.h in Headers */, + 671DB8F6035A4681A4DEEAFE /* zip.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 5EEE801D353B45279E4C462D /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 1240EC82F92E4B6CA55967ED /* RXMLElement.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 189DA2BFF9E24FD28C6F5631 /* Pods-RaptureXML */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7B6D639F3F3E44A29A50E246 /* Build configuration list for PBXNativeTarget "Pods-RaptureXML" */; + buildPhases = ( + 09B99DAA1B1348BDB040AC93 /* Sources */, + 7AC8AA5C79A5472799DF8ADB /* Frameworks */, + 5EEE801D353B45279E4C462D /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Pods-RaptureXML"; + productName = "Pods-RaptureXML"; + productReference = 3D16545665674B8AAAB1CC2D /* libPods-RaptureXML.a */; + productType = "com.apple.product-type.library.static"; + }; + 1EB23AAA02A74D17939F0DB5 /* Pods */ = { + isa = PBXNativeTarget; + buildConfigurationList = 008C4FB1412F4C4EAC2D1C22 /* Build configuration list for PBXNativeTarget "Pods" */; + buildPhases = ( + C0B8C844CED84517880B666F /* Sources */, + D91DC8E818614E508D120C1A /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 3B8E1309292540FEB3E5FA7D /* PBXTargetDependency */, + 31239FB4A49C402DA698737B /* PBXTargetDependency */, + 15D8FA3CD5234450861685BF /* PBXTargetDependency */, + ); + name = Pods; + productName = Pods; + productReference = 439C2B36132A4F27826B0120 /* libPods.a */; + productType = "com.apple.product-type.library.static"; + }; + 8C7D29C83FBF4F5695451A47 /* Pods-SSZipArchive */ = { + isa = PBXNativeTarget; + buildConfigurationList = 391A3F63364C43CD9EA4CC50 /* Build configuration list for PBXNativeTarget "Pods-SSZipArchive" */; + buildPhases = ( + 2C5511AB5B6C4B5AABC3E99A /* Sources */, + 73D1935BA42946578E1B45A3 /* Frameworks */, + 1E2DFB8D7BA44C989EDD662B /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Pods-SSZipArchive"; + productName = "Pods-SSZipArchive"; + productReference = 79D3B674899C4E76B5C34D75 /* libPods-SSZipArchive.a */; + productType = "com.apple.product-type.library.static"; + }; + F5EE314403C3473B85C48DAC /* Pods-AFNetworking */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7EAB2EE940B74F1BA017740E /* Build configuration list for PBXNativeTarget "Pods-AFNetworking" */; + buildPhases = ( + 1EF4A038AC6B4B6EB5B18B5B /* Sources */, + 747C1FE7283D4EAFAC23BCD1 /* Frameworks */, + 0F5EFA52FDD34EC0B7A29B8F /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Pods-AFNetworking"; + productName = "Pods-AFNetworking"; + productReference = 6B85C268F3044B2484ED0A0A /* libPods-AFNetworking.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 33EBB81E91D84613A5DF3ADE /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0500; + }; + buildConfigurationList = CE088627C13E44C288A62681 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 63E1382AC94D45AEA6C003C9; + productRefGroup = 22AE3466A6484482A6F6AD3C /* Products */; + projectDirPath = ""; + projectReferences = ( + ); + projectRoot = ""; + targets = ( + 1EB23AAA02A74D17939F0DB5 /* Pods */, + F5EE314403C3473B85C48DAC /* Pods-AFNetworking */, + 189DA2BFF9E24FD28C6F5631 /* Pods-RaptureXML */, + 8C7D29C83FBF4F5695451A47 /* Pods-SSZipArchive */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 09B99DAA1B1348BDB040AC93 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5E745C8C40224F9188FE1211 /* Pods-RaptureXML-dummy.m in Sources */, + BFB28267BE764AD08A8C29D0 /* RXMLElement.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1EF4A038AC6B4B6EB5B18B5B /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 74E00F6E122F4A29824E7F7A /* AFHTTPRequestOperation.m in Sources */, + E515220C59BD4C6A88C159DF /* AFHTTPRequestOperationManager.m in Sources */, + 9DA567EBA6B24EC58367B01B /* AFHTTPSessionManager.m in Sources */, + 7E22D85A3926448CAD05DDF7 /* AFNetworkActivityIndicatorManager.m in Sources */, + C36CDC909E6D40C9BFF2B0D6 /* AFNetworkReachabilityManager.m in Sources */, + 3AFE503B81CE4D97B8360295 /* AFSecurityPolicy.m in Sources */, + E5B9FD02FE7943368FD4F1B1 /* AFURLConnectionOperation.m in Sources */, + 85B738A7BED04367A02CE882 /* AFURLRequestSerialization.m in Sources */, + 5AB8AE3AB60F4C68A1C65A8C /* AFURLResponseSerialization.m in Sources */, + 9F227F1CA081442AA1BDE8F5 /* AFURLSessionManager.m in Sources */, + BE2D8D3EB8AF42D798962AB0 /* Pods-AFNetworking-dummy.m in Sources */, + 10A5B86E5DD74920AA427E96 /* UIActivityIndicatorView+AFNetworking.m in Sources */, + 1785B547C0594AB6814ECA84 /* UIAlertView+AFNetworking.m in Sources */, + 2412DC23841D4004A0FA504F /* UIButton+AFNetworking.m in Sources */, + A670F8A6568C4EE9B2FF4636 /* UIImageView+AFNetworking.m in Sources */, + F2FE0D978F654B218399C270 /* UIProgressView+AFNetworking.m in Sources */, + C59EBC243576462FA244D99B /* UIWebView+AFNetworking.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2C5511AB5B6C4B5AABC3E99A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C6A8D4AAD72342198F45F4AC /* Pods-SSZipArchive-dummy.m in Sources */, + E9E7F8B953E344AAAC54AC4D /* SSZipArchive.m in Sources */, + 99B9C3514DF146CCA0AC2F90 /* ioapi.c in Sources */, + 94A1117D6C114929B7D17BAD /* mztools.c in Sources */, + E4F6A2035A4D4C75A9D4DD38 /* unzip.c in Sources */, + 531CBC02A9224B758EF727BA /* zip.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C0B8C844CED84517880B666F /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 3575E219EE29443598D56545 /* Pods-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 15D8FA3CD5234450861685BF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 8C7D29C83FBF4F5695451A47 /* Pods-SSZipArchive */; + targetProxy = F77E042F3D6845C3A0AE433A /* PBXContainerItemProxy */; + }; + 31239FB4A49C402DA698737B /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 189DA2BFF9E24FD28C6F5631 /* Pods-RaptureXML */; + targetProxy = 859182332FB74039AE6DB66B /* PBXContainerItemProxy */; + }; + 3B8E1309292540FEB3E5FA7D /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F5EE314403C3473B85C48DAC /* Pods-AFNetworking */; + targetProxy = 0D5C437D16DE49AABAF52FA5 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 01F867A9C797419AAFDCD0E1 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CA16C71EAF21476DBBC8153A /* Pods.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 1969F65A516C4A7A97E2375B /* Ad-hoc */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C67FB33168474E15BCC74541 /* Pods-RaptureXML-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-RaptureXML-prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = "Ad-hoc"; + }; + 1BDA8F48A7F2441C8E3EC796 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Release; + }; + 28B9BF0042424878942DF9CC /* Ad-hoc */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 32428E417ACA4F6E90F06881 /* Pods-SSZipArchive-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-SSZipArchive-prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = "Ad-hoc"; + }; + 313C61E36CBB4869A12A00C1 /* Ad-hoc */ = { + isa = XCBuildConfiguration; + buildSettings = { + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = "Ad-hoc"; + }; + 614C13A76A4F48BC8D46DF65 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 32428E417ACA4F6E90F06881 /* Pods-SSZipArchive-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-SSZipArchive-prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 9305E395E41741F2A0E40E05 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + ONLY_ACTIVE_ARCH = YES; + STRIP_INSTALLED_PRODUCT = NO; + }; + name = Debug; + }; + 97D496DD2A414DDB9FEDD778 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 32428E417ACA4F6E90F06881 /* Pods-SSZipArchive-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-SSZipArchive-prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + AAD5E1AEFA5846E8A13466D0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C67FB33168474E15BCC74541 /* Pods-RaptureXML-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-RaptureXML-prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + AC888BB34F2041EEB42F0403 /* Ad-hoc */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1A85ADFDD6194A758363809D /* Pods-AFNetworking-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-AFNetworking-prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = "Ad-hoc"; + }; + AE8714B74E9748199605AC1B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1A85ADFDD6194A758363809D /* Pods-AFNetworking-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-AFNetworking-prefix.pch"; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + B0A1D7E3D4DF4340B132A366 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CA16C71EAF21476DBBC8153A /* Pods.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + D376AF158D2048CABA9C01C4 /* Ad-hoc */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CA16C71EAF21476DBBC8153A /* Pods.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = "Ad-hoc"; + }; + E6FBAAD492314677AE182BE2 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1A85ADFDD6194A758363809D /* Pods-AFNetworking-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-AFNetworking-prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + F94BA2F129CC4B9B9E79906E /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C67FB33168474E15BCC74541 /* Pods-RaptureXML-Private.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + DSTROOT = /tmp/xcodeproj.dst; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "Pods-RaptureXML-prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INSTALL_PATH = "$(BUILT_PRODUCTS_DIR)"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_CPLUSPLUSFLAGS = ( + "-DNS_BLOCK_ASSERTIONS=1", + "$(inherited)", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 008C4FB1412F4C4EAC2D1C22 /* Build configuration list for PBXNativeTarget "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D376AF158D2048CABA9C01C4 /* Ad-hoc */, + 01F867A9C797419AAFDCD0E1 /* Debug */, + B0A1D7E3D4DF4340B132A366 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 391A3F63364C43CD9EA4CC50 /* Build configuration list for PBXNativeTarget "Pods-SSZipArchive" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 28B9BF0042424878942DF9CC /* Ad-hoc */, + 97D496DD2A414DDB9FEDD778 /* Debug */, + 614C13A76A4F48BC8D46DF65 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7B6D639F3F3E44A29A50E246 /* Build configuration list for PBXNativeTarget "Pods-RaptureXML" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1969F65A516C4A7A97E2375B /* Ad-hoc */, + AAD5E1AEFA5846E8A13466D0 /* Debug */, + F94BA2F129CC4B9B9E79906E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7EAB2EE940B74F1BA017740E /* Build configuration list for PBXNativeTarget "Pods-AFNetworking" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + AC888BB34F2041EEB42F0403 /* Ad-hoc */, + AE8714B74E9748199605AC1B /* Debug */, + E6FBAAD492314677AE182BE2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + CE088627C13E44C288A62681 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 313C61E36CBB4869A12A00C1 /* Ad-hoc */, + 9305E395E41741F2A0E40E05 /* Debug */, + 1BDA8F48A7F2441C8E3EC796 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 33EBB81E91D84613A5DF3ADE /* Project object */; +} diff --git a/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-AFNetworking.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-AFNetworking.xcscheme new file mode 100644 index 0000000..5cafcf9 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-AFNetworking.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-RaptureXML.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-RaptureXML.xcscheme new file mode 100644 index 0000000..65d39b0 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-RaptureXML.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-SSZipArchive.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-SSZipArchive.xcscheme new file mode 100644 index 0000000..17db732 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods-SSZipArchive.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods.xcscheme b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods.xcscheme new file mode 100644 index 0000000..0b212ef --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/Pods.xcscheme @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/xcschememanagement.plist b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..88f0c65 --- /dev/null +++ b/Pods/Pods.xcodeproj/xcuserdata/david.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,157 @@ + + + + + SchemeUserState + + Pods-AFNetworking.xcscheme + + orderHint + 2 + + Pods-RaptureXML.xcscheme + + orderHint + 4 + + Pods-SSZipArchive.xcscheme + + orderHint + 3 + + Pods.xcscheme + + orderHint + 1 + + + SuppressBuildableAutocreation + + 118E21C431C140D6AD84BB19 + + primary + + + 167F5BA3519D4838B20DB65D + + primary + + + 189DA2BFF9E24FD28C6F5631 + + primary + + + 1EB23AAA02A74D17939F0DB5 + + primary + + + 296112615A8F42D3B9FBFC6C + + primary + + + 2F745754AE0B4AD59725E4FA + + primary + + + 585706389F3C404782AC4C7F + + primary + + + 598857D15FFF4591A20E1995 + + primary + + + 5A5EF4FD4DD24A9D8D76927F + + primary + + + 60E8596329BA477082CECD89 + + primary + + + 6669F56DF4A3411D9C9017A9 + + primary + + + 7FABB57AAFA247C281848B9D + + primary + + + 81CFDB0312054B3681178857 + + primary + + + 8C7D29C83FBF4F5695451A47 + + primary + + + 944D830A3EC24A8B915F6747 + + primary + + + 96C5CEE4E8BA4A719803414A + + primary + + + A640933D518E4181AD02EED0 + + primary + + + AB415BFE5A424CD59819C2B0 + + primary + + + AFF68C267F534DB085CB6A58 + + primary + + + C8378221480B49788F671C57 + + primary + + + D3DBD50FB1DB48A5955D86C8 + + primary + + + DAD21173DEEA4767A8EC34A8 + + primary + + + F2505A17E3EA414B8B766663 + + primary + + + F567B9A484554BD7BA6296C3 + + primary + + + F5EE314403C3473B85C48DAC + + primary + + + + + diff --git a/Pods/RaptureXML/License.txt b/Pods/RaptureXML/License.txt new file mode 100644 index 0000000..256df4a --- /dev/null +++ b/Pods/RaptureXML/License.txt @@ -0,0 +1,7 @@ +Copyright (c) 2013 John Blanco + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/Pods/RaptureXML/README.md b/Pods/RaptureXML/README.md new file mode 100644 index 0000000..e044d10 --- /dev/null +++ b/Pods/RaptureXML/README.md @@ -0,0 +1,156 @@ +RaptureXML is a simple, block-based XML library for the iOS platform that provides an expressive API that makes XML processing freakin' fun for once in my life. + +# Why do we need *another* XML library? # + +You tell me. Processing XML in Objective-C is an awful, frustrating experience and the resulting code is never readable. I'm tired of it! RaptureXML solves this by providing a *powerful* new interface on top of libxml2. Imagine for a minute the code you'd write to process the XML for a list of baseball team members, retrieving their numbers, names, and positions using your favorite XML processing library. Now, take a look at how you do it with RaptureXML: + + RXMLElement *rootXML = [RXMLElement elementFromXMLFile:@"players.xml"]; + + [rootXML iterate:@"players.player" usingBlock: ^(RXMLElement *e) { + NSLog(@"Player #%@: %@ (%@)", [e attribute:@"number"], [e child:@"name"].text); + }]; + +RaptureXML changes the game when it comes to XML processing in Objective-C. As you can see from the code, it takes only seconds to understand what this code does. There are no wasted arrays and verbose looping you have to do. The code is a breeze to read and maintain. + +I don't think any more needs to be said. + +# Adding RaptureXML to Your Project # + +There's just a few simple steps: + + * Copy the RaptureXML/RaptureXML folder into your own project and import "RXMLElement.h" somewhere (e.g., your PCH file). + * Link in libz.dylib to your target. + * Link in libxml2.dylib to your target. + * In your build settings, for the key "Header Search Paths", add "$(SDK_DIR)"/usr/include/libxml2 + +RaptureXML supports ARC. In fact, it does so without a branch. The code automatically detects if ARC is being used in your project and compiles accordingly. You are free to use any version of LLVM or gcc as well! (Though you should be using LLVM by now.) + +# Getting Started # + +RaptureXML processes XML in two steps: load and path. This means that you first load the XML from any source you want such as file, data, string, or even from a URL. Then, you simply use its query language to find what you need. + +You can load the XML with any of the following constructors: + + RXMLElement *rootXML = [RXMLElement elementFromXMLString:@"...my xml..." encoding:NSUTF8StringEncoding]; + RXMLElement *rootXML = [RXMLElement elementFromXMLFile:@"myfile.xml"]; + RXMLElement *rootXML = [RXMLElement elementFromXMLFilename:@"myfile" elementFromXMLFilename:@"xml"]; + RXMLElement *rootXML = [RXMLElement elementFromURL:[NSURL URLWithString:@"...my url..."]]; + RXMLElement *rootXML = [RXMLElement elementFromXMLData:myData]; + +These constructors return an RXMLElement object that represents the top-level tags. Now, you can query the data in any number of ways. + +Let's pretend your XML looks like this: + + + + + Terry Collins + 1 + + + + Jose Reyes + SS + + + + Angel Pagan + CF + + + + David Wright + 3B + + + ... + + + + +First, we'd load the XML: + + RXMLElement *rootXML = [RXMLElement elementFromXMLFile:@"players.xml"]; + +We can immediately query the top-level tag name: + + rootXML.tag --> @"team" + +We can read attributes with: + + [rootXML attribute:@"year"] --> @"2011" + [rootXML attribute:@"name"] --> @"New York Mets" + +We can get the players tag with: + + RXMLElement *rxmlPlayers = [rootXML child:@"players"]; + +If we like, we can get all the individual player tags with: + + NSArray *rxmlIndividualPlayers = [rxmlPlayers children:@"player"]; + +From there, we can process the individual players and be happy. Now, this is already much better than any other XML library we've seen, but RaptureXML can use query paths to make this ridiculously easy. Let's use query paths to improve the conciseness our code: + + [rootXML iterate:@"players.player" usingBlock: ^(RXMLElement *player) { + NSLog(@"Player: %@ (#%@)", [player child:@"name"].text, [player attribute:@"number"]); + }]; + +Your block is passed an RXMLElement representing each player in just one line! Alternatively, you could have shortened it with: + +[rootXML iterate:@"players.player" usingBlock: ^(RXMLElement *player) { + NSLog(@"Player: %@ (#%@)", [player child:@"name"], [player attribute:@"number"]); +}]; + +This also works because RXMLElement#description returns the text of the tag. Query paths are even more powerful with wildcards. Let's say we wanted the name of every person on the team, player or coach. We use the wildcard to get it: + + [rootXML iterate:@"players.*.name" usingBlock: ^(RXMLElement *name) { + NSLog(@"Name: %@", name.text); + }]; + +The wildcard processes every tag rather than the one you would've named. You can also use the wildcard to iterate all the children of an element: + + [rootXML iterate:@"players.coach.*" usingBlock: ^(RXMLElement *e) { + NSLog(@"Tag: %@, Text: %@", e.tag, e.text); + }]; + +This gives us all the tags for the coach. Easy enough? + +# XPath # + +If you don't want to use the custom RaptureXML iteration query syntax, you can use the standard XPath query language as well. Here's how you query all players with XPath: + + [rootXML iterateWithRootXPath:@"//player" usingBlock: ^(RXMLElement *player) { + NSLog(@"Player: %@ (#%@)", [player child:@"name"], [player attribute:@"number"]); + }]; + +And remember, you can also test attributes using XPath as well. Here's how you can find the player with #5: + + [rootXML iterateWithRootXPath:@"//player[number='5']" usingBlock: ^(RXMLElement *player) { + NSLog(@"Player #5: %@", [player child:@"name"]); + }]; + +Note that you can only use XPath from the document root and it won't matter what RXMLElement you have. If you have a derived RXMLElement, you can still build from the document root. If you're not familiar with XPath, you can use this [handy guide](http://www.w3schools.com/xpath/xpath_syntax.asp). + +# Namespaces # + +Namespaces are supported for most methods, however not for iterations. If you want to use namespaces for that kind of thing, use the -children method manually. When specifying namespaces, be sure to specify the namespace URI and *not* the prefix. For example, if your XML looked like: + + + ... + + +You would access the attributes with: + + NSLog(@"Team Name: %@", [e attribute:@"name" inNamespace:@"*"]); + +# RubyMotion Support # + +RaptureXML is easily integrated into RubyMotion! [Here's how.](http://raptureinvenice.com/797/) + +# Unit Tests as Documentation # + +You can see the full usage of RaptureXML by reading the unit tests in the project. Not only does it show you all the code, but you'll know it works! (You can run the unit tests by pressing Command-U in XCode) + +# Who Created RaptureXML? # + +RaptureXML was created by John Blanco of Rapture In Venice because he got sick of using all of the bizarre XML solutions for iPhone development. If you like this code and/or need an iOS consultant, get in touch with me via my website, [Rapture In Venice](http://raptureinvenice.com). diff --git a/PsyPad/Helper Classes/RaptureXML/RXMLElement.h b/Pods/RaptureXML/RaptureXML/RXMLElement.h old mode 100755 new mode 100644 similarity index 90% rename from PsyPad/Helper Classes/RaptureXML/RXMLElement.h rename to Pods/RaptureXML/RaptureXML/RXMLElement.h index fdc4b43..afe1288 --- a/PsyPad/Helper Classes/RaptureXML/RXMLElement.h +++ b/Pods/RaptureXML/RaptureXML/RXMLElement.h @@ -34,24 +34,33 @@ #import #import -@interface RXMLElement : NSObject { +@interface RXMLDocHolder : NSObject { xmlDocPtr doc_; +} + +- (id)initWithDocPtr:(xmlDocPtr)doc; +- (xmlDocPtr)doc; + +@end + +@interface RXMLElement : NSObject { xmlNodePtr node_; } - (id)initFromXMLString:(NSString *)xmlString encoding:(NSStringEncoding)encoding; - (id)initFromXMLFile:(NSString *)filename; - (id)initFromXMLFile:(NSString *)filename fileExtension:(NSString*)extension; +- (id)initFromXMLFilePath:(NSString *)fullPath; - (id)initFromURL:(NSURL *)url __attribute__((deprecated)); - (id)initFromXMLData:(NSData *)data; -- (id)initFromXMLNode:(xmlNodePtr)node; +- (id)initFromXMLDoc:(RXMLDocHolder *)doc node:(xmlNodePtr)node; + (id)elementFromXMLString:(NSString *)xmlString encoding:(NSStringEncoding)encoding; + (id)elementFromXMLFile:(NSString *)filename; + (id)elementFromXMLFilename:(NSString *)filename fileExtension:(NSString *)extension; + (id)elementFromURL:(NSURL *)url __attribute__((deprecated)); + (id)elementFromXMLData:(NSData *)data; -+ (id)elementFromXMLNode:(xmlNodePtr)node; ++ (id)elementFromXMLDoc:(RXMLDocHolder *)doc node:(xmlNodePtr)node; - (NSString *)attribute:(NSString *)attributeName; - (NSString *)attribute:(NSString *)attributeName inNamespace:(NSString *)ns; @@ -75,6 +84,7 @@ - (void)iterateWithRootXPath:(NSString *)xpath usingBlock:(void (^)(RXMLElement *))blk; - (void)iterateElements:(NSArray *)elements usingBlock:(void (^)(RXMLElement *))blk; +@property (nonatomic, strong) RXMLDocHolder *xmlDoc; @property (nonatomic, readonly) NSString *tag; @property (nonatomic, readonly) NSString *text; @property (nonatomic, readonly) NSInteger textAsInt; diff --git a/PsyPad/Helper Classes/RaptureXML/RXMLElement.m b/Pods/RaptureXML/RaptureXML/RXMLElement.m old mode 100755 new mode 100644 similarity index 75% rename from PsyPad/Helper Classes/RaptureXML/RXMLElement.m rename to Pods/RaptureXML/RaptureXML/RXMLElement.m index 80a3497..624abae --- a/PsyPad/Helper Classes/RaptureXML/RXMLElement.m +++ b/Pods/RaptureXML/RaptureXML/RXMLElement.m @@ -30,103 +30,62 @@ #import "RXMLElement.h" -// macros for supporting ARC/NON-ARC without need for a branch - -#if __has_feature(objc_arc) - #define SAFE_ARC_RELEASE(x) - #define SAFE_ARC_AUTORELEASE(x) (x) - #define SAFE_ARC_SUPER_DEALLOC() -#else - #define SAFE_ARC_RELEASE(x) ([(x) release]) - #define SAFE_ARC_AUTORELEASE(x) ([(x) autorelease]) - #define SAFE_ARC_SUPER_DEALLOC() ([super dealloc]) -#endif +@implementation RXMLDocHolder + +- (id)initWithDocPtr:(xmlDocPtr)doc { + if ((self = [super init])) { + doc_ = doc; + } + + return self; +} + +- (void)dealloc { + if (doc_ != nil) { + xmlFreeDoc(doc_); + } +} + +- (xmlDocPtr)doc { + return doc_; +} + +@end @implementation RXMLElement - (id)initFromXMLString:(NSString *)xmlString encoding:(NSStringEncoding)encoding { - if ((self = [super init])) { - NSData *data = [xmlString dataUsingEncoding:encoding]; + return [self initFromXMLData:[xmlString dataUsingEncoding:encoding]]; +} - doc_ = xmlReadMemory([data bytes], [data length], "", nil, XML_PARSE_RECOVER); - - if ([self isValid]) { - node_ = xmlDocGetRootElement(doc_); - - if (!node_) { - xmlFreeDoc(doc_); doc_ = nil; - } - } - } - - return self; +- (id)initFromXMLFilePath:(NSString *)fullPath { + return [self initFromXMLData:[NSData dataWithContentsOfFile:fullPath]]; } - (id)initFromXMLFile:(NSString *)filename { - if ((self = [super init])) { - NSString *fullPath = [[[NSBundle bundleForClass:self.class] bundlePath] stringByAppendingPathComponent:filename]; - NSData *data = [NSData dataWithContentsOfFile:fullPath]; - - doc_ = xmlReadMemory([data bytes], [data length], "", nil, XML_PARSE_RECOVER); - - if ([self isValid]) { - node_ = xmlDocGetRootElement(doc_); - - if (!node_) { - xmlFreeDoc(doc_); doc_ = nil; - } - } - } - - return self; + NSString *fullPath = [[[NSBundle bundleForClass:self.class] bundlePath] stringByAppendingPathComponent:filename]; + return [self initFromXMLFilePath:fullPath]; } - (id)initFromXMLFile:(NSString *)filename fileExtension:(NSString *)extension { - if ((self = [super init])) { - NSString *fullPath = [[NSBundle bundleForClass:[self class]] pathForResource:filename ofType:extension]; - NSData *data = [NSData dataWithContentsOfFile:fullPath]; - - doc_ = xmlReadMemory([data bytes], [data length], "", nil, XML_PARSE_RECOVER); - - if ([self isValid]) { - node_ = xmlDocGetRootElement(doc_); - - if (!node_) { - xmlFreeDoc(doc_); doc_ = nil; - } - } - } - - return self; + NSString *fullPath = [[NSBundle bundleForClass:[self class]] pathForResource:filename ofType:extension]; + return [self initFromXMLData:[NSData dataWithContentsOfFile:fullPath]]; } - (id)initFromURL:(NSURL *)url { - if ((self = [super init])) { - NSData *data = [NSData dataWithContentsOfURL:url]; - - doc_ = xmlReadMemory([data bytes], [data length], "", nil, XML_PARSE_RECOVER); - - if ([self isValid]) { - node_ = xmlDocGetRootElement(doc_); - - if (!node_) { - xmlFreeDoc(doc_); doc_ = nil; - } - } - } - - return self; + return [self initFromXMLData:[NSData dataWithContentsOfURL:url]]; } - (id)initFromXMLData:(NSData *)data { if ((self = [super init])) { - doc_ = xmlReadMemory([data bytes], [data length], "", nil, XML_PARSE_RECOVER); + xmlDocPtr doc = xmlReadMemory([data bytes], (int)[data length], "", nil, XML_PARSE_RECOVER); + self.xmlDoc = [[RXMLDocHolder alloc] initWithDocPtr:doc]; if ([self isValid]) { - node_ = xmlDocGetRootElement(doc_); + node_ = xmlDocGetRootElement(doc); if (!node_) { - xmlFreeDoc(doc_); doc_ = nil; + self.xmlDoc = nil; } } } @@ -134,48 +93,52 @@ - (id)initFromXMLData:(NSData *)data { return self; } -- (id)initFromXMLNode:(xmlNodePtr)node { +- (id)initFromXMLDoc:(RXMLDocHolder *)doc node:(xmlNodePtr)node { if ((self = [super init])) { - doc_ = nil; + self.xmlDoc = doc; node_ = node; } return self; } +// Copy the RaptureXML element +// (calling copy will call this method automatically with the default zone) +-(id)copyWithZone:(NSZone *)zone{ + RXMLElement* new_element = [[RXMLElement alloc] init]; + new_element->node_ = node_; + new_element.xmlDoc = self.xmlDoc; + return new_element; +} + + (id)elementFromXMLString:(NSString *)attributeXML_ encoding:(NSStringEncoding)encoding { - return SAFE_ARC_AUTORELEASE([[RXMLElement alloc] initFromXMLString:attributeXML_ encoding:encoding]); + return [[RXMLElement alloc] initFromXMLString:attributeXML_ encoding:encoding]; } + (id)elementFromXMLFile:(NSString *)filename { - return SAFE_ARC_AUTORELEASE([[RXMLElement alloc] initFromXMLFile:filename]); + return [[RXMLElement alloc] initFromXMLFile:filename]; } + (id)elementFromXMLFilename:(NSString *)filename fileExtension:(NSString *)extension { - return SAFE_ARC_AUTORELEASE([[RXMLElement alloc] initFromXMLFile:filename fileExtension:extension]); + return [[RXMLElement alloc] initFromXMLFile:filename fileExtension:extension]; } + (id)elementFromURL:(NSURL *)url { - return SAFE_ARC_AUTORELEASE([[RXMLElement alloc] initFromURL:url]); + return [[RXMLElement alloc] initFromURL:url]; } + (id)elementFromXMLData:(NSData *)data { - return SAFE_ARC_AUTORELEASE([[RXMLElement alloc] initFromXMLData:data]); + return [[RXMLElement alloc] initFromXMLData:data]; } -+ (id)elementFromXMLNode:(xmlNodePtr)node { - return SAFE_ARC_AUTORELEASE([[RXMLElement alloc] initFromXMLNode:node]); ++ (id)elementFromXMLDoc:(RXMLDocHolder *)doc node:(xmlNodePtr)node { + return [[RXMLElement alloc] initFromXMLDoc:doc node:node]; } - (NSString *)description { return [self text]; } -- (void)dealloc { - if (doc_ != nil) xmlFreeDoc(doc_); - SAFE_ARC_SUPER_DEALLOC(); -} - #pragma mark - - (NSString *)tag { @@ -247,7 +210,7 @@ - (double)attributeAsDouble:(NSString *)attName inNamespace:(NSString *)ns { } - (BOOL)isValid { - return (doc_ != nil); + return (self.xmlDoc != nil); } #pragma mark - @@ -283,7 +246,7 @@ - (RXMLElement *)child:(NSString *)tag { } if (cur) { - return [RXMLElement elementFromXMLNode:cur]; + return [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]; } return nil; @@ -321,7 +284,7 @@ - (RXMLElement *)child:(NSString *)tag inNamespace:(NSString *)ns { } if (cur) { - return [RXMLElement elementFromXMLNode:cur]; + return [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]; } return nil; @@ -334,13 +297,13 @@ - (NSArray *)children:(NSString *)tag { while (cur != nil) { if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagC)) { - [children addObject:[RXMLElement elementFromXMLNode:cur]]; + [children addObject:[RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]]; } cur = cur->next; } - return SAFE_ARC_AUTORELEASE([children copy]); + return [children copy]; } - (NSArray *)children:(NSString *)tag inNamespace:(NSString *)ns { @@ -351,13 +314,13 @@ - (NSArray *)children:(NSString *)tag inNamespace:(NSString *)ns { while (cur != nil) { if (cur->type == XML_ELEMENT_NODE && !xmlStrcmp(cur->name, tagC) && !xmlStrcmp(cur->ns->href, namespaceC)) { - [children addObject:[RXMLElement elementFromXMLNode:cur]]; + [children addObject:[RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]]; } cur = cur->next; } - return SAFE_ARC_AUTORELEASE([children copy]); + return [children copy]; } - (NSArray *)childrenWithRootXPath:(NSString *)xpath { @@ -366,7 +329,7 @@ - (NSArray *)childrenWithRootXPath:(NSString *)xpath { return [NSArray array]; } - xmlXPathContextPtr context = xmlXPathNewContext(doc_); + xmlXPathContextPtr context = xmlXPathNewContext([self.xmlDoc doc]); if (context == NULL) { return nil; @@ -385,7 +348,7 @@ - (NSArray *)childrenWithRootXPath:(NSString *)xpath { NSMutableArray *resultNodes = [NSMutableArray array]; for (NSInteger i = 0; i < nodes->nodeNr; i++) { - RXMLElement *element = [RXMLElement elementFromXMLNode:nodes->nodeTab[i]]; + RXMLElement *element = [RXMLElement elementFromXMLDoc:self.xmlDoc node:nodes->nodeTab[i]]; if (element != NULL) { [resultNodes addObject:element]; @@ -421,7 +384,7 @@ - (void)iterate:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk { // midstream do { if (cur->type == XML_ELEMENT_NODE) { - RXMLElement *element = [RXMLElement elementFromXMLNode:cur]; + RXMLElement *element = [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]; NSString *restOfQuery = [[components subarrayWithRange:NSMakeRange(i + 1, components.count - i - 1)] componentsJoinedByString:@"."]; [element iterate:restOfQuery usingBlock:blk]; } @@ -454,7 +417,7 @@ - (void)iterate:(NSString *)query usingBlock:(void (^)(RXMLElement *))blk { do { if (cur->type == XML_ELEMENT_NODE) { - RXMLElement *element = [RXMLElement elementFromXMLNode:cur]; + RXMLElement *element = [RXMLElement elementFromXMLDoc:self.xmlDoc node:cur]; blk(element); } diff --git a/Pods/SSZipArchive/LICENSE b/Pods/SSZipArchive/LICENSE new file mode 100644 index 0000000..0050835 --- /dev/null +++ b/Pods/SSZipArchive/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2010-2013 Sam Soffes, http://soff.es + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Pods/SSZipArchive/Readme.markdown b/Pods/SSZipArchive/Readme.markdown new file mode 100644 index 0000000..d8cfc34 --- /dev/null +++ b/Pods/SSZipArchive/Readme.markdown @@ -0,0 +1,46 @@ +# SSZipArchive + +SSZipArchive is a simple utility class for zipping and unzipping files. Features: + +* Unzipping zip files +* Unzipping password protected zip files +* Creating zip files +* Appending to zip files +* Zipping files +* Zipping NSData with a filename + +## Adding to your project + +1. Add the `SSZipArchive` and `minizip` folders to your project. +2. Add the `libz` library to your target + +SSZipArchive requires ARC. + +## Usage + +``` objective-c +// Unzipping +NSString *zipPath = @"path_to_your_zip_file"; +NSString *destinationPath = @"path_to_the_folder_where_you_want_it_unzipped"; +[SSZipArchive unzipFileAtPath:zipPath toDestination:destinationPath]; + +// Zipping +NSString *zippedPath = @"path_where_you_want_the_file_created"; +NSArray *inputPaths = [NSArray arrayWithObjects: + [[NSBundle mainBundle] pathForResource:@"photo1" ofType:@"jpg"], + [[NSBundle mainBundle] pathForResource:@"photo2" ofType:@"jpg"] + nil]; +[SSZipArchive createZipFileAtPath:zippedPath withFilesAtPaths:inputPaths]; +``` + +## Tests + +Simply, open the Xcode 5 or higher project in the Tests directory and press Command-U to run the tests. + +## License + +SSZipArchive is licensed under the [MIT license](https://github.com/samsoffes/ssziparchive/raw/master/LICENSE). A slightly modified version of [Minizip](http://www.winimage.com/zLibDll/minizip.html) 1.1 is also included and is licensed under the [Zlib license](http://www.zlib.net/zlib_license.html). + +## Thanks + +Thanks [aish](http://code.google.com/p/ziparchive) for creating [ZipArchive](http://code.google.com/p/ziparchive) which SSZipArchive is based on, Johnnie Walker ([@randomsequence](https://github.com/randomsequence)) for implementing creation support, and John Engelhart ([@johnezang](https://github.com/johnezang)) for all his amazing help along the way. diff --git a/SSZipArchive/SSZipArchive.h b/Pods/SSZipArchive/SSZipArchive/SSZipArchive.h old mode 100755 new mode 100644 similarity index 100% rename from SSZipArchive/SSZipArchive.h rename to Pods/SSZipArchive/SSZipArchive/SSZipArchive.h diff --git a/SSZipArchive/SSZipArchive.m b/Pods/SSZipArchive/SSZipArchive/SSZipArchive.m old mode 100755 new mode 100644 similarity index 50% rename from SSZipArchive/SSZipArchive.m rename to Pods/SSZipArchive/SSZipArchive/SSZipArchive.m index f07d37d..03ab708 --- a/SSZipArchive/SSZipArchive.m +++ b/Pods/SSZipArchive/SSZipArchive/SSZipArchive.m @@ -80,168 +80,189 @@ + (BOOL)unzipFileAtPath:(NSString *)path toDestination:(NSString *)destination o NSInteger currentFileNumber = 0; do { - if ([password length] == 0) { - ret = unzOpenCurrentFile(zip); - } else { - ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSASCIIStringEncoding]); - } - - if (ret != UNZ_OK) { - success = NO; - break; - } - - // Reading data and write to file - unz_file_info fileInfo; - memset(&fileInfo, 0, sizeof(unz_file_info)); - - ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); - if (ret != UNZ_OK) { - success = NO; - unzCloseCurrentFile(zip); - break; - } - - // Message delegate - if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { - [delegate zipArchiveWillUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry - archivePath:path fileInfo:fileInfo]; - } - - char *filename = (char *)malloc(fileInfo.size_filename + 1); - unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); - filename[fileInfo.size_filename] = '\0'; - - // - // NOTE - // I used the ZIP spec from here: - // http://www.pkware.com/documents/casestudies/APPNOTE.TXT - // - // ...to deduce this method of detecting whether the file in the ZIP is a symbolic link. - // If it is, it is listed as a directory but has a data size greater than zero (real - // directories have it equal to 0) and the included, uncompressed data is the symbolic link path. - // - // ZIP files did not originally include support for symbolic links so the specification - // doesn't include anything in them that isn't part of a unix extension that isn't being used - // by the archivers we're testing. Most of this is figured out through trial and error and - // reading ZIP headers in hex editors. This seems to do the trick though. - // - - const uLong ZipCompressionMethodStore = 0; - - BOOL fileIsSymbolicLink = NO; - - if((fileInfo.compression_method == ZipCompressionMethodStore) && // Is it compressed? - (S_ISDIR(fileInfo.external_fa)) && // Is it marked as a directory - (fileInfo.compressed_size > 0)) // Is there any data? - { - fileIsSymbolicLink = YES; - } - - // Check if it contains directory - NSString *strPath = [NSString stringWithCString:filename encoding:NSUTF8StringEncoding]; - BOOL isDirectory = NO; - if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') { - isDirectory = YES; - } - free(filename); - - // Contains a path - if ([strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location != NSNotFound) { - strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; - } - - NSString *fullPath = [destination stringByAppendingPathComponent:strPath]; - NSError *err = nil; - NSDate *modDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate]; - NSDictionary *directoryAttr = [NSDictionary dictionaryWithObjectsAndKeys:modDate, NSFileCreationDate, modDate, NSFileModificationDate, nil]; - - if (isDirectory) { - [fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err]; - } else { - [fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:directoryAttr error:&err]; - } - if (nil != err) { - NSLog(@"[SSZipArchive] Error: %@", err.localizedDescription); - } - - if(!fileIsSymbolicLink) - [directoriesModificationDates addObject: [NSDictionary dictionaryWithObjectsAndKeys:fullPath, @"path", modDate, @"modDate", nil]]; - - if ([fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite) { - unzCloseCurrentFile(zip); - ret = unzGoToNextFile(zip); - continue; - } - - if(!fileIsSymbolicLink) - { - FILE *fp = fopen((const char*)[fullPath UTF8String], "wb"); - while (fp) { - int readBytes = unzReadCurrentFile(zip, buffer, 4096); - - if (readBytes > 0) { - fwrite(buffer, readBytes, 1, fp ); - } else { - break; - } - } - - if (fp) { - fclose(fp); - - // Set the original datetime property - if (fileInfo.dosDate != 0) { - NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate]; - NSDictionary *attr = [NSDictionary dictionaryWithObject:orgDate forKey:NSFileModificationDate]; + @autoreleasepool { + if ([password length] == 0) { + ret = unzOpenCurrentFile(zip); + } else { + ret = unzOpenCurrentFilePassword(zip, [password cStringUsingEncoding:NSASCIIStringEncoding]); + } + + if (ret != UNZ_OK) { + success = NO; + break; + } + + // Reading data and write to file + unz_file_info fileInfo; + memset(&fileInfo, 0, sizeof(unz_file_info)); + + ret = unzGetCurrentFileInfo(zip, &fileInfo, NULL, 0, NULL, 0, NULL, 0); + if (ret != UNZ_OK) { + success = NO; + unzCloseCurrentFile(zip); + break; + } + + // Message delegate + if ([delegate respondsToSelector:@selector(zipArchiveWillUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { + [delegate zipArchiveWillUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry + archivePath:path fileInfo:fileInfo]; + } + + char *filename = (char *)malloc(fileInfo.size_filename + 1); + unzGetCurrentFileInfo(zip, &fileInfo, filename, fileInfo.size_filename + 1, NULL, 0, NULL, 0); + filename[fileInfo.size_filename] = '\0'; + + // + // NOTE + // I used the ZIP spec from here: + // http://www.pkware.com/documents/casestudies/APPNOTE.TXT + // + // ...to deduce this method of detecting whether the file in the ZIP is a symbolic link. + // If it is, it is listed as a directory but has a data size greater than zero (real + // directories have it equal to 0) and the included, uncompressed data is the symbolic link path. + // + // ZIP files did not originally include support for symbolic links so the specification + // doesn't include anything in them that isn't part of a unix extension that isn't being used + // by the archivers we're testing. Most of this is figured out through trial and error and + // reading ZIP headers in hex editors. This seems to do the trick though. + // + + const uLong ZipCompressionMethodStore = 0; + + BOOL fileIsSymbolicLink = NO; + + if((fileInfo.compression_method == ZipCompressionMethodStore) && // Is it compressed? + (S_ISDIR(fileInfo.external_fa)) && // Is it marked as a directory + (fileInfo.compressed_size > 0)) // Is there any data? + { + fileIsSymbolicLink = YES; + } + + // Check if it contains directory + NSString *strPath = [NSString stringWithCString:filename encoding:NSUTF8StringEncoding]; + BOOL isDirectory = NO; + if (filename[fileInfo.size_filename-1] == '/' || filename[fileInfo.size_filename-1] == '\\') { + isDirectory = YES; + } + free(filename); + + // Contains a path + if ([strPath rangeOfCharacterFromSet:[NSCharacterSet characterSetWithCharactersInString:@"/\\"]].location != NSNotFound) { + strPath = [strPath stringByReplacingOccurrencesOfString:@"\\" withString:@"/"]; + } + + NSString *fullPath = [destination stringByAppendingPathComponent:strPath]; + NSError *err = nil; + NSDate *modDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate]; + NSDictionary *directoryAttr = [NSDictionary dictionaryWithObjectsAndKeys:modDate, NSFileCreationDate, modDate, NSFileModificationDate, nil]; + + if (isDirectory) { + [fileManager createDirectoryAtPath:fullPath withIntermediateDirectories:YES attributes:directoryAttr error:&err]; + } else { + [fileManager createDirectoryAtPath:[fullPath stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:directoryAttr error:&err]; + } + if (nil != err) { + NSLog(@"[SSZipArchive] Error: %@", err.localizedDescription); + } + + if(!fileIsSymbolicLink) + [directoriesModificationDates addObject: [NSDictionary dictionaryWithObjectsAndKeys:fullPath, @"path", modDate, @"modDate", nil]]; + + if ([fileManager fileExistsAtPath:fullPath] && !isDirectory && !overwrite) { + unzCloseCurrentFile(zip); + ret = unzGoToNextFile(zip); + continue; + } + + if(!fileIsSymbolicLink) + { + FILE *fp = fopen((const char*)[fullPath UTF8String], "wb"); + while (fp) { + int readBytes = unzReadCurrentFile(zip, buffer, 4096); + + if (readBytes > 0) { + fwrite(buffer, readBytes, 1, fp ); + } else { + break; + } + } + + if (fp) { + fclose(fp); + + // Set the original datetime property + if (fileInfo.dosDate != 0) { + NSDate *orgDate = [[self class] _dateWithMSDOSFormat:(UInt32)fileInfo.dosDate]; + NSDictionary *attr = [NSDictionary dictionaryWithObject:orgDate forKey:NSFileModificationDate]; + + if (attr) { + if ([fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] == NO) { + // Can't set attributes + NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting modification date"); + } + } + } - if (attr) { - if ([fileManager setAttributes:attr ofItemAtPath:fullPath error:nil] == NO) { - // Can't set attributes - NSLog(@"[SSZipArchive] Failed to set attributes"); + // Set the original permissions on the file + uLong permissions = fileInfo.external_fa >> 16; + if (permissions != 0) { + // Store it into a NSNumber + NSNumber *permissionsValue = @(permissions); + + // Retrieve any existing attributes + NSMutableDictionary *attrs = [[NSMutableDictionary alloc] initWithDictionary:[fileManager attributesOfItemAtPath:fullPath error:nil]]; + + // Set the value in the attributes dict + attrs[NSFilePosixPermissions] = permissionsValue; + + // Update attributes + if ([fileManager setAttributes:attrs ofItemAtPath:fullPath error:nil] == NO) { + // Unable to set the permissions attribute + NSLog(@"[SSZipArchive] Failed to set attributes - whilst setting permissions"); } } - } - } - } - else - { - // Get the path for the symbolic link - - NSURL* symlinkURL = [NSURL fileURLWithPath:fullPath]; - NSMutableString* destinationPath = [NSMutableString string]; - - int bytesRead = 0; - while((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0) - { - buffer[bytesRead] = 0; - [destinationPath appendString:[NSString stringWithUTF8String:(const char*)buffer]]; - } - - //NSLog(@"Symlinking to: %@", destinationPath); - - NSURL* destinationURL = [NSURL fileURLWithPath:destinationPath]; - - // Create the symbolic link - NSError* symlinkError = nil; - [fileManager createSymbolicLinkAtURL:symlinkURL withDestinationURL:destinationURL error:&symlinkError]; - - if(symlinkError != nil) - { - NSLog(@"Failed to create symbolic link at \"%@\" to \"%@\". Error: %@", symlinkURL.absoluteString, destinationURL.absoluteString, symlinkError.localizedDescription); - } - } - - unzCloseCurrentFile( zip ); - ret = unzGoToNextFile( zip ); - - // Message delegate - if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { - [delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry - archivePath:path fileInfo:fileInfo]; + } + } + else + { + // Get the path for the symbolic link + + NSURL* symlinkURL = [NSURL fileURLWithPath:fullPath]; + NSMutableString* destinationPath = [NSMutableString string]; + + int bytesRead = 0; + while((bytesRead = unzReadCurrentFile(zip, buffer, 4096)) > 0) + { + buffer[bytesRead] = 0; + [destinationPath appendString:[NSString stringWithUTF8String:(const char*)buffer]]; + } + + //NSLog(@"Symlinking to: %@", destinationPath); + + NSURL* destinationURL = [NSURL fileURLWithPath:destinationPath]; + + // Create the symbolic link + NSError* symlinkError = nil; + [fileManager createSymbolicLinkAtURL:symlinkURL withDestinationURL:destinationURL error:&symlinkError]; + + if(symlinkError != nil) + { + NSLog(@"Failed to create symbolic link at \"%@\" to \"%@\". Error: %@", symlinkURL.absoluteString, destinationURL.absoluteString, symlinkError.localizedDescription); + } + } + + unzCloseCurrentFile( zip ); + ret = unzGoToNextFile( zip ); + + // Message delegate + if ([delegate respondsToSelector:@selector(zipArchiveDidUnzipFileAtIndex:totalFiles:archivePath:fileInfo:)]) { + [delegate zipArchiveDidUnzipFileAtIndex:currentFileNumber totalFiles:(NSInteger)globalInfo.number_entry + archivePath:path fileInfo:fileInfo]; + } + + currentFileNumber++; } - - currentFileNumber++; } while(ret == UNZ_OK && ret != UNZ_END_OF_LIST_OF_FILE); // Close @@ -295,15 +316,17 @@ + (BOOL)createZipFileAtPath:(NSString *)path withFilesAtPaths:(NSArray *)paths { + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString *)directoryPath { BOOL success = NO; + + NSFileManager *fileManager = nil; SSZipArchive *zipArchive = [[SSZipArchive alloc] initWithPath:path]; if ([zipArchive open]) { // use a local filemanager (queue/thread compatibility) - NSFileManager *fileManager = [[NSFileManager alloc] init]; + fileManager = [[NSFileManager alloc] init]; NSDirectoryEnumerator *dirEnumerator = [fileManager enumeratorAtPath:directoryPath]; NSString *fileName; - while (fileName = [dirEnumerator nextObject]) { + while ((fileName = [dirEnumerator nextObject])) { BOOL isDir; NSString *fullFilePath = [directoryPath stringByAppendingPathComponent:fileName]; [fileManager fileExistsAtPath:fullFilePath isDirectory:&isDir]; @@ -315,6 +338,7 @@ + (BOOL)createZipFileAtPath:(NSString *)path withContentsOfDirectory:(NSString * } #if !__has_feature(objc_arc) + [fileManager release]; [zipArchive release]; #endif @@ -382,7 +406,36 @@ - (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName { afileName = [fileName UTF8String]; } - zipOpenNewFileInZip(_zip, afileName, NULL, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); + zip_fileinfo zipInfo = {{0}}; + + NSDictionary *attr = [[NSFileManager defaultManager] attributesOfItemAtPath:path error: nil]; + if( attr ) + { + NSDate *fileDate = (NSDate *)[attr objectForKey:NSFileModificationDate]; + if( fileDate ) + { + [self zipInfo:&zipInfo setDate: fileDate ]; + } + + // Write permissions into the external attributes, for details on this see here: http://unix.stackexchange.com/a/14727 + // Get the permissions value from the files attributes + NSNumber *permissionsValue = (NSNumber *)[attr objectForKey:NSFilePosixPermissions]; + if (permissionsValue) { + // Get the short value for the permissions + short permissionsShort = permissionsValue.shortValue; + + // Convert this into an octal by adding 010000, 010000 being the flag for a regular file + NSInteger permissionsOctal = 0100000 + permissionsShort; + + // Convert this into a long value + uLong permissionsLong = @(permissionsOctal).unsignedLongValue; + + // Store this into the external file attributes once it has been shifted 16 places left to form part of the second from last byte + zipInfo.external_fa = permissionsLong << 16L; + } + } + + zipOpenNewFileInZip(_zip, afileName, &zipInfo, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_DEFAULT_COMPRESSION); void *buffer = malloc(CHUNK); unsigned int len = 0; @@ -395,6 +448,7 @@ - (BOOL)writeFileAtPath:(NSString *)path withFileName:(NSString *)fileName { zipCloseFileInZip(_zip); free(buffer); + fclose(input); return YES; } @@ -442,7 +496,12 @@ + (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime { static const UInt32 kMinuteMask = 0x7E0; static const UInt32 kSecondMask = 0x1F; - NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + static NSCalendar *gregorian; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]; + }); + NSDateComponents *components = [[NSDateComponents alloc] init]; NSAssert(0xFFFFFFFF == (kYearMask | kMonthMask | kDayMask | kHourMask | kMinuteMask | kSecondMask), @"[SSZipArchive] MSDOS date masks don't add up"); @@ -457,7 +516,6 @@ + (NSDate *)_dateWithMSDOSFormat:(UInt32)msdosDateTime { NSDate *date = [NSDate dateWithTimeInterval:0 sinceDate:[gregorian dateFromComponents:components]]; #if !__has_feature(objc_arc) - [gregorian release]; [components release]; #endif diff --git a/SSZipArchive/minizip/crypt.h b/Pods/SSZipArchive/minizip/crypt.h similarity index 100% rename from SSZipArchive/minizip/crypt.h rename to Pods/SSZipArchive/minizip/crypt.h diff --git a/SSZipArchive/minizip/ioapi.c b/Pods/SSZipArchive/minizip/ioapi.c similarity index 100% rename from SSZipArchive/minizip/ioapi.c rename to Pods/SSZipArchive/minizip/ioapi.c diff --git a/SSZipArchive/minizip/ioapi.h b/Pods/SSZipArchive/minizip/ioapi.h similarity index 100% rename from SSZipArchive/minizip/ioapi.h rename to Pods/SSZipArchive/minizip/ioapi.h diff --git a/SSZipArchive/minizip/mztools.c b/Pods/SSZipArchive/minizip/mztools.c similarity index 100% rename from SSZipArchive/minizip/mztools.c rename to Pods/SSZipArchive/minizip/mztools.c diff --git a/SSZipArchive/minizip/mztools.h b/Pods/SSZipArchive/minizip/mztools.h similarity index 100% rename from SSZipArchive/minizip/mztools.h rename to Pods/SSZipArchive/minizip/mztools.h diff --git a/SSZipArchive/minizip/unzip.c b/Pods/SSZipArchive/minizip/unzip.c similarity index 100% rename from SSZipArchive/minizip/unzip.c rename to Pods/SSZipArchive/minizip/unzip.c diff --git a/SSZipArchive/minizip/unzip.h b/Pods/SSZipArchive/minizip/unzip.h similarity index 100% rename from SSZipArchive/minizip/unzip.h rename to Pods/SSZipArchive/minizip/unzip.h diff --git a/SSZipArchive/minizip/zip.c b/Pods/SSZipArchive/minizip/zip.c similarity index 100% rename from SSZipArchive/minizip/zip.c rename to Pods/SSZipArchive/minizip/zip.c diff --git a/SSZipArchive/minizip/zip.h b/Pods/SSZipArchive/minizip/zip.h similarity index 100% rename from SSZipArchive/minizip/zip.h rename to Pods/SSZipArchive/minizip/zip.h diff --git a/PsyPad.xcodeproj/project.pbxproj b/PsyPad.xcodeproj/project.pbxproj index 7558cc0..5fd2a0f 100755 --- a/PsyPad.xcodeproj/project.pbxproj +++ b/PsyPad.xcodeproj/project.pbxproj @@ -7,42 +7,26 @@ objects = { /* Begin PBXBuildFile section */ + 31B4AA332A724059B3C3EB8E /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B9C09253E5E04B5EA4554FB3 /* libPods.a */; }; 5AF0E0005D2CBAD344805694 /* UIColor+Hex.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EDD0B07FD5C084721830 /* UIColor+Hex.m */; }; 5AF0E02E211A49C5924FBCB8 /* CoreData.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF0EFE89B4C637A29351647 /* CoreData.framework */; }; - 5AF0E0A795186EFD399FF499 /* AFImageRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E39C9D79853382B0FE08 /* AFImageRequestOperation.m */; }; - 5AF0E0D7BADDC228C490CD78 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF0E51192AA25A17AF7E63F /* libCorePlot-CocoaTouch.a */; }; - 5AF0E11CBDE42B00EC852FB2 /* AFURLConnectionOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E943D2F0F406BA1754D6 /* AFURLConnectionOperation.m */; }; 5AF0E16D74928A2480ABE261 /* NSString+getNumberFromString.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E1E5D69FD88434DD9985 /* NSString+getNumberFromString.m */; }; 5AF0E1E31E95B770EA668A38 /* TestLogItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EFE0824C1518B886B1BF /* TestLogItem.m */; }; - 5AF0E1E77A948B634053659E /* AFJSONRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E4D05B01273D4ECB191D /* AFJSONRequestOperation.m */; }; - 5AF0E1FF06C4A80C86A126F4 /* RXMLElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E926F8094CE8B38E4795 /* RXMLElement.m */; }; 5AF0E200E675571F3B6E5FFC /* libxml2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF0E61F0BEAD03448FE32BD /* libxml2.dylib */; }; 5AF0E20E0297DAD6DCDFE63C /* MBProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E2321D0BDE4D9E2E3F66 /* MBProgressHUD.m */; }; 5AF0E26DEA506465B67AA052 /* NSArray+GetRandom.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EE35DE91145EFEA1123B /* NSArray+GetRandom.m */; }; 5AF0E29E91C2624D3AB5454B /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF0E6849873D0FE1707D115 /* AVFoundation.framework */; }; 5AF0E2B31987AE178A5BB5B8 /* NSString+containsCategory.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E7C430C57B7CDE1EB06B /* NSString+containsCategory.m */; }; - 5AF0E2CFE8CDCAF5E0B4E1B3 /* AFPropertyListRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EAFB7931802476B8BAC3 /* AFPropertyListRequestOperation.m */; }; - 5AF0E3058A5AF1C41E60A835 /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0ED8D3FFB87DC99D0A341 /* zip.c */; }; - 5AF0E324D4AC58E2F0BBCE2D /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EBEEDEB2CA37F76F27E1 /* unzip.c */; }; 5AF0E348E1EB72492DB80135 /* Mean.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EDE6B74D3ACEFA9D72D8 /* Mean.m */; }; 5AF0E3B4932D22B782FDC1D7 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 5AF0EB38562144A83BCAB3D4 /* MainStoryboard.storyboard */; }; - 5AF0E3B64923D4A7AAA0CFD7 /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E120D26C12F478C57DA6 /* AFNetworkActivityIndicatorManager.m */; }; 5AF0E494EABCA7E429787D77 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF0E52A944A57021D9519D3 /* QuartzCore.framework */; }; - 5AF0E5177929ED4663E38C09 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0ECF22D3428F5241CA219 /* UIImageView+AFNetworking.m */; }; - 5AF0E56F4E38E32BF3D801F2 /* SSZipArchive.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E0439DF74E008453B984 /* SSZipArchive.m */; }; 5AF0E5C1204C19BECA4857F7 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF0E75B36ED26022AF3F4E5 /* MobileCoreServices.framework */; }; 5AF0E63465BCA419C9918EE4 /* Staircase.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EDECD815728F1903E396 /* Staircase.m */; }; 5AF0E6552E4BAE482FA33C0F /* ManageUserTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EDF2375B76A42DA5EF62 /* ManageUserTableViewController.m */; }; - 5AF0E6F3680D22E10C0E0A74 /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EAF704B3828E049B9F9B /* ioapi.c */; }; - 5AF0E82555DDE871A4DC1414 /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E7B3571AA23383A350F9 /* mztools.c */; }; - 5AF0E869AE5B5B9112FD602D /* AFHTTPRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EF99B57AEA8EA4A14C4C /* AFHTTPRequestOperation.m */; }; - 5AF0E8DD8EFF8C81B0C51B27 /* AFXMLRequestOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E45067F050C71046E975 /* AFXMLRequestOperation.m */; }; 5AF0EA20E93B462604540281 /* TestSequenceFolder.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E49ABC79866125DC819F /* TestSequenceFolder.m */; }; 5AF0EB2DD285A8F2E6DF60B8 /* AdminPanelTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EB2270778FECB039C261 /* AdminPanelTableViewController.m */; }; - 5AF0EB5741C29B00E5C081C1 /* AFHTTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E9302F03ADE782B8C870 /* AFHTTPClient.m */; }; 5AF0EC3121BF8F52B737D033 /* UIImage+Picker.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EB0671EC4B4CDA0887E1 /* UIImage+Picker.m */; }; 5AF0EC3A506560EBF3BD4715 /* TestSequenceImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E34C62954EA36D3FA704 /* TestSequenceImage.m */; }; - 5AF0EC57CCD6EE984899DA20 /* DistanceDetector.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E1DB9C3BAB762EBAEF41 /* DistanceDetector.m */; }; 5AF0ECEFD70C74D7C83442AC /* TestConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0EA372969AC9A38ECB9DD /* TestConfiguration.m */; }; 5AF0ECF4CC1084F8A4B0825C /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5AF0EE151654C60F05532BEF /* CoreVideo.framework */; }; 5AF0ED20344A4A8834011EFC /* TestLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 5AF0E64D67CE65EBACC34616 /* TestLog.m */; }; @@ -62,8 +46,6 @@ 63276B6A16A4C1060002CF30 /* AnalysisTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63276B6916A4C1060002CF30 /* AnalysisTableViewController.m */; }; 63276B7016A4C23A0002CF30 /* BarChartCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 63276B6F16A4C23A0002CF30 /* BarChartCell.m */; }; 6357F483168EC32300B5232F /* Model.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = 63122FA6168EBF6C00F9D388 /* Model.xcdatamodel */; }; - 635A886B17C308DD0076C342 /* grating@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 635A886A17C308DD0076C342 /* grating@2x.png */; }; - 635A886D17C309740076C342 /* grating.png in Resources */ = {isa = PBXBuildFile; fileRef = 635A886C17C309740076C342 /* grating.png */; }; 635D079A168D7D0D002B845F /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 635D0799168D7D0D002B845F /* UIKit.framework */; }; 635D079C168D7D0D002B845F /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 635D079B168D7D0D002B845F /* Foundation.framework */; }; 635D079E168D7D0D002B845F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 635D079D168D7D0D002B845F /* CoreGraphics.framework */; }; @@ -81,12 +63,13 @@ 6385E38E18176F3D00508530 /* tick@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6385E38D18176F3D00508530 /* tick@2x.png */; }; 6385E3911817802200508530 /* open.png in Resources */ = {isa = PBXBuildFile; fileRef = 6385E38F1817802200508530 /* open.png */; }; 6385E3921817802200508530 /* open@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 6385E3901817802200508530 /* open@2x.png */; }; - 6396506016B2262800C13479 /* DistanceDetectorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 6396505F16B2262700C13479 /* DistanceDetectorViewController.m */; }; 63A1ED6017B89C100089C204 /* UserTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 63A1ED5F17B89C100089C204 /* UserTableViewCell.m */; }; 63C492D01807D4B900F6AFEF /* splash@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 63C492CF1807D4B900F6AFEF /* splash@2x.png */; }; 63C492D21807D50300F6AFEF /* splash.png in Resources */ = {isa = PBXBuildFile; fileRef = 63C492D11807D50300F6AFEF /* splash.png */; }; 63C492D41807D56D00F6AFEF /* Default-Landscape.png in Resources */ = {isa = PBXBuildFile; fileRef = 63C492D31807D56D00F6AFEF /* Default-Landscape.png */; }; 63C492D81807D5E900F6AFEF /* Default-Landscape@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 63C492D71807D5E900F6AFEF /* Default-Landscape@2x.png */; }; + 63C70C7B181E5F0F00D75098 /* grating.png in Resources */ = {isa = PBXBuildFile; fileRef = 63C70C79181E5F0F00D75098 /* grating.png */; }; + 63C70C7C181E5F0F00D75098 /* grating@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 63C70C7A181E5F0F00D75098 /* grating@2x.png */; }; 63DC3D2A1696F9A600ACCFBE /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 63DC3D291696F9A600ACCFBE /* libz.dylib */; }; 63DC3D3F1696F9FD00ACCFBE /* tick.png in Resources */ = {isa = PBXBuildFile; fileRef = 63DC3D3E1696F9FD00ACCFBE /* tick.png */; }; 63DC3D561696FFF900ACCFBE /* SelectConfigurationTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 63DC3D551696FFF900ACCFBE /* SelectConfigurationTableViewController.m */; }; @@ -103,158 +86,50 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ - 5AF0E00C0EF68A64C910B7AF /* CPTLineCap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTLineCap.h; sourceTree = ""; }; + 46756309933747649878AFBC /* Pods.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.xcconfig; path = Pods/Pods.xcconfig; sourceTree = ""; }; 5AF0E038AC84C3F0E0CBF0BA /* TestConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestConfiguration.h; sourceTree = ""; }; - 5AF0E0439DF74E008453B984 /* SSZipArchive.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SSZipArchive.m; sourceTree = ""; }; - 5AF0E0A1DEF2D44477B078E4 /* unzip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unzip.h; sourceTree = ""; }; 5AF0E0B43ACD00DDB91FFA42 /* Mean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Mean.h; sourceTree = ""; }; - 5AF0E0EACE7447694381456A /* CPTMutableTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTMutableTextStyle.h; sourceTree = ""; }; - 5AF0E11D0EC97536BE0EF282 /* CPTXYAxisSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTXYAxisSet.h; sourceTree = ""; }; - 5AF0E120D26C12F478C57DA6 /* AFNetworkActivityIndicatorManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkActivityIndicatorManager.m; sourceTree = ""; }; - 5AF0E146890AA6AE2220AA12 /* CPTTimeFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTimeFormatter.h; sourceTree = ""; }; - 5AF0E14696DED1189770D16C /* CPTAxisTitle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxisTitle.h; sourceTree = ""; }; - 5AF0E1644BB4EF3520C82957 /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+AFNetworking.h"; sourceTree = ""; }; - 5AF0E17300F1AC3B1A055572 /* AFHTTPRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPRequestOperation.h; sourceTree = ""; }; 5AF0E1B54E3C7EF85636E291 /* TestLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestLog.h; sourceTree = ""; }; - 5AF0E1C0ECD5BF71AE4EECBD /* DistanceDetector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DistanceDetector.h; sourceTree = ""; }; - 5AF0E1DB9C3BAB762EBAEF41 /* DistanceDetector.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DistanceDetector.m; sourceTree = ""; }; 5AF0E1E5D69FD88434DD9985 /* NSString+getNumberFromString.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+getNumberFromString.m"; sourceTree = ""; }; - 5AF0E210722A29D5DF157AFE /* CPTPlatformSpecificDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlatformSpecificDefines.h; sourceTree = ""; }; 5AF0E2321D0BDE4D9E2E3F66 /* MBProgressHUD.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MBProgressHUD.m; sourceTree = ""; }; - 5AF0E232D9FFA48CA8E9A60E /* CPTAxis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxis.h; sourceTree = ""; }; - 5AF0E2B69B0E0205BAA93DFB /* AFXMLRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFXMLRequestOperation.h; sourceTree = ""; }; - 5AF0E2CBD18A5743D7FC2042 /* CPTGraphHostingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGraphHostingView.h; sourceTree = ""; }; 5AF0E312DFA8457A95F447AE /* Staircase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Staircase.h; sourceTree = ""; }; - 5AF0E3324B6A0799B32074F3 /* mainpage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mainpage.h; sourceTree = ""; }; 5AF0E34C62954EA36D3FA704 /* TestSequenceImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestSequenceImage.m; sourceTree = ""; }; - 5AF0E365299EFA0DB53C9CA5 /* CPTUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTUtilities.h; sourceTree = ""; }; - 5AF0E38F725951B86B41EC39 /* CPTPlotRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotRange.h; sourceTree = ""; }; - 5AF0E399797D34839CFAF8EF /* CPTPieChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPieChart.h; sourceTree = ""; }; - 5AF0E39C9D79853382B0FE08 /* AFImageRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFImageRequestOperation.m; sourceTree = ""; }; 5AF0E39E0296913BEDA4190D /* CoreImage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreImage.framework; path = System/Library/Frameworks/CoreImage.framework; sourceTree = SDKROOT; }; - 5AF0E3A0012A1CEEE7620641 /* CPTGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGradient.h; sourceTree = ""; }; - 5AF0E3BD2A2367283F24859A /* CPTConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTConstraints.h; sourceTree = ""; }; - 5AF0E3E986F635AD8F72F542 /* CPTColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTColor.h; sourceTree = ""; }; - 5AF0E40FF3B9248421C87385 /* SSZipArchive.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SSZipArchive.h; sourceTree = ""; }; - 5AF0E41AC1453ECFDCF38E6C /* CPTMutableNumericData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTMutableNumericData.h; sourceTree = ""; }; - 5AF0E4278748F8A2C97ED59E /* CPTXYGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTXYGraph.h; sourceTree = ""; }; - 5AF0E4282B52BBE32E4D5D2E /* CPTDerivedXYGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTDerivedXYGraph.h; sourceTree = ""; }; - 5AF0E42B6677FFA34C66D14E /* CPTPlotSpaceAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotSpaceAnnotation.h; sourceTree = ""; }; - 5AF0E45067F050C71046E975 /* AFXMLRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFXMLRequestOperation.m; sourceTree = ""; }; - 5AF0E46410A98B0F418AD9CB /* CPTPlotSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotSymbol.h; sourceTree = ""; }; - 5AF0E4997905650225443279 /* CPTBorderedLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTBorderedLayer.h; sourceTree = ""; }; 5AF0E49ABC79866125DC819F /* TestSequenceFolder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestSequenceFolder.m; sourceTree = ""; }; - 5AF0E4D05B01273D4ECB191D /* AFJSONRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFJSONRequestOperation.m; sourceTree = ""; }; - 5AF0E4DCDF6BE9E22F57E779 /* CPTMutableNumericData+TypeConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPTMutableNumericData+TypeConversion.h"; sourceTree = ""; }; - 5AF0E4F27AAE107773745E73 /* zip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zip.h; sourceTree = ""; }; - 5AF0E4FF636A9A419FE5B48A /* AFImageRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFImageRequestOperation.h; sourceTree = ""; }; - 5AF0E501D35D2A432F959C09 /* CPTLineStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTLineStyle.h; sourceTree = ""; }; - 5AF0E51192AA25A17AF7E63F /* libCorePlot-CocoaTouch.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libCorePlot-CocoaTouch.a"; sourceTree = ""; }; 5AF0E52A944A57021D9519D3 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 5AF0E55168F29C8AE71FAB34 /* CPTTextStylePlatformSpecific.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTextStylePlatformSpecific.h; sourceTree = ""; }; - 5AF0E560FC0644EABF45DC91 /* AFPropertyListRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFPropertyListRequestOperation.h; sourceTree = ""; }; - 5AF0E5A39C70ECEFAF6DE239 /* CorePlot-CocoaTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CorePlot-CocoaTouch.h"; sourceTree = ""; }; - 5AF0E5F66514F456E9550770 /* CPTGridLineGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGridLineGroup.h; sourceTree = ""; }; - 5AF0E5F712144146CF2E499C /* CPTLayerAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTLayerAnnotation.h; sourceTree = ""; }; 5AF0E61F0BEAD03448FE32BD /* libxml2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libxml2.dylib; path = usr/lib/libxml2.dylib; sourceTree = SDKROOT; }; 5AF0E64D67CE65EBACC34616 /* TestLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestLog.m; sourceTree = ""; }; 5AF0E6679284694FAE8FA987 /* AdminPanelTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdminPanelTableViewController.h; sourceTree = ""; }; - 5AF0E66FC0708F0343F589F7 /* CPTRangePlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTRangePlot.h; sourceTree = ""; }; 5AF0E6849873D0FE1707D115 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; - 5AF0E6A904C28D64ECF0E3EB /* AFNetworkActivityIndicatorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkActivityIndicatorManager.h; sourceTree = ""; }; - 5AF0E6AAA07B58E7162B416C /* CPTAxisLabelGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxisLabelGroup.h; sourceTree = ""; }; - 5AF0E6C4BF685FF18E9E35DB /* CPTMutableLineStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTMutableLineStyle.h; sourceTree = ""; }; - 5AF0E6ED2B3237AAE0025487 /* mztools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mztools.h; sourceTree = ""; }; - 5AF0E718BAC1908F5805E19C /* CPTAxisLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxisLabel.h; sourceTree = ""; }; - 5AF0E71ADC8CEB2CBDA05C6C /* AFJSONRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFJSONRequestOperation.h; sourceTree = ""; }; 5AF0E72C7BC0C464AD86F094 /* Fraction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Fraction.h; sourceTree = ""; }; 5AF0E74040EDC226B9E38D77 /* ImageIO.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; }; 5AF0E75B36ED26022AF3F4E5 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; - 5AF0E7635D3A4FA1A3E66670 /* CPTAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAnnotation.h; sourceTree = ""; }; - 5AF0E766A75FDCF09365123A /* CPTNumericDataType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTNumericDataType.h; sourceTree = ""; }; - 5AF0E768F95302150E8A07AD /* NSNumberExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSNumberExtensions.h; sourceTree = ""; }; - 5AF0E7814F16AC70DA6E433B /* CPTTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTheme.h; sourceTree = ""; }; - 5AF0E787C1008722E48D24BB /* AFURLConnectionOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFURLConnectionOperation.h; sourceTree = ""; }; 5AF0E7A8404D80F87033E2DF /* TestLogItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestLogItem.h; sourceTree = ""; }; - 5AF0E7A8889A3D081077A846 /* NSCoderExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSCoderExtensions.h; sourceTree = ""; }; - 5AF0E7AEFB71EC90FF38D5D5 /* CPTShadow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTShadow.h; sourceTree = ""; }; - 5AF0E7B0C0907CD10546CC52 /* CPTXYAxis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTXYAxis.h; sourceTree = ""; }; - 5AF0E7B3571AA23383A350F9 /* mztools.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mztools.c; sourceTree = ""; }; 5AF0E7C03A6A1B0C4460AA15 /* ManageUserTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManageUserTableViewController.h; sourceTree = ""; }; 5AF0E7C430C57B7CDE1EB06B /* NSString+containsCategory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+containsCategory.m"; sourceTree = ""; }; - 5AF0E80148F47B3B13C857B8 /* CPTMutablePlotRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTMutablePlotRange.h; sourceTree = ""; }; - 5AF0E855328BCC9B3D03C0BC /* CPTColorSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTColorSpace.h; sourceTree = ""; }; - 5AF0E868D94EFDD169859975 /* CPTLegend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTLegend.h; sourceTree = ""; }; - 5AF0E86AE275A7809BF93C1C /* CPTExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTExceptions.h; sourceTree = ""; }; - 5AF0E8CB2D0DC3D531B85982 /* CPTPlatformSpecificFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlatformSpecificFunctions.h; sourceTree = ""; }; - 5AF0E8D897A660E0A4A0CE2B /* CPTBarPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTBarPlot.h; sourceTree = ""; }; 5AF0E8DF74A1C0F7D79C506D /* Fraction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Fraction.m; sourceTree = ""; }; - 5AF0E8E0A4B24C90A3A10B29 /* CPTNumericData+TypeConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPTNumericData+TypeConversion.h"; sourceTree = ""; }; - 5AF0E903A5E1E458CA52100A /* CPTAxisSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxisSet.h; sourceTree = ""; }; - 5AF0E905BDF3448A2AD89330 /* CPTPlotSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotSpace.h; sourceTree = ""; }; - 5AF0E9229EAB4A1C60816C51 /* CPTPlotAreaFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotAreaFrame.h; sourceTree = ""; }; - 5AF0E926F8094CE8B38E4795 /* RXMLElement.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RXMLElement.m; path = ../RaptureXML/RXMLElement.m; sourceTree = ""; }; - 5AF0E9302F03ADE782B8C870 /* AFHTTPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPClient.m; sourceTree = ""; }; - 5AF0E932C396BB5C7997D6B4 /* AFHTTPClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPClient.h; sourceTree = ""; }; - 5AF0E943D2F0F406BA1754D6 /* AFURLConnectionOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFURLConnectionOperation.m; sourceTree = ""; }; - 5AF0E98AB7F7A48AEA80ED10 /* CPTLimitBand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTLimitBand.h; sourceTree = ""; }; - 5AF0E9A11B57E184159C0454 /* CPTGridLines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGridLines.h; sourceTree = ""; }; - 5AF0E9BC5EEADBD2850C690F /* CPTAnnotationHostLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAnnotationHostLayer.h; sourceTree = ""; }; - 5AF0E9FCBC9D5B0C90167053 /* CPTXYPlotSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTXYPlotSpace.h; sourceTree = ""; }; - 5AF0EA072A9E9E9D284C7706 /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ioapi.h; sourceTree = ""; }; - 5AF0EA163D8A3A3CD3AA811F /* RXMLElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RXMLElement.h; path = ../RaptureXML/RXMLElement.h; sourceTree = ""; }; 5AF0EA372969AC9A38ECB9DD /* TestConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestConfiguration.m; sourceTree = ""; }; - 5AF0EA443430F75EF928E11F /* CPTLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTLayer.h; sourceTree = ""; }; - 5AF0EA9D036820E57196FC5D /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = crypt.h; sourceTree = ""; }; - 5AF0EAACA0AF096E984A58DD /* CPTPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlot.h; sourceTree = ""; }; - 5AF0EAF704B3828E049B9F9B /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ioapi.c; sourceTree = ""; }; - 5AF0EAFB7931802476B8BAC3 /* AFPropertyListRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFPropertyListRequestOperation.m; sourceTree = ""; }; 5AF0EB0671EC4B4CDA0887E1 /* UIImage+Picker.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+Picker.m"; sourceTree = ""; }; - 5AF0EB1EF0599726300F7E54 /* AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworking.h; sourceTree = ""; }; 5AF0EB2270778FECB039C261 /* AdminPanelTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AdminPanelTableViewController.m; sourceTree = ""; }; - 5AF0EB2C43DDE0FBFFA3D046 /* CPTImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTImage.h; sourceTree = ""; }; 5AF0EB38562144A83BCAB3D4 /* MainStoryboard.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainStoryboard.storyboard; sourceTree = ""; }; - 5AF0EBA9909FC9009B5DFE51 /* CPTNumericData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTNumericData.h; sourceTree = ""; }; 5AF0EBDDCF9D7178C5BCA732 /* TestSequenceFolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSequenceFolder.h; sourceTree = ""; }; - 5AF0EBEEDEB2CA37F76F27E1 /* unzip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unzip.c; sourceTree = ""; }; - 5AF0EC17D81B9DDBB2AEA31D /* CPTDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTDefinitions.h; sourceTree = ""; }; 5AF0EC2AE3C7CB7009391ED1 /* TestSequenceImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSequenceImage.h; sourceTree = ""; }; - 5AF0EC812EED6D6F8605B211 /* CPTMutableShadow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTMutableShadow.h; sourceTree = ""; }; - 5AF0ECF22D3428F5241CA219 /* UIImageView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+AFNetworking.m"; sourceTree = ""; }; - 5AF0ECF5205639D45EA93F1A /* CPTGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGraph.h; sourceTree = ""; }; - 5AF0ECFEA33C91E39E6D758C /* NSDecimalNumberExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSDecimalNumberExtensions.h; sourceTree = ""; }; - 5AF0ED0097D7F54C9B478190 /* CPTTextLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTextLayer.h; sourceTree = ""; }; - 5AF0ED1E829BD4CFB1883187 /* CPTTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTextStyle.h; sourceTree = ""; }; 5AF0ED62E745BBD70B82E167 /* TestSequence.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSequence.h; sourceTree = ""; }; - 5AF0ED8D3FFB87DC99D0A341 /* zip.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = zip.c; sourceTree = ""; }; 5AF0ED9AEF05FF5F440123DA /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; 5AF0EDAFEE8AD326C5F4C401 /* TestSequence.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestSequence.m; sourceTree = ""; }; 5AF0EDBA381C246DDDE98616 /* NSString+containsCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+containsCategory.h"; sourceTree = ""; }; - 5AF0EDCB928BA52906431A2C /* CPTPathExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPathExtensions.h; sourceTree = ""; }; 5AF0EDD0B07FD5C084721830 /* UIColor+Hex.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIColor+Hex.m"; sourceTree = ""; }; 5AF0EDE6B74D3ACEFA9D72D8 /* Mean.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Mean.m; sourceTree = ""; }; 5AF0EDECD815728F1903E396 /* Staircase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Staircase.m; sourceTree = ""; }; 5AF0EDF2375B76A42DA5EF62 /* ManageUserTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ManageUserTableViewController.m; sourceTree = ""; }; 5AF0EE151654C60F05532BEF /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; 5AF0EE35DE91145EFEA1123B /* NSArray+GetRandom.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSArray+GetRandom.m"; sourceTree = ""; }; - 5AF0EE51FE92BA2F1ED9A7B5 /* CPTTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTestCase.h; sourceTree = ""; }; - 5AF0EE83340527DF7F739692 /* CPTTradingRangePlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTradingRangePlot.h; sourceTree = ""; }; - 5AF0EE9B96DCFC1C78109AC8 /* CPTFill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTFill.h; sourceTree = ""; }; - 5AF0EEC28441B97DCCA466AF /* CPTResponder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTResponder.h; sourceTree = ""; }; - 5AF0EEC3322C28DACA149FF8 /* CPTLegendEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTLegendEntry.h; sourceTree = ""; }; - 5AF0EED9D9CF028331AD6EBC /* CPTDataSourceTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTDataSourceTestCase.h; sourceTree = ""; }; 5AF0EF032B1DFEBD1AF57FC4 /* NSString+getNumberFromString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+getNumberFromString.h"; sourceTree = ""; }; - 5AF0EF1AB82695D9DC8F675F /* CPTPlotArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotArea.h; sourceTree = ""; }; 5AF0EF1ED8D4FE52CA721082 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; - 5AF0EF20D563ABD813336ED1 /* CPTCalendarFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTCalendarFormatter.h; sourceTree = ""; }; - 5AF0EF5AEE7490E4C126F497 /* CPTPlatformSpecificCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlatformSpecificCategories.h; sourceTree = ""; }; 5AF0EF66B6180BD6AA153A88 /* MBProgressHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MBProgressHUD.h; sourceTree = ""; }; - 5AF0EF86ED825C821E1D3B6D /* CPTPlotGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotGroup.h; sourceTree = ""; }; - 5AF0EF99B57AEA8EA4A14C4C /* AFHTTPRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPRequestOperation.m; sourceTree = ""; }; 5AF0EFA782F686E6BD424514 /* UIColor+Hex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIColor+Hex.h"; sourceTree = ""; }; 5AF0EFA8B7B6B5B809106B50 /* UIImage+Picker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+Picker.h"; sourceTree = ""; }; 5AF0EFA92E79365204688816 /* NSArray+GetRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSArray+GetRandom.h"; sourceTree = ""; }; - 5AF0EFBE482F0E5C525E4ADB /* CPTScatterPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTScatterPlot.h; sourceTree = ""; }; 5AF0EFE0824C1518B886B1BF /* TestLogItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestLogItem.m; sourceTree = ""; }; 5AF0EFE89B4C637A29351647 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; 63122FA6168EBF6C00F9D388 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = ""; }; @@ -277,8 +152,6 @@ 63276B6E16A4C23A0002CF30 /* BarChartCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BarChartCell.h; sourceTree = ""; }; 63276B6F16A4C23A0002CF30 /* BarChartCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BarChartCell.m; sourceTree = ""; }; 6339F1EF16B875C4001B4392 /* PsyPad.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = PsyPad.entitlements; path = ../PsyPad.entitlements; sourceTree = ""; }; - 635A886A17C308DD0076C342 /* grating@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "grating@2x.png"; path = "../../grating@2x.png"; sourceTree = ""; }; - 635A886C17C309740076C342 /* grating.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = grating.png; path = ../../grating.png; sourceTree = ""; }; 635D0795168D7D0D002B845F /* PsyPad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PsyPad.app; sourceTree = BUILT_PRODUCTS_DIR; }; 635D0799168D7D0D002B845F /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 635D079B168D7D0D002B845F /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; @@ -309,14 +182,14 @@ 6385E38D18176F3D00508530 /* tick@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tick@2x.png"; sourceTree = ""; }; 6385E38F1817802200508530 /* open.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = open.png; sourceTree = ""; }; 6385E3901817802200508530 /* open@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "open@2x.png"; sourceTree = ""; }; - 6396505E16B2262700C13479 /* DistanceDetectorViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DistanceDetectorViewController.h; path = PsyPad/Test/DistanceDetectorViewController.h; sourceTree = SOURCE_ROOT; }; - 6396505F16B2262700C13479 /* DistanceDetectorViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DistanceDetectorViewController.m; path = PsyPad/Test/DistanceDetectorViewController.m; sourceTree = SOURCE_ROOT; }; 63A1ED5E17B89C100089C204 /* UserTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserTableViewCell.h; path = "Custom Controls/UserTableViewCell.h"; sourceTree = ""; }; 63A1ED5F17B89C100089C204 /* UserTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UserTableViewCell.m; path = "Custom Controls/UserTableViewCell.m"; sourceTree = ""; }; 63C492CF1807D4B900F6AFEF /* splash@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "splash@2x.png"; sourceTree = ""; }; 63C492D11807D50300F6AFEF /* splash.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = splash.png; sourceTree = ""; }; 63C492D31807D56D00F6AFEF /* Default-Landscape.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape.png"; sourceTree = ""; }; 63C492D71807D5E900F6AFEF /* Default-Landscape@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x.png"; sourceTree = ""; }; + 63C70C79181E5F0F00D75098 /* grating.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = grating.png; sourceTree = ""; }; + 63C70C7A181E5F0F00D75098 /* grating@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "grating@2x.png"; sourceTree = ""; }; 63DC3D291696F9A600ACCFBE /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 63DC3D3E1696F9FD00ACCFBE /* tick.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tick.png; sourceTree = ""; }; 63DC3D541696FFF900ACCFBE /* SelectConfigurationTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectConfigurationTableViewController.h; sourceTree = ""; }; @@ -340,6 +213,7 @@ 63F9F1B7168ED165006532D9 /* UIButton+Block.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+Block.m"; sourceTree = ""; }; 63F9F1B8168ED165006532D9 /* UIButtonBlock.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIButtonBlock.h; sourceTree = ""; }; 63F9F1B9168ED165006532D9 /* UIButtonBlock.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UIButtonBlock.m; sourceTree = ""; }; + B9C09253E5E04B5EA4554FB3 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -353,7 +227,6 @@ 5AF0E02E211A49C5924FBCB8 /* CoreData.framework in Frameworks */, 63DC3D2A1696F9A600ACCFBE /* libz.dylib in Frameworks */, 5AF0E200E675571F3B6E5FFC /* libxml2.dylib in Frameworks */, - 5AF0E0D7BADDC228C490CD78 /* libCorePlot-CocoaTouch.a in Frameworks */, 5AF0E494EABCA7E429787D77 /* QuartzCore.framework in Frameworks */, 5AF0EDC804CC483E5894CF38 /* SystemConfiguration.framework in Frameworks */, 5AF0E5C1204C19BECA4857F7 /* MobileCoreServices.framework in Frameworks */, @@ -362,6 +235,7 @@ 5AF0ECF4CC1084F8A4B0825C /* CoreVideo.framework in Frameworks */, 5AF0EFD690CA22EF978D9F10 /* CoreMedia.framework in Frameworks */, 5AF0EE910230910F9D266F43 /* ImageIO.framework in Frameworks */, + 31B4AA332A724059B3C3EB8E /* libPods.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -390,31 +264,6 @@ path = "Custom Controls"; sourceTree = ""; }; - 5AF0E40CA60CCB02DEC1034A /* RaptureXML */ = { - isa = PBXGroup; - children = ( - 5AF0EA163D8A3A3CD3AA811F /* RXMLElement.h */, - 5AF0E926F8094CE8B38E4795 /* RXMLElement.m */, - ); - path = RaptureXML; - sourceTree = ""; - }; - 5AF0E4C80BE3069BEA95643F /* minizip */ = { - isa = PBXGroup; - children = ( - 5AF0ED8D3FFB87DC99D0A341 /* zip.c */, - 5AF0E4F27AAE107773745E73 /* zip.h */, - 5AF0EA9D036820E57196FC5D /* crypt.h */, - 5AF0EAF704B3828E049B9F9B /* ioapi.c */, - 5AF0EA072A9E9E9D284C7706 /* ioapi.h */, - 5AF0EBEEDEB2CA37F76F27E1 /* unzip.c */, - 5AF0E0A1DEF2D44477B078E4 /* unzip.h */, - 5AF0E7B3571AA23383A350F9 /* mztools.c */, - 5AF0E6ED2B3237AAE0025487 /* mztools.h */, - ); - path = minizip; - sourceTree = ""; - }; 5AF0E4D147A6C544C6120CCD /* Custom Controls */ = { isa = PBXGroup; children = ( @@ -430,97 +279,12 @@ path = "Custom Controls"; sourceTree = ""; }; - 5AF0E63AF441DC8FC7BDDE5F /* CorePlotHeaders */ = { - isa = PBXGroup; - children = ( - 5AF0E5A39C70ECEFAF6DE239 /* CorePlot-CocoaTouch.h */, - 5AF0E7635D3A4FA1A3E66670 /* CPTAnnotation.h */, - 5AF0E9BC5EEADBD2850C690F /* CPTAnnotationHostLayer.h */, - 5AF0E232D9FFA48CA8E9A60E /* CPTAxis.h */, - 5AF0E718BAC1908F5805E19C /* CPTAxisLabel.h */, - 5AF0E6AAA07B58E7162B416C /* CPTAxisLabelGroup.h */, - 5AF0E903A5E1E458CA52100A /* CPTAxisSet.h */, - 5AF0E14696DED1189770D16C /* CPTAxisTitle.h */, - 5AF0E8D897A660E0A4A0CE2B /* CPTBarPlot.h */, - 5AF0E4997905650225443279 /* CPTBorderedLayer.h */, - 5AF0EF20D563ABD813336ED1 /* CPTCalendarFormatter.h */, - 5AF0E3E986F635AD8F72F542 /* CPTColor.h */, - 5AF0E855328BCC9B3D03C0BC /* CPTColorSpace.h */, - 5AF0E3BD2A2367283F24859A /* CPTConstraints.h */, - 5AF0EED9D9CF028331AD6EBC /* CPTDataSourceTestCase.h */, - 5AF0EC17D81B9DDBB2AEA31D /* CPTDefinitions.h */, - 5AF0E4282B52BBE32E4D5D2E /* CPTDerivedXYGraph.h */, - 5AF0E86AE275A7809BF93C1C /* CPTExceptions.h */, - 5AF0EE9B96DCFC1C78109AC8 /* CPTFill.h */, - 5AF0E3A0012A1CEEE7620641 /* CPTGradient.h */, - 5AF0ECF5205639D45EA93F1A /* CPTGraph.h */, - 5AF0E2CBD18A5743D7FC2042 /* CPTGraphHostingView.h */, - 5AF0E5F66514F456E9550770 /* CPTGridLineGroup.h */, - 5AF0E9A11B57E184159C0454 /* CPTGridLines.h */, - 5AF0EB2C43DDE0FBFFA3D046 /* CPTImage.h */, - 5AF0EA443430F75EF928E11F /* CPTLayer.h */, - 5AF0E5F712144146CF2E499C /* CPTLayerAnnotation.h */, - 5AF0E868D94EFDD169859975 /* CPTLegend.h */, - 5AF0EEC3322C28DACA149FF8 /* CPTLegendEntry.h */, - 5AF0E98AB7F7A48AEA80ED10 /* CPTLimitBand.h */, - 5AF0E00C0EF68A64C910B7AF /* CPTLineCap.h */, - 5AF0E501D35D2A432F959C09 /* CPTLineStyle.h */, - 5AF0E6C4BF685FF18E9E35DB /* CPTMutableLineStyle.h */, - 5AF0E4DCDF6BE9E22F57E779 /* CPTMutableNumericData+TypeConversion.h */, - 5AF0E41AC1453ECFDCF38E6C /* CPTMutableNumericData.h */, - 5AF0E80148F47B3B13C857B8 /* CPTMutablePlotRange.h */, - 5AF0EC812EED6D6F8605B211 /* CPTMutableShadow.h */, - 5AF0E0EACE7447694381456A /* CPTMutableTextStyle.h */, - 5AF0E8E0A4B24C90A3A10B29 /* CPTNumericData+TypeConversion.h */, - 5AF0EBA9909FC9009B5DFE51 /* CPTNumericData.h */, - 5AF0E766A75FDCF09365123A /* CPTNumericDataType.h */, - 5AF0EDCB928BA52906431A2C /* CPTPathExtensions.h */, - 5AF0E399797D34839CFAF8EF /* CPTPieChart.h */, - 5AF0EF5AEE7490E4C126F497 /* CPTPlatformSpecificCategories.h */, - 5AF0E210722A29D5DF157AFE /* CPTPlatformSpecificDefines.h */, - 5AF0E8CB2D0DC3D531B85982 /* CPTPlatformSpecificFunctions.h */, - 5AF0EAACA0AF096E984A58DD /* CPTPlot.h */, - 5AF0EF1AB82695D9DC8F675F /* CPTPlotArea.h */, - 5AF0E9229EAB4A1C60816C51 /* CPTPlotAreaFrame.h */, - 5AF0EF86ED825C821E1D3B6D /* CPTPlotGroup.h */, - 5AF0E38F725951B86B41EC39 /* CPTPlotRange.h */, - 5AF0E905BDF3448A2AD89330 /* CPTPlotSpace.h */, - 5AF0E42B6677FFA34C66D14E /* CPTPlotSpaceAnnotation.h */, - 5AF0E46410A98B0F418AD9CB /* CPTPlotSymbol.h */, - 5AF0E66FC0708F0343F589F7 /* CPTRangePlot.h */, - 5AF0EEC28441B97DCCA466AF /* CPTResponder.h */, - 5AF0EFBE482F0E5C525E4ADB /* CPTScatterPlot.h */, - 5AF0E7AEFB71EC90FF38D5D5 /* CPTShadow.h */, - 5AF0EE51FE92BA2F1ED9A7B5 /* CPTTestCase.h */, - 5AF0ED0097D7F54C9B478190 /* CPTTextLayer.h */, - 5AF0ED1E829BD4CFB1883187 /* CPTTextStyle.h */, - 5AF0E55168F29C8AE71FAB34 /* CPTTextStylePlatformSpecific.h */, - 5AF0E7814F16AC70DA6E433B /* CPTTheme.h */, - 5AF0E146890AA6AE2220AA12 /* CPTTimeFormatter.h */, - 5AF0EE83340527DF7F739692 /* CPTTradingRangePlot.h */, - 5AF0E365299EFA0DB53C9CA5 /* CPTUtilities.h */, - 5AF0E7B0C0907CD10546CC52 /* CPTXYAxis.h */, - 5AF0E11D0EC97536BE0EF282 /* CPTXYAxisSet.h */, - 5AF0E4278748F8A2C97ED59E /* CPTXYGraph.h */, - 5AF0E9FCBC9D5B0C90167053 /* CPTXYPlotSpace.h */, - 5AF0E3324B6A0799B32074F3 /* mainpage.h */, - 5AF0E7A8889A3D081077A846 /* NSCoderExtensions.h */, - 5AF0ECFEA33C91E39E6D758C /* NSDecimalNumberExtensions.h */, - 5AF0E768F95302150E8A07AD /* NSNumberExtensions.h */, - ); - path = CorePlotHeaders; - sourceTree = ""; - }; 5AF0E679D4C1DC425229AFC1 /* Test */ = { isa = PBXGroup; children = ( - 6396505E16B2262700C13479 /* DistanceDetectorViewController.h */, - 6396505F16B2262700C13479 /* DistanceDetectorViewController.m */, 631CB3271698F7B7007A0534 /* TestViewController.m */, 631CB3261698F7B7007A0534 /* TestViewController.h */, 5AF0E29AD0FE381FB2090214 /* Custom Controls */, - 5AF0E1DB9C3BAB762EBAEF41 /* DistanceDetector.m */, - 5AF0E1C0ECD5BF71AE4EECBD /* DistanceDetector.h */, 5AF0EDECD815728F1903E396 /* Staircase.m */, 5AF0E312DFA8457A95F447AE /* Staircase.h */, ); @@ -535,16 +299,6 @@ path = "User Interface"; sourceTree = ""; }; - 5AF0E78293CB28C262225BFD /* SSZipArchive */ = { - isa = PBXGroup; - children = ( - 5AF0E4C80BE3069BEA95643F /* minizip */, - 5AF0E40FF3B9248421C87385 /* SSZipArchive.h */, - 5AF0E0439DF74E008453B984 /* SSZipArchive.m */, - ); - path = SSZipArchive; - sourceTree = ""; - }; 5AF0E84EE31BDE1ACF796DCB /* Resources */ = { isa = PBXGroup; children = ( @@ -554,8 +308,8 @@ 63C492CF1807D4B900F6AFEF /* splash@2x.png */, 63C492D71807D5E900F6AFEF /* Default-Landscape@2x.png */, 63C492D31807D56D00F6AFEF /* Default-Landscape.png */, - 635A886C17C309740076C342 /* grating.png */, - 635A886A17C308DD0076C342 /* grating@2x.png */, + 63C70C79181E5F0F00D75098 /* grating.png */, + 63C70C7A181E5F0F00D75098 /* grating@2x.png */, 63DC3D571698133A00ACCFBE /* plus.png */, 6385E38B18176EF400508530 /* plus@2x.png */, 6385E38D18176F3D00508530 /* tick@2x.png */, @@ -580,7 +334,6 @@ isa = PBXGroup; children = ( 636060FF168DC82900F200CA /* UIAlertView-Blocks */, - 5AF0E40CA60CCB02DEC1034A /* RaptureXML */, 636035BE168D897E00AE93D0 /* Random.m */, 636035B9168D897000AE93D0 /* UIView+Positioning.h */, 63F9F1B8168ED165006532D9 /* UIButtonBlock.h */, @@ -686,32 +439,6 @@ path = "Custom Controls"; sourceTree = ""; }; - 5AF0EE17E697BDECF4348485 /* AFNetworking */ = { - isa = PBXGroup; - children = ( - 5AF0E932C396BB5C7997D6B4 /* AFHTTPClient.h */, - 5AF0E9302F03ADE782B8C870 /* AFHTTPClient.m */, - 5AF0E17300F1AC3B1A055572 /* AFHTTPRequestOperation.h */, - 5AF0EF99B57AEA8EA4A14C4C /* AFHTTPRequestOperation.m */, - 5AF0E4FF636A9A419FE5B48A /* AFImageRequestOperation.h */, - 5AF0E39C9D79853382B0FE08 /* AFImageRequestOperation.m */, - 5AF0E71ADC8CEB2CBDA05C6C /* AFJSONRequestOperation.h */, - 5AF0E4D05B01273D4ECB191D /* AFJSONRequestOperation.m */, - 5AF0E6A904C28D64ECF0E3EB /* AFNetworkActivityIndicatorManager.h */, - 5AF0E120D26C12F478C57DA6 /* AFNetworkActivityIndicatorManager.m */, - 5AF0EB1EF0599726300F7E54 /* AFNetworking.h */, - 5AF0E560FC0644EABF45DC91 /* AFPropertyListRequestOperation.h */, - 5AF0EAFB7931802476B8BAC3 /* AFPropertyListRequestOperation.m */, - 5AF0E787C1008722E48D24BB /* AFURLConnectionOperation.h */, - 5AF0E943D2F0F406BA1754D6 /* AFURLConnectionOperation.m */, - 5AF0E2B69B0E0205BAA93DFB /* AFXMLRequestOperation.h */, - 5AF0E45067F050C71046E975 /* AFXMLRequestOperation.m */, - 5AF0E1644BB4EF3520C82957 /* UIImageView+AFNetworking.h */, - 5AF0ECF22D3428F5241CA219 /* UIImageView+AFNetworking.m */, - ); - path = AFNetworking; - sourceTree = ""; - }; 5AF0EF55C1C5A93AD9AD756C /* Admin Panel */ = { isa = PBXGroup; children = ( @@ -732,6 +459,7 @@ 635D079F168D7D0D002B845F /* PsyPad */, 635D0798168D7D0D002B845F /* Frameworks */, 635D0796168D7D0D002B845F /* Products */, + 46756309933747649878AFBC /* Pods.xcconfig */, ); sourceTree = ""; }; @@ -752,10 +480,7 @@ 635D079D168D7D0D002B845F /* CoreGraphics.framework */, 5AF0EFE89B4C637A29351647 /* CoreData.framework */, 5AF0E61F0BEAD03448FE32BD /* libxml2.dylib */, - 5AF0E63AF441DC8FC7BDDE5F /* CorePlotHeaders */, - 5AF0E51192AA25A17AF7E63F /* libCorePlot-CocoaTouch.a */, 5AF0E52A944A57021D9519D3 /* QuartzCore.framework */, - 5AF0EE17E697BDECF4348485 /* AFNetworking */, 5AF0EF1ED8D4FE52CA721082 /* SystemConfiguration.framework */, 5AF0E75B36ED26022AF3F4E5 /* MobileCoreServices.framework */, 5AF0E6849873D0FE1707D115 /* AVFoundation.framework */, @@ -763,7 +488,7 @@ 5AF0EE151654C60F05532BEF /* CoreVideo.framework */, 5AF0ED9AEF05FF5F440123DA /* CoreMedia.framework */, 5AF0E74040EDC226B9E38D77 /* ImageIO.framework */, - 5AF0E78293CB28C262225BFD /* SSZipArchive */, + B9C09253E5E04B5EA4554FB3 /* libPods.a */, ); name = Frameworks; sourceTree = ""; @@ -818,9 +543,11 @@ isa = PBXNativeTarget; buildConfigurationList = 635D07B9168D7D0D002B845F /* Build configuration list for PBXNativeTarget "PsyPad" */; buildPhases = ( + 71D3D7BEE9184D289A642E48 /* Check Pods Manifest.lock */, 635D0791168D7D0D002B845F /* Sources */, 635D0792168D7D0D002B845F /* Frameworks */, 635D0793168D7D0D002B845F /* Resources */, + 7CCF090EC67649A5B2280BDF /* Copy Pods Resources */, ); buildRules = ( ); @@ -873,19 +600,52 @@ 6385E3911817802200508530 /* open.png in Resources */, 63DC3D3F1696F9FD00ACCFBE /* tick.png in Resources */, 63DC3D581698133A00ACCFBE /* plus.png in Resources */, + 63C70C7B181E5F0F00D75098 /* grating.png in Resources */, + 63C70C7C181E5F0F00D75098 /* grating@2x.png in Resources */, 6385E3921817802200508530 /* open@2x.png in Resources */, 63C492D41807D56D00F6AFEF /* Default-Landscape.png in Resources */, 5AF0E3B4932D22B782FDC1D7 /* MainStoryboard.storyboard in Resources */, 6385E38E18176F3D00508530 /* tick@2x.png in Resources */, 63C492D21807D50300F6AFEF /* splash.png in Resources */, - 635A886B17C308DD0076C342 /* grating@2x.png in Resources */, 6385E38C18176EF400508530 /* plus@2x.png in Resources */, - 635A886D17C309740076C342 /* grating.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ +/* Begin PBXShellScriptBuildPhase section */ + 71D3D7BEE9184D289A642E48 /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 7CCF090EC67649A5B2280BDF /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Pods-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + /* Begin PBXSourcesBuildPhase section */ 635D0791168D7D0D002B845F /* Sources */ = { isa = PBXSourcesBuildPhase; @@ -923,32 +683,15 @@ 631CB3281698F7B7007A0534 /* TestViewController.m in Sources */, 631CB32E1698F7C3007A0534 /* TestButton.m in Sources */, 631CB32F1698F7C3007A0534 /* TestImageButton.m in Sources */, - 5AF0E1FF06C4A80C86A126F4 /* RXMLElement.m in Sources */, 63276B6A16A4C1060002CF30 /* AnalysisTableViewController.m in Sources */, 63276B7016A4C23A0002CF30 /* BarChartCell.m in Sources */, 5AF0EF093E7AF2B134082306 /* Fraction.m in Sources */, 5AF0E348E1EB72492DB80135 /* Mean.m in Sources */, - 5AF0EB5741C29B00E5C081C1 /* AFHTTPClient.m in Sources */, - 5AF0E869AE5B5B9112FD602D /* AFHTTPRequestOperation.m in Sources */, - 5AF0E0A795186EFD399FF499 /* AFImageRequestOperation.m in Sources */, - 5AF0E1E77A948B634053659E /* AFJSONRequestOperation.m in Sources */, - 5AF0E3B64923D4A7AAA0CFD7 /* AFNetworkActivityIndicatorManager.m in Sources */, - 5AF0E2CFE8CDCAF5E0B4E1B3 /* AFPropertyListRequestOperation.m in Sources */, - 5AF0E11CBDE42B00EC852FB2 /* AFURLConnectionOperation.m in Sources */, - 5AF0E8DD8EFF8C81B0C51B27 /* AFXMLRequestOperation.m in Sources */, - 5AF0E5177929ED4663E38C09 /* UIImageView+AFNetworking.m in Sources */, - 6396506016B2262800C13479 /* DistanceDetectorViewController.m in Sources */, 5AF0EB2DD285A8F2E6DF60B8 /* AdminPanelTableViewController.m in Sources */, 5AF0E6552E4BAE482FA33C0F /* ManageUserTableViewController.m in Sources */, 5AF0E20E0297DAD6DCDFE63C /* MBProgressHUD.m in Sources */, 5AF0E2B31987AE178A5BB5B8 /* NSString+containsCategory.m in Sources */, - 5AF0EC57CCD6EE984899DA20 /* DistanceDetector.m in Sources */, 5AF0EC3121BF8F52B737D033 /* UIImage+Picker.m in Sources */, - 5AF0E3058A5AF1C41E60A835 /* zip.c in Sources */, - 5AF0E6F3680D22E10C0E0A74 /* ioapi.c in Sources */, - 5AF0E324D4AC58E2F0BBCE2D /* unzip.c in Sources */, - 5AF0E82555DDE871A4DC1414 /* mztools.c in Sources */, - 5AF0E56F4E38E32BF3D801F2 /* SSZipArchive.m in Sources */, 631BD07F170AA2390086DC8B /* AppConfiguration.m in Sources */, 5AF0E63465BCA419C9918EE4 /* Staircase.m in Sources */, 5AF0E16D74928A2480ABE261 /* NSString+getNumberFromString.m in Sources */, @@ -975,7 +718,6 @@ 630532EB16B877050060C14D /* Ad-hoc */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; @@ -988,9 +730,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "\"$(SDK_DIR)/usr/include/libxml2\""; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; OTHER_LDFLAGS = "\"-ObjC -all_load\""; PROVISIONING_PROFILE = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; @@ -1002,18 +742,23 @@ }; 630532EC16B877050060C14D /* Ad-hoc */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 46756309933747649878AFBC /* Pods.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer: David Lawson (YRZAGJ6X9R)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: David Lawson (YRZAGJ6X9R)"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "PsyPad/Supporting Files/PsyPad-Prefix.pch"; - INFOPLIST_FILE = "PsyPad/Supporting Files/PsyPad-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; - LIBRARY_SEARCH_PATHS = ( - "\"${PROJECT_DIR}/\"/**", - "\"${PROJECT_DIR}/\"/**", + HEADER_SEARCH_PATHS = ( + "\"${PODS_ROOT}/Headers\"", + "\"${PODS_ROOT}/Headers/AFNetworking\"", + "\"${PODS_ROOT}/Headers/SSZipArchive\"", + "\"${PODS_ROOT}/Headers/SSZipArchive/minizip\"", + /usr/include/libxml2, ); - OTHER_LDFLAGS = ""; + INFOPLIST_FILE = "PsyPad/Supporting Files/PsyPad-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; @@ -1024,7 +769,6 @@ 635D07B7168D7D0D002B845F /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; @@ -1044,8 +788,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "\"$(SDK_DIR)/usr/include/libxml2\""; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = "\"-ObjC -all_load\""; PROVISIONING_PROFILE = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; @@ -1058,7 +801,6 @@ 635D07B8168D7D0D002B845F /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; @@ -1071,9 +813,7 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = "\"$(SDK_DIR)/usr/include/libxml2\""; - IPHONEOS_DEPLOYMENT_TARGET = 5.1; - OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; OTHER_LDFLAGS = "\"-ObjC -all_load\""; PROVISIONING_PROFILE = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; @@ -1085,18 +825,22 @@ }; 635D07BA168D7D0D002B845F /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 46756309933747649878AFBC /* Pods.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer: David Lawson (YRZAGJ6X9R)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: David Lawson (YRZAGJ6X9R)"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "PsyPad/Supporting Files/PsyPad-Prefix.pch"; - INFOPLIST_FILE = "PsyPad/Supporting Files/PsyPad-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; - LIBRARY_SEARCH_PATHS = ( - "\"${PROJECT_DIR}/\"/**", - "\"${PROJECT_DIR}/\"/**", + HEADER_SEARCH_PATHS = ( + "\"${PODS_ROOT}/Headers\"", + "\"${PODS_ROOT}/Headers/AFNetworking\"", + "\"${PODS_ROOT}/Headers/SSZipArchive\"", + "\"${PODS_ROOT}/Headers/SSZipArchive/minizip\"", + /usr/include/libxml2, ); - OTHER_LDFLAGS = ""; + INFOPLIST_FILE = "PsyPad/Supporting Files/PsyPad-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; @@ -1106,18 +850,23 @@ }; 635D07BB168D7D0D002B845F /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = 46756309933747649878AFBC /* Pods.xcconfig */; buildSettings = { CODE_SIGN_IDENTITY = "iPhone Developer: David Lawson (YRZAGJ6X9R)"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: David Lawson (YRZAGJ6X9R)"; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "PsyPad/Supporting Files/PsyPad-Prefix.pch"; - INFOPLIST_FILE = "PsyPad/Supporting Files/PsyPad-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; - LIBRARY_SEARCH_PATHS = ( - "\"${PROJECT_DIR}/\"/**", - "\"${PROJECT_DIR}/\"/**", + HEADER_SEARCH_PATHS = ( + "\"${PODS_ROOT}/Headers\"", + "\"${PODS_ROOT}/Headers/AFNetworking\"", + "\"${PODS_ROOT}/Headers/SSZipArchive\"", + "\"${PODS_ROOT}/Headers/SSZipArchive/minizip\"", + /usr/include/libxml2, ); - OTHER_LDFLAGS = ""; + INFOPLIST_FILE = "PsyPad/Supporting Files/PsyPad-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 6.0; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = "$(inherited)"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = "38CFFA67-DF00-43C6-A73D-3FDAEAF1B997"; diff --git a/PsyPad.xcodeproj/xcuserdata/david.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/PsyPad.xcodeproj/xcuserdata/david.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist index e0c1c47..51642bc 100755 --- a/PsyPad.xcodeproj/xcuserdata/david.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist +++ b/PsyPad.xcodeproj/xcuserdata/david.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -3,18 +3,5 @@ type = "1" version = "1.0"> - - diff --git a/PsyPad.xcworkspace/contents.xcworkspacedata b/PsyPad.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..1d2ac56 --- /dev/null +++ b/PsyPad.xcworkspace/contents.xcworkspacedata @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/PsyPad.xcodeproj/project.xcworkspace/xcshareddata/PsyPad.xccheckout b/PsyPad.xcworkspace/xcshareddata/PsyPad.xccheckout similarity index 67% rename from PsyPad.xcodeproj/project.xcworkspace/xcshareddata/PsyPad.xccheckout rename to PsyPad.xcworkspace/xcshareddata/PsyPad.xccheckout index 9a122ff..995aadd 100644 --- a/PsyPad.xcodeproj/project.xcworkspace/xcshareddata/PsyPad.xccheckout +++ b/PsyPad.xcworkspace/xcshareddata/PsyPad.xccheckout @@ -5,34 +5,34 @@ IDESourceControlProjectFavoriteDictionaryKey IDESourceControlProjectIdentifier - 04997A14-9F81-4204-AA51-E6F2D26A70D8 + 54BCC4D2-3A1D-4F96-89F6-C85C9D60467D IDESourceControlProjectName PsyPad IDESourceControlProjectOriginsDictionary - 7912C7B1-4862-45B1-8970-96AD02778438 - https://eTASM:M4?Sh$92bi@bitbucket.org/eTASM/etasm-2.git + C7EFCD31-50D4-485C-B107-999BC8CDCC34 + https://github.com/davidlawson/PsyPad.git IDESourceControlProjectPath - PsyPad.xcodeproj/project.xcworkspace + PsyPad.xcworkspace IDESourceControlProjectRelativeInstallPathDictionary - 7912C7B1-4862-45B1-8970-96AD02778438 - ../.. + C7EFCD31-50D4-485C-B107-999BC8CDCC34 + .. IDESourceControlProjectURL - https://eTASM:M4?Sh$92bi@bitbucket.org/eTASM/etasm-2.git + https://github.com/davidlawson/PsyPad.git IDESourceControlProjectVersion 110 IDESourceControlProjectWCCIdentifier - 7912C7B1-4862-45B1-8970-96AD02778438 + C7EFCD31-50D4-485C-B107-999BC8CDCC34 IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey - 7912C7B1-4862-45B1-8970-96AD02778438 + C7EFCD31-50D4-485C-B107-999BC8CDCC34 IDESourceControlWCCName PsyPad diff --git a/PsyPad.xcworkspace/xcuserdata/david.xcuserdatad/UserInterfaceState.xcuserstate b/PsyPad.xcworkspace/xcuserdata/david.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..74f0c10 Binary files /dev/null and b/PsyPad.xcworkspace/xcuserdata/david.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/PsyPad/Admin Panel/AdminPanelNavigationController.h b/PsyPad/Admin Panel/AdminPanelNavigationController.h index fe662c4..5bacc32 100755 --- a/PsyPad/Admin Panel/AdminPanelNavigationController.h +++ b/PsyPad/Admin Panel/AdminPanelNavigationController.h @@ -1,6 +1,6 @@ // // AdminPanelNavigationController.h -// eTASM +// // // Created by David Lawson on 2/12/12. // diff --git a/PsyPad/Admin Panel/AdminPanelNavigationController.m b/PsyPad/Admin Panel/AdminPanelNavigationController.m index 3178c16..979ab19 100755 --- a/PsyPad/Admin Panel/AdminPanelNavigationController.m +++ b/PsyPad/Admin Panel/AdminPanelNavigationController.m @@ -1,6 +1,6 @@ // // AdminPanelNavigationController.m -// eTASM +// // // Created by David Lawson on 2/12/12. // diff --git a/PsyPad/Admin Panel/AdminPanelTableViewController.h b/PsyPad/Admin Panel/AdminPanelTableViewController.h index eaba8ed..fd4a4a4 100755 --- a/PsyPad/Admin Panel/AdminPanelTableViewController.h +++ b/PsyPad/Admin Panel/AdminPanelTableViewController.h @@ -1,6 +1,6 @@ // // AdminPanelTableViewController.h -// eTASM2 +// 2 // // Created by David Lawson on 01/28/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Admin Panel/AdminPanelTableViewController.m b/PsyPad/Admin Panel/AdminPanelTableViewController.m index 8318090..ecbf01e 100755 --- a/PsyPad/Admin Panel/AdminPanelTableViewController.m +++ b/PsyPad/Admin Panel/AdminPanelTableViewController.m @@ -1,6 +1,6 @@ // // AdminPanelTableViewController.m -// eTASM2 +// PsyPad // // Created by David Lawson on 01/28/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. @@ -369,7 +369,7 @@ - (void)downloadUser:(NSString *)username dispatch_semaphore_t sema = dispatch_semaphore_create(0); [newConfiguration installSequenceWithURL:image_sequence_url data:image_sequence_data HUD:self.hud sema:sema]; dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); - dispatch_release(sema); + //dispatch_release(sema); } /*if ([configurationData objectForKey:@"NQPF"]) @@ -576,7 +576,7 @@ - (void)downloadAllData dispatch_semaphore_t sema = dispatch_semaphore_create(0); [newConfiguration installSequenceWithURL:image_sequence_url data:image_sequence_data HUD:self.hud sema:sema]; dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); - dispatch_release(sema); + //dispatch_release(sema); } /*if ([configurationData objectForKey:@"NQPF"]) @@ -950,7 +950,7 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender - (IBAction)dismissModal:(id)sender { - [self dismissModalViewControllerAnimated:YES]; + [self dismissViewControllerAnimated:YES completion:nil]; } @end diff --git a/PsyPad/Admin Panel/ManageUserTableViewController.h b/PsyPad/Admin Panel/ManageUserTableViewController.h index 96667d2..eb26f70 100755 --- a/PsyPad/Admin Panel/ManageUserTableViewController.h +++ b/PsyPad/Admin Panel/ManageUserTableViewController.h @@ -1,6 +1,6 @@ // // ManageUserTableViewController.h -// eTASM2 +// PsyPad // // Created by David Lawson on 01/28/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Admin Panel/ManageUserTableViewController.m b/PsyPad/Admin Panel/ManageUserTableViewController.m index 0cb41ae..3223e4f 100755 --- a/PsyPad/Admin Panel/ManageUserTableViewController.m +++ b/PsyPad/Admin Panel/ManageUserTableViewController.m @@ -1,6 +1,6 @@ // // ManageUserTableViewController.m -// eTASM2 +// PsyPad // // Created by David Lawson on 01/28/13. // diff --git a/PsyPad/Analysis/AnalysisTableViewController.h b/PsyPad/Analysis/AnalysisTableViewController.h index baa8f72..0e06aed 100755 --- a/PsyPad/Analysis/AnalysisTableViewController.h +++ b/PsyPad/Analysis/AnalysisTableViewController.h @@ -1,6 +1,6 @@ // // AnalysisTableViewController.h -// eTASM2 +// PsyPad // // Created by David Lawson on 15/01/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Analysis/AnalysisTableViewController.m b/PsyPad/Analysis/AnalysisTableViewController.m index 6eab0f4..3443051 100755 --- a/PsyPad/Analysis/AnalysisTableViewController.m +++ b/PsyPad/Analysis/AnalysisTableViewController.m @@ -1,6 +1,6 @@ // // AnalysisTableViewController.m -// eTASM2 +// PsyPad // // Created by David Lawson on 15/01/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Analysis/Custom Controls/BarChartCell.h b/PsyPad/Analysis/Custom Controls/BarChartCell.h index 7f86bdf..0ea1bf6 100755 --- a/PsyPad/Analysis/Custom Controls/BarChartCell.h +++ b/PsyPad/Analysis/Custom Controls/BarChartCell.h @@ -1,6 +1,6 @@ // // BarChartCell.h -// eTASM2 +// PsyPad // // Created by David Lawson on 15/01/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Analysis/Custom Controls/BarChartCell.m b/PsyPad/Analysis/Custom Controls/BarChartCell.m index 9d700d7..c66836e 100755 --- a/PsyPad/Analysis/Custom Controls/BarChartCell.m +++ b/PsyPad/Analysis/Custom Controls/BarChartCell.m @@ -1,6 +1,6 @@ // // BarChartCell.m -// eTASM2 +// PsyPad // // Created by David Lawson on 15/01/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Analysis/Helper Classes/Fraction.h b/PsyPad/Analysis/Helper Classes/Fraction.h index 84aacc3..d075088 100755 --- a/PsyPad/Analysis/Helper Classes/Fraction.h +++ b/PsyPad/Analysis/Helper Classes/Fraction.h @@ -1,6 +1,6 @@ // // Fraction.h -// eTASM2 +// PsyPad // // Created by David Lawson on 01/15/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Analysis/Helper Classes/Fraction.m b/PsyPad/Analysis/Helper Classes/Fraction.m index a84dfc6..187e048 100755 --- a/PsyPad/Analysis/Helper Classes/Fraction.m +++ b/PsyPad/Analysis/Helper Classes/Fraction.m @@ -1,6 +1,6 @@ // // Fraction.m -// eTASM2 +// PsyPad // // Created by David Lawson on 01/15/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Analysis/Helper Classes/Mean.h b/PsyPad/Analysis/Helper Classes/Mean.h index 44f59f5..6b6043c 100755 --- a/PsyPad/Analysis/Helper Classes/Mean.h +++ b/PsyPad/Analysis/Helper Classes/Mean.h @@ -1,6 +1,6 @@ // // Mean.h -// eTASM2 +// PsyPad // // Created by David Lawson on 01/15/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Analysis/Helper Classes/Mean.m b/PsyPad/Analysis/Helper Classes/Mean.m index d4870c6..7aab812 100755 --- a/PsyPad/Analysis/Helper Classes/Mean.m +++ b/PsyPad/Analysis/Helper Classes/Mean.m @@ -1,6 +1,6 @@ // // Mean.m -// eTASM2 +// PsyPad // // Created by David Lawson on 01/15/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/AppDelegate.h b/PsyPad/AppDelegate.h index 20f2d0a..cf7ed09 100755 --- a/PsyPad/AppDelegate.h +++ b/PsyPad/AppDelegate.h @@ -1,6 +1,6 @@ // // AppDelegate.h -// eTASM2 +// PsyPad // // Created by David Lawson on 28/12/12. // Copyright (c) 2012 David Lawson. All rights reserved. diff --git a/PsyPad/AppDelegate.m b/PsyPad/AppDelegate.m index 9959be1..8789c6d 100755 --- a/PsyPad/AppDelegate.m +++ b/PsyPad/AppDelegate.m @@ -1,6 +1,6 @@ // // AppDelegate.m -// eTASM2 +// PsyPad // // Created by David Lawson on 28/12/12. // Copyright (c) 2012 David Lawson. All rights reserved. diff --git a/PsyPad/Configuration/Custom Controls/SliderTableViewCell.h b/PsyPad/Configuration/Custom Controls/SliderTableViewCell.h index ec30bae..a57e864 100755 --- a/PsyPad/Configuration/Custom Controls/SliderTableViewCell.h +++ b/PsyPad/Configuration/Custom Controls/SliderTableViewCell.h @@ -1,6 +1,6 @@ // // SliderTableViewCell.h -// eTASM +// PsyPad // // Created by David Lawson on 5/12/12. // diff --git a/PsyPad/Configuration/Custom Controls/SliderTableViewCell.m b/PsyPad/Configuration/Custom Controls/SliderTableViewCell.m index f4e0dce..c1f164e 100755 --- a/PsyPad/Configuration/Custom Controls/SliderTableViewCell.m +++ b/PsyPad/Configuration/Custom Controls/SliderTableViewCell.m @@ -1,6 +1,6 @@ // // SliderTableViewCell.m -// eTASM +// PsyPad // // Created by David Lawson on 5/12/12. // diff --git a/PsyPad/Configuration/Custom Controls/SwitchTableViewCell.h b/PsyPad/Configuration/Custom Controls/SwitchTableViewCell.h index cb7fe55..8af5d90 100755 --- a/PsyPad/Configuration/Custom Controls/SwitchTableViewCell.h +++ b/PsyPad/Configuration/Custom Controls/SwitchTableViewCell.h @@ -1,6 +1,6 @@ // // SwitchTableViewCell.h -// eTASM +// PsyPad // // Created by David Lawson on 5/12/12. // diff --git a/PsyPad/Configuration/Custom Controls/SwitchTableViewCell.m b/PsyPad/Configuration/Custom Controls/SwitchTableViewCell.m index f31968d..2f248c7 100755 --- a/PsyPad/Configuration/Custom Controls/SwitchTableViewCell.m +++ b/PsyPad/Configuration/Custom Controls/SwitchTableViewCell.m @@ -1,6 +1,6 @@ // // SwitchTableViewCell.m -// eTASM +// PsyPad // // Created by David Lawson on 5/12/12. // diff --git a/PsyPad/Configuration/Custom Controls/TextFieldTableViewCell.h b/PsyPad/Configuration/Custom Controls/TextFieldTableViewCell.h index 5a6a67f..f78eaf0 100755 --- a/PsyPad/Configuration/Custom Controls/TextFieldTableViewCell.h +++ b/PsyPad/Configuration/Custom Controls/TextFieldTableViewCell.h @@ -1,6 +1,6 @@ // // TextFieldTableViewCell.h -// eTASM +// PsyPad // // Created by David Lawson on 4/12/12. // diff --git a/PsyPad/Configuration/Custom Controls/TextFieldTableViewCell.m b/PsyPad/Configuration/Custom Controls/TextFieldTableViewCell.m index 9cf3fd3..3d513a8 100755 --- a/PsyPad/Configuration/Custom Controls/TextFieldTableViewCell.m +++ b/PsyPad/Configuration/Custom Controls/TextFieldTableViewCell.m @@ -1,6 +1,6 @@ // // TextFieldTableViewCell.m -// eTASM +// PsyPad // // Created by David Lawson on 4/12/12. // diff --git a/PsyPad/Configuration/Custom Controls/TickTableViewCell.h b/PsyPad/Configuration/Custom Controls/TickTableViewCell.h index 4e59274..cd50dcb 100755 --- a/PsyPad/Configuration/Custom Controls/TickTableViewCell.h +++ b/PsyPad/Configuration/Custom Controls/TickTableViewCell.h @@ -1,6 +1,6 @@ // // TickTableViewCell.h -// eTASM +// PsyPad // // Created by David Lawson on 6/12/12. // diff --git a/PsyPad/Configuration/Custom Controls/TickTableViewCell.m b/PsyPad/Configuration/Custom Controls/TickTableViewCell.m index 9c356da..d36f6ba 100755 --- a/PsyPad/Configuration/Custom Controls/TickTableViewCell.m +++ b/PsyPad/Configuration/Custom Controls/TickTableViewCell.m @@ -1,6 +1,6 @@ // // TickTableViewCell.m -// eTASM +// PsyPad // // Created by David Lawson on 6/12/12. // diff --git a/PsyPad/Configuration/SelectConfigurationTableViewController.h b/PsyPad/Configuration/SelectConfigurationTableViewController.h index 910d338..889a765 100755 --- a/PsyPad/Configuration/SelectConfigurationTableViewController.h +++ b/PsyPad/Configuration/SelectConfigurationTableViewController.h @@ -1,6 +1,6 @@ // // SelectConfigurationTableViewController.h -// eTASM2 +// PsyPad // // Created by David Lawson on 4/01/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Configuration/SelectConfigurationTableViewController.m b/PsyPad/Configuration/SelectConfigurationTableViewController.m index 3415651..95d78c2 100755 --- a/PsyPad/Configuration/SelectConfigurationTableViewController.m +++ b/PsyPad/Configuration/SelectConfigurationTableViewController.m @@ -1,6 +1,6 @@ // // SelectConfigurationTableViewController.m -// eTASM2 +// PsyPad // // Created by David Lawson on 4/01/13. // Copyright (c) 2013 David Lawson. All rights reserved. @@ -420,7 +420,7 @@ - (void)addPracticeConfiguration - (IBAction)dismissModal:(id)sender { - [self dismissModalViewControllerAnimated:YES]; + [self dismissViewControllerAnimated:YES completion:nil]; } @end diff --git a/PsyPad/Configuration/TestConfigSubTableViewController.h b/PsyPad/Configuration/TestConfigSubTableViewController.h index 11665ee..e385e11 100755 --- a/PsyPad/Configuration/TestConfigSubTableViewController.h +++ b/PsyPad/Configuration/TestConfigSubTableViewController.h @@ -1,6 +1,6 @@ // // TestConfigSubTableViewController.h -// eTASM +// PsyPad // // Created by David Lawson on 12/02/12. // diff --git a/PsyPad/Configuration/TestConfigSubTableViewController.m b/PsyPad/Configuration/TestConfigSubTableViewController.m index e9af38b..872182b 100755 --- a/PsyPad/Configuration/TestConfigSubTableViewController.m +++ b/PsyPad/Configuration/TestConfigSubTableViewController.m @@ -1,6 +1,6 @@ // // TestConfigSubTableViewController.m -// eTASM +// PsyPad // // Created by David Lawson on 12/02/12. // diff --git a/PsyPad/Configuration/TestConfigTableViewController.h b/PsyPad/Configuration/TestConfigTableViewController.h index ad66413..d4f9c3f 100755 --- a/PsyPad/Configuration/TestConfigTableViewController.h +++ b/PsyPad/Configuration/TestConfigTableViewController.h @@ -1,6 +1,6 @@ // // TestConfigTableViewController.h -// eTASM +// PsyPad // // Created by David Lawson on 2/12/12. // @@ -89,7 +89,6 @@ @property (weak, nonatomic) IBOutlet UITextField *button4FG; @property (weak, nonatomic) IBOutlet UISwitch *requireNextSwitch; -@property (weak, nonatomic) IBOutlet UISwitch *attemptFacialRecognition; @property (weak, nonatomic) IBOutlet UILabel *timeBetweenEachQuestionMeanLabel; diff --git a/PsyPad/Configuration/TestConfigTableViewController.m b/PsyPad/Configuration/TestConfigTableViewController.m index 217ad93..322cbb2 100755 --- a/PsyPad/Configuration/TestConfigTableViewController.m +++ b/PsyPad/Configuration/TestConfigTableViewController.m @@ -1,6 +1,6 @@ // // TestConfigTableViewController.m -// eTASM +// PsyPad // // Created by David Lawson on 2/12/12. // @@ -118,7 +118,6 @@ - (IBAction)saveChanges:(id)sender conf.button4_fg = self.button4FG.text; conf.require_next = @(self.requireNextSwitch.on); - conf.attempt_facial_recognition = @(self.attemptFacialRecognition.on); conf.time_between_question_mean = @(self.timeBetweenEachQuestionMean.value); conf.time_between_question_plusminus = @(self.timeBetweenEachQuestionPlusMinus.value); @@ -221,7 +220,6 @@ - (void)populateFields self.button4FG.text = conf.button4_fg; self.requireNextSwitch.on = conf.require_next.boolValue; - self.attemptFacialRecognition.on = conf.attempt_facial_recognition.boolValue; self.timeBetweenEachQuestionMean.value = conf.time_between_question_mean.floatValue; self.timeBetweenEachQuestionMeanLabel.text = [NSString stringWithFormat:@"%.2fs", conf.time_between_question_mean.floatValue]; @@ -440,7 +438,6 @@ - (void)viewDidUnload [self setButton3FG:nil]; [self setButton4BG:nil]; [self setButton4FG:nil]; - [self setAttemptFacialRecognition:nil]; [self setTimeBetweenEachQuestionMean:nil]; [self setTimeBetweenEachQuestionPlusMinus:nil]; [self setTimeBetweenEachQuestionMeanLabel:nil]; diff --git a/PsyPad/Database/AppConfiguration.h b/PsyPad/Database/AppConfiguration.h index aebe3b5..906784a 100644 --- a/PsyPad/Database/AppConfiguration.h +++ b/PsyPad/Database/AppConfiguration.h @@ -1,6 +1,6 @@ // // AppConfiguration.h -// eTASM2 +// PsyPad // // Created by David Lawson on 2/04/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Database/AppConfiguration.m b/PsyPad/Database/AppConfiguration.m index 7baf14c..edaf8c2 100644 --- a/PsyPad/Database/AppConfiguration.m +++ b/PsyPad/Database/AppConfiguration.m @@ -1,6 +1,6 @@ // // AppConfiguration.m -// eTASM2 +// PsyPad // // Created by David Lawson on 2/04/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Database/Model.xcdatamodel/contents b/PsyPad/Database/Model.xcdatamodel/contents index f99b303..95cc7e1 100644 --- a/PsyPad/Database/Model.xcdatamodel/contents +++ b/PsyPad/Database/Model.xcdatamodel/contents @@ -1,5 +1,5 @@ - + @@ -8,7 +8,6 @@ - diff --git a/PsyPad/Database/TestConfiguration.h b/PsyPad/Database/TestConfiguration.h index 5e5869a..01312dc 100755 --- a/PsyPad/Database/TestConfiguration.h +++ b/PsyPad/Database/TestConfiguration.h @@ -1,6 +1,6 @@ // // TestConfiguration.h -// eTASM +// PsyPad // // Created by David Lawson on 5/12/12. // @@ -20,7 +20,6 @@ // position stored with relationship @property (nonatomic, retain) NSNumber * animation_frame_rate; -@property (nonatomic, retain) NSNumber * attempt_facial_recognition; @property (nonatomic, retain) NSString * background_colour; @property (nonatomic, retain) NSString * button_text_four; @property (nonatomic, retain) NSString * button_text_one; diff --git a/PsyPad/Database/TestConfiguration.m b/PsyPad/Database/TestConfiguration.m index 0622194..18eb819 100755 --- a/PsyPad/Database/TestConfiguration.m +++ b/PsyPad/Database/TestConfiguration.m @@ -1,6 +1,6 @@ // // TestConfiguration.m -// eTASM +// PsyPad // // Created by David Lawson on 5/12/12. // @@ -16,7 +16,6 @@ @implementation TestConfiguration @dynamic animation_frame_rate; -@dynamic attempt_facial_recognition; @dynamic background_colour; @dynamic button_text_four; @dynamic button_text_one; @@ -472,11 +471,6 @@ - (void)loadData:(NSDictionary *)data self.randomisation_specified_seed = @([(NSString *)[data objectForKey:@"specified_seed"] intValue]); - - if ([(NSString *)[data objectForKey:@"attempt_facial_recognition"] isEqualToString:@"1"]) - self.attempt_facial_recognition = @YES; - else - self.attempt_facial_recognition = @NO; } - (NSDictionary *)serialise @@ -569,7 +563,6 @@ - (NSDictionary *)serialise [data setObject:self.images_together_presentation_time forKey:@"presentation_time"]; [data setObject:self.randomisation_use_specified_seed forKey:@"use_specified_seed"]; [data setObject:self.randomisation_specified_seed forKey:@"specified_seed"]; - [data setObject:self.attempt_facial_recognition forKey:@"attempt_facial_recognition"]; NSLog(@"%@", data); diff --git a/PsyPad/Database/TestLog.h b/PsyPad/Database/TestLog.h index 4c006e9..18bb8c1 100755 --- a/PsyPad/Database/TestLog.h +++ b/PsyPad/Database/TestLog.h @@ -1,6 +1,6 @@ // // TestLog.h -// eTASM +// PsyPad // // Created by David Lawson on 13/12/12. // diff --git a/PsyPad/Database/TestLog.m b/PsyPad/Database/TestLog.m index bf99dc6..1a04d84 100755 --- a/PsyPad/Database/TestLog.m +++ b/PsyPad/Database/TestLog.m @@ -1,6 +1,6 @@ // // TestLog.m -// eTASM +// PsyPad // // Created by David Lawson on 13/12/12. // diff --git a/PsyPad/Database/TestLogItem.h b/PsyPad/Database/TestLogItem.h index 4b667a3..f1ad4a8 100755 --- a/PsyPad/Database/TestLogItem.h +++ b/PsyPad/Database/TestLogItem.h @@ -1,6 +1,6 @@ // // TestLogItem.h -// eTASM +// PsyPad // // Created by David Lawson on 13/12/12. // diff --git a/PsyPad/Database/TestLogItem.m b/PsyPad/Database/TestLogItem.m index de56a85..9b573dd 100755 --- a/PsyPad/Database/TestLogItem.m +++ b/PsyPad/Database/TestLogItem.m @@ -1,6 +1,6 @@ // // TestLogItem.m -// eTASM +// PsyPad // // Created by David Lawson on 13/12/12. // diff --git a/PsyPad/Database/TestSequence.h b/PsyPad/Database/TestSequence.h index a3c467b..188111a 100755 --- a/PsyPad/Database/TestSequence.h +++ b/PsyPad/Database/TestSequence.h @@ -1,6 +1,6 @@ // // TestSequence.h -// eTASM +// PsyPad // // Created by David Lawson on 4/12/12. // diff --git a/PsyPad/Database/TestSequence.m b/PsyPad/Database/TestSequence.m index e01e19c..1da1040 100755 --- a/PsyPad/Database/TestSequence.m +++ b/PsyPad/Database/TestSequence.m @@ -1,6 +1,6 @@ // // TestSequence.m -// eTASM +// PsyPad // // Created by David Lawson on 4/12/12. // diff --git a/PsyPad/Database/TestSequenceFolder.h b/PsyPad/Database/TestSequenceFolder.h index dbcc22b..366e899 100755 --- a/PsyPad/Database/TestSequenceFolder.h +++ b/PsyPad/Database/TestSequenceFolder.h @@ -1,6 +1,6 @@ // // TestSequenceFolder.h -// eTASM +// PsyPad // // Created by David Lawson on 4/12/12. // diff --git a/PsyPad/Database/TestSequenceFolder.m b/PsyPad/Database/TestSequenceFolder.m index 08fcf7b..5d05a45 100755 --- a/PsyPad/Database/TestSequenceFolder.m +++ b/PsyPad/Database/TestSequenceFolder.m @@ -1,6 +1,6 @@ // // TestSequenceFolder.m -// eTASM +// PsyPad // // Created by David Lawson on 4/12/12. // diff --git a/PsyPad/Database/TestSequenceImage.h b/PsyPad/Database/TestSequenceImage.h index b244616..5de323d 100755 --- a/PsyPad/Database/TestSequenceImage.h +++ b/PsyPad/Database/TestSequenceImage.h @@ -1,6 +1,6 @@ // // TestSequenceImage.h -// eTASM +// PsyPad // // Created by David Lawson on 4/12/12. // diff --git a/PsyPad/Database/TestSequenceImage.m b/PsyPad/Database/TestSequenceImage.m index d893548..743eb71 100755 --- a/PsyPad/Database/TestSequenceImage.m +++ b/PsyPad/Database/TestSequenceImage.m @@ -1,6 +1,6 @@ // // TestSequenceImage.m -// eTASM +// PsyPad // // Created by David Lawson on 4/12/12. // diff --git a/PsyPad/Database/User.h b/PsyPad/Database/User.h index cf26c38..baa851e 100755 --- a/PsyPad/Database/User.h +++ b/PsyPad/Database/User.h @@ -1,6 +1,6 @@ // // User.h -// eTASM2 +// PsyPad // // Created by David Lawson on 6/01/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Database/User.m b/PsyPad/Database/User.m index 7b21de1..09ac7d4 100755 --- a/PsyPad/Database/User.m +++ b/PsyPad/Database/User.m @@ -1,6 +1,6 @@ // // User.m -// eTASM2 +// PsyPad // // Created by David Lawson on 6/01/13. // Copyright (c) 2013 David Lawson. All rights reserved. diff --git a/PsyPad/Helper Classes/NSObject+DelayBlock.h b/PsyPad/Helper Classes/NSObject+DelayBlock.h index 8091ec1..7e25bf7 100755 --- a/PsyPad/Helper Classes/NSObject+DelayBlock.h +++ b/PsyPad/Helper Classes/NSObject+DelayBlock.h @@ -1,6 +1,6 @@ // // NSObject+DelayBlock.h -// eTASM +// PsyPad // // Created by David Lawson on 12/17/12. // Copyright (c) 2012 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Helper Classes/NSString+containsCategory.h b/PsyPad/Helper Classes/NSString+containsCategory.h index fd65340..f31abeb 100755 --- a/PsyPad/Helper Classes/NSString+containsCategory.h +++ b/PsyPad/Helper Classes/NSString+containsCategory.h @@ -1,6 +1,6 @@ // // NSString+containsCategory.h -// eTASM2 +// PsyPad // // Created by David Lawson on 02/27/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Helper Classes/NSString+containsCategory.m b/PsyPad/Helper Classes/NSString+containsCategory.m index 3cadb71..f22c17b 100755 --- a/PsyPad/Helper Classes/NSString+containsCategory.m +++ b/PsyPad/Helper Classes/NSString+containsCategory.m @@ -1,6 +1,6 @@ // // NSString+containsCategory.m -// eTASM2 +// PsyPad // // Created by David Lawson on 02/27/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Helper Classes/Random.h b/PsyPad/Helper Classes/Random.h index 2422221..143b55b 100755 --- a/PsyPad/Helper Classes/Random.h +++ b/PsyPad/Helper Classes/Random.h @@ -1,6 +1,6 @@ // // Random.h -// eTASM +// PsyPad // // Created by David Lawson on 2/12/12. // diff --git a/PsyPad/Helper Classes/Random.m b/PsyPad/Helper Classes/Random.m index de5a858..14f2f02 100755 --- a/PsyPad/Helper Classes/Random.m +++ b/PsyPad/Helper Classes/Random.m @@ -1,6 +1,6 @@ // // Random.m -// eTASM +// PsyPad // // Created by David Lawson on 2/12/12. // diff --git a/PsyPad/Helper Classes/UIImage+Picker.h b/PsyPad/Helper Classes/UIImage+Picker.h index b6a49d6..15bbae3 100755 --- a/PsyPad/Helper Classes/UIImage+Picker.h +++ b/PsyPad/Helper Classes/UIImage+Picker.h @@ -1,6 +1,6 @@ // // UIImage+Picker.h -// eTASM2 +// PsyPad // // Created by David Lawson on 02/27/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Helper Classes/UIImage+Picker.m b/PsyPad/Helper Classes/UIImage+Picker.m index 005d21e..1e8a0db 100755 --- a/PsyPad/Helper Classes/UIImage+Picker.m +++ b/PsyPad/Helper Classes/UIImage+Picker.m @@ -1,6 +1,6 @@ // // UIImage+Picker.m -// eTASM2 +// PsyPad // // Created by David Lawson on 02/27/13. // Copyright (c) 2013 __MyCompanyName__. All rights reserved. diff --git a/PsyPad/Helper Classes/UIView+Positioning.h b/PsyPad/Helper Classes/UIView+Positioning.h index 84da388..7ec5008 100755 --- a/PsyPad/Helper Classes/UIView+Positioning.h +++ b/PsyPad/Helper Classes/UIView+Positioning.h @@ -1,6 +1,6 @@ // // UIView+Positioning.h -// eTASM +// PsyPad // // Created by David Lawson on 7/12/12. // diff --git a/PsyPad/Helper Classes/UIView+Positioning.m b/PsyPad/Helper Classes/UIView+Positioning.m index d965a99..c0d7d23 100755 --- a/PsyPad/Helper Classes/UIView+Positioning.m +++ b/PsyPad/Helper Classes/UIView+Positioning.m @@ -1,6 +1,6 @@ // // UIView+Positioning.m -// eTASM +// PsyPad // // Created by David Lawson on 7/12/12. // diff --git a/PsyPad/Log/TestLogTableViewCell.h b/PsyPad/Log/TestLogTableViewCell.h index 599158c..717647e 100755 --- a/PsyPad/Log/TestLogTableViewCell.h +++ b/PsyPad/Log/TestLogTableViewCell.h @@ -1,6 +1,6 @@ // // TestLogTableViewCell.h -// eTASM +// PsyPad // // Created by David Lawson on 13/12/12. // diff --git a/PsyPad/Log/TestLogTableViewCell.m b/PsyPad/Log/TestLogTableViewCell.m index cdd4486..9fe007c 100755 --- a/PsyPad/Log/TestLogTableViewCell.m +++ b/PsyPad/Log/TestLogTableViewCell.m @@ -1,6 +1,6 @@ // // TestLogTableViewCell.m -// eTASM +// PsyPad // // Created by David Lawson on 13/12/12. // diff --git a/PsyPad/Log/TestLogTableViewController.h b/PsyPad/Log/TestLogTableViewController.h index 71e8b23..6d3655c 100755 --- a/PsyPad/Log/TestLogTableViewController.h +++ b/PsyPad/Log/TestLogTableViewController.h @@ -1,6 +1,6 @@ // // TestLogTableViewController.h -// eTASM +// PsyPad // // Created by David Lawson on 13/12/12. // diff --git a/PsyPad/Log/TestLogTableViewController.m b/PsyPad/Log/TestLogTableViewController.m index 0840230..9515f95 100755 --- a/PsyPad/Log/TestLogTableViewController.m +++ b/PsyPad/Log/TestLogTableViewController.m @@ -1,6 +1,6 @@ // // TestLogTableViewController.m -// eTASM +// PsyPad // // Created by David Lawson on 13/12/12. // @@ -206,12 +206,7 @@ - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender - (IBAction)close:(id)sender { - [self dismissModalViewControllerAnimated:YES]; -} - -- (void)viewDidUnload -{ - [super viewDidUnload]; + [self dismissViewControllerAnimated:YES completion:nil]; } @end diff --git a/PsyPad/Main Menu/MainMenuViewController.h b/PsyPad/Main Menu/MainMenuViewController.h index 20ddfa6..2fa1c1d 100755 --- a/PsyPad/Main Menu/MainMenuViewController.h +++ b/PsyPad/Main Menu/MainMenuViewController.h @@ -1,6 +1,6 @@ // // MainMenuViewController.h -// eTASM2 +// PsyPad // // Created by David Lawson on 28/12/12. // Copyright (c) 2012 David Lawson. All rights reserved. diff --git a/PsyPad/Main Menu/MainMenuViewController.m b/PsyPad/Main Menu/MainMenuViewController.m index e9f0809..fca28ad 100755 --- a/PsyPad/Main Menu/MainMenuViewController.m +++ b/PsyPad/Main Menu/MainMenuViewController.m @@ -1,6 +1,6 @@ // // MainMenuViewController.m -// eTASM2 +// PsyPad // // Created by David Lawson on 28/12/12. // Copyright (c) 2012 David Lawson. All rights reserved. @@ -18,8 +18,7 @@ #import "TestLogTableViewController.h" #import "TestLog.h" #import "TestViewController.h" -#import "AFHTTPClient.h" -#import "AFHTTPRequestOperation.h" +#import #import "AdminPanelTableViewController.h" #import "SSZipArchive.h" #import "MBProgressHUD.h" @@ -367,7 +366,7 @@ - (void)loadUser:(NSString *)userID dispatch_semaphore_t sema = dispatch_semaphore_create(0); [newConfiguration installSequenceWithURL:image_sequence_url data:image_sequence_data HUD:self.hud sema:sema]; dispatch_semaphore_wait(sema, DISPATCH_TIME_FOREVER); - dispatch_release(sema); + //dispatch_release(sema); } /*if ([configurationData objectForKey:@"NQPF"]) diff --git a/box.jpg b/PsyPad/Resources/box.jpg similarity index 100% rename from box.jpg rename to PsyPad/Resources/box.jpg diff --git a/grating.png b/PsyPad/Resources/grating.png similarity index 100% rename from grating.png rename to PsyPad/Resources/grating.png diff --git a/grating@2x.png b/PsyPad/Resources/grating@2x.png similarity index 100% rename from grating@2x.png rename to PsyPad/Resources/grating@2x.png diff --git a/PsyPad/Supporting Files/PsyPad-Prefix.pch b/PsyPad/Supporting Files/PsyPad-Prefix.pch index 0b0659e..170c074 100755 --- a/PsyPad/Supporting Files/PsyPad-Prefix.pch +++ b/PsyPad/Supporting Files/PsyPad-Prefix.pch @@ -1,5 +1,5 @@ // -// Prefix header for all source files of the 'eTASM2' target in the 'eTASM2' project +// Prefix header for all source files of the 'PsyPad' target in the 'PsyPad' project // #import diff --git a/PsyPad/Supporting Files/main.m b/PsyPad/Supporting Files/main.m index d44a681..c9a5c8a 100755 --- a/PsyPad/Supporting Files/main.m +++ b/PsyPad/Supporting Files/main.m @@ -1,6 +1,6 @@ // // main.m -// eTASM2 +// PsyPad // // Created by David Lawson on 28/12/12. // diff --git a/PsyPad/Test/Custom Controls/TestButton.h b/PsyPad/Test/Custom Controls/TestButton.h index 5e5a7cc..c27522f 100755 --- a/PsyPad/Test/Custom Controls/TestButton.h +++ b/PsyPad/Test/Custom Controls/TestButton.h @@ -1,6 +1,6 @@ // // TestButton.h -// eTASM +// PsyPad // // Created by David Lawson on 12/12/12. // diff --git a/PsyPad/Test/Custom Controls/TestButton.m b/PsyPad/Test/Custom Controls/TestButton.m index 7a166b1..06c8e32 100755 --- a/PsyPad/Test/Custom Controls/TestButton.m +++ b/PsyPad/Test/Custom Controls/TestButton.m @@ -1,6 +1,6 @@ // // TestButton.m -// eTASM +// PsyPad // // Created by David Lawson on 12/12/12. // diff --git a/PsyPad/Test/Custom Controls/TestImageButton.h b/PsyPad/Test/Custom Controls/TestImageButton.h index dda71b4..fa4e845 100755 --- a/PsyPad/Test/Custom Controls/TestImageButton.h +++ b/PsyPad/Test/Custom Controls/TestImageButton.h @@ -1,6 +1,6 @@ // // TestImageButton.h -// eTASM +// PsyPad // // Created by David Lawson on 12/07/12. // diff --git a/PsyPad/Test/Custom Controls/TestImageButton.m b/PsyPad/Test/Custom Controls/TestImageButton.m index 0ef28ed..ca0c038 100755 --- a/PsyPad/Test/Custom Controls/TestImageButton.m +++ b/PsyPad/Test/Custom Controls/TestImageButton.m @@ -1,6 +1,6 @@ // // TestImageButton.m -// eTASM +// PsyPad // // Created by David Lawson on 12/07/12. // diff --git a/PsyPad/Test/DistanceDetector.h b/PsyPad/Test/DistanceDetector.h deleted file mode 100755 index 32c75f7..0000000 --- a/PsyPad/Test/DistanceDetector.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// Created by david on 27/02/13. -// -// To change the template use AppCode | Preferences | File Templates. -// - -#import - -@class AVCaptureSession; -@class AVCaptureVideoPreviewLayer; -@class AVCaptureStillImageOutput; -@class AVCaptureConnection; -@class TestViewController; - -@interface DistanceDetector : NSObject - -@property (strong, nonatomic) AVCaptureSession *session; -@property (strong, nonatomic) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer; -@property (strong, nonatomic) AVCaptureStillImageOutput *stillImageOutput; -@property (strong, nonatomic) AVCaptureConnection *videoConnection; -@property (strong, nonatomic) UIImage *photo; - -- (void)takePhoto:(TestViewController *)delegate question:(int)question; - -- (void)done; -@end \ No newline at end of file diff --git a/PsyPad/Test/DistanceDetector.m b/PsyPad/Test/DistanceDetector.m deleted file mode 100755 index ef15fd8..0000000 --- a/PsyPad/Test/DistanceDetector.m +++ /dev/null @@ -1,209 +0,0 @@ -// -// Created by david on 27/02/13. -// -// To change the template use AppCode | Preferences | File Templates. -// - -#import -#import -#import "DistanceDetector.h" -#import "TestViewController.h" -#import "AppDelegate.h" - -@implementation DistanceDetector - -- (id)init -{ - if (self = [super init]) - { - self.session = [[AVCaptureSession alloc] init]; - self.session.sessionPreset = AVCaptureSessionPresetHigh; - - UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; - - AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationLandscapeLeft; - if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) - orientation = AVCaptureVideoOrientationLandscapeLeft; - else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) - orientation = AVCaptureVideoOrientationLandscapeRight; - - // Get all cameras in the application and find the frontal camera. - AVCaptureDevice *frontalCamera; - NSArray *allCameras = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; - - // Find the frontal camera. - for ( int i = 0; i < allCameras.count; i++ ) - { - AVCaptureDevice *camera = [allCameras objectAtIndex:(NSUInteger)i]; - - if ( camera.position == AVCaptureDevicePositionFront ) - { - frontalCamera = camera; - } - } - - [frontalCamera lockForConfiguration:nil]; - - if ([frontalCamera isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) - { - [frontalCamera setFocusMode:AVCaptureFocusModeContinuousAutoFocus]; - } - - if ([frontalCamera isExposureModeSupported:AVCaptureExposureModeContinuousAutoExposure]) - { - [frontalCamera setExposureMode:AVCaptureExposureModeContinuousAutoExposure]; - } - - if ([frontalCamera isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance]) - { - [frontalCamera setWhiteBalanceMode:AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance]; - } - - [frontalCamera unlockForConfiguration]; - - NSError *error = nil; - AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:frontalCamera error:&error]; - - if (input) - { - [self.session addInput:input]; - [self.session startRunning]; - - // output - - self.stillImageOutput = [[AVCaptureStillImageOutput alloc] init]; - [self.session addOutput:self.stillImageOutput]; - - self.videoConnection = nil; - for (AVCaptureConnection *connection in self.stillImageOutput.connections) - { - for (AVCaptureInputPort *port in [connection inputPorts]) - { - if ([[port mediaType] isEqual:AVMediaTypeVideo] ) - { - self.videoConnection = connection; - break; - } - } - - if (self.videoConnection) { break; } - } - - [self.videoConnection setVideoOrientation:orientation]; - [self.videoConnection setVideoMirrored:YES]; - } - } - - return self; -} - -- (void)takePhoto:(TestViewController *)delegate question:(int)question -{ - [self.stillImageOutput captureStillImageAsynchronouslyFromConnection:self.videoConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) - { - NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer]; - - //[imageData writeToURL:[self createNewFile] atomically:YES]; - - UIImage *image = [[UIImage alloc] initWithData:imageData]; - self.photo = image; - NSString *result = [self performDistanceDetection]; - - UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); - - if (result) - { - [delegate distanceDetectionPerformed:[NSString stringWithFormat:@"Question %d: %@", question, result]]; - } - - //[self.session removeOutput:stillImageOutput]; - }]; -} - -/*- (NSURL *)createNewFile -{ - NSURL *documentsDirectory = [[APP_DELEGATE applicationDocumentsDirectory] URLByAppendingPathComponent:@"Images"]; - NSString *templateString = [NSString stringWithFormat:@"%@/XXXXXX", [documentsDirectory path]]; - - char template[templateString.length + 1]; - strcpy(template, [templateString cStringUsingEncoding:NSASCIIStringEncoding]); - char *filename = mktemp(template); - - NSString *path = [NSString stringWithCString:filename encoding:NSASCIIStringEncoding]; - - NSURL *newURL = [NSURL fileURLWithPath:[path stringByAppendingString:@".jpg"]]; - - [[NSFileManager defaultManager] createFileAtPath:newURL.path contents:nil attributes:nil]; - - return newURL; -}*/ - -- (void)done -{ - [self.session removeOutput:self.stillImageOutput]; -} - -- (NSString *)performDistanceDetection -{ - UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; - - #warning accuracy low - NSDictionary *options = [NSDictionary dictionaryWithObject:CIDetectorAccuracyLow forKey:CIDetectorAccuracy]; - CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:options]; - - CIImage *image = [CIImage imageWithCGImage:self.photo.CGImage]; - - int exifOrientation; - - enum { - PHOTOS_EXIF_0ROW_TOP_0COL_LEFT = 1, // 1 = 0th row is at the top, and 0th column is on the left (THE DEFAULT). - PHOTOS_EXIF_0ROW_TOP_0COL_RIGHT = 2, // 2 = 0th row is at the top, and 0th column is on the right. - PHOTOS_EXIF_0ROW_BOTTOM_0COL_RIGHT = 3, // 3 = 0th row is at the bottom, and 0th column is on the right. - PHOTOS_EXIF_0ROW_BOTTOM_0COL_LEFT = 4, // 4 = 0th row is at the bottom, and 0th column is on the left. - PHOTOS_EXIF_0ROW_LEFT_0COL_TOP = 5, // 5 = 0th row is on the left, and 0th column is the top. - PHOTOS_EXIF_0ROW_RIGHT_0COL_TOP = 6, // 6 = 0th row is on the right, and 0th column is the top. - PHOTOS_EXIF_0ROW_RIGHT_0COL_BOTTOM = 7, // 7 = 0th row is on the right, and 0th column is the bottom. - PHOTOS_EXIF_0ROW_LEFT_0COL_BOTTOM = 8 // 8 = 0th row is on the left, and 0th column is the bottom. - }; - - switch (interfaceOrientation) { - case UIInterfaceOrientationLandscapeRight: // Device oriented horizontally, home button on the right - exifOrientation = PHOTOS_EXIF_0ROW_BOTTOM_0COL_RIGHT; - break; - case UIInterfaceOrientationLandscapeLeft: // Device oriented horizontally, home button on the left - default: - exifOrientation = PHOTOS_EXIF_0ROW_TOP_0COL_LEFT; - break; - } - - NSDictionary *imageOptions = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:exifOrientation] forKey:CIDetectorImageOrientation]; - - NSArray *features = [detector featuresInImage:image options:imageOptions]; - - for (CIFaceFeature *feature in features) - { - CGPoint leftEyePosition, rightEyePosition, mouthPosition; - - if (feature.hasLeftEyePosition && feature.hasRightEyePosition && feature.hasMouthPosition) - { - leftEyePosition = feature.leftEyePosition; - rightEyePosition = feature.rightEyePosition; - mouthPosition = feature.mouthPosition; - - //CGFloat xDist = (rightEyePosition.x - leftEyePosition.x); - //CGFloat yDist = (rightEyePosition.y - leftEyePosition.y); - //CGFloat distance = (CGFloat)sqrt((xDist * xDist) + (yDist * yDist)); - - //CGFloat calibration_pixel = 142; - //CGFloat calibration_distance = 30; - - //return [NSString stringWithFormat:@"Detected distance from camera: %.5fpixels = %.5fcm", distance, (calibration_pixel*calibration_distance)/distance]; - - return [NSString stringWithFormat:@"Detected facial features: left eye %.5f/%.5f, right eye: %.5f/%.5f, mouth: %.5f/%.5f", leftEyePosition.x, leftEyePosition.y, rightEyePosition.x, rightEyePosition.y, mouthPosition.x, mouthPosition.y]; - } - } - - return nil; -} - -@end \ No newline at end of file diff --git a/PsyPad/Test/DistanceDetectorViewController.h b/PsyPad/Test/DistanceDetectorViewController.h deleted file mode 100755 index 536f17c..0000000 --- a/PsyPad/Test/DistanceDetectorViewController.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// DistanceDetectorViewController.h -// eTASM2 -// -// Created by David Lawson on 25/01/13. -// Copyright (c) 2013 David Lawson. All rights reserved. -// - -#import - -@class AVCaptureSession; -@class AVCaptureVideoPreviewLayer; - -@interface DistanceDetectorViewController : UIViewController - -@property (weak, nonatomic) IBOutlet UIImageView *faceImageView; -@property (weak, nonatomic) IBOutlet UILabel *resultsLabel; -@property (strong, nonatomic) UIImage *photo; -@property (strong, nonatomic) AVCaptureSession *session; -@property (strong, nonatomic) AVCaptureVideoPreviewLayer *captureVideoPreviewLayer; - -- (IBAction)dismissController:(id)sender; -- (IBAction)performDistanceDetection:(id)sender; - -@end diff --git a/PsyPad/Test/DistanceDetectorViewController.m b/PsyPad/Test/DistanceDetectorViewController.m deleted file mode 100755 index d5343e3..0000000 --- a/PsyPad/Test/DistanceDetectorViewController.m +++ /dev/null @@ -1,268 +0,0 @@ -// -// DistanceDetectorViewController.m -// eTASM2 -// -// Created by David Lawson on 25/01/13. -// Copyright (c) 2013 David Lawson. All rights reserved. -// - -#import "DistanceDetectorViewController.h" -#import - -@interface DistanceDetectorViewController () - -@end - -@implementation DistanceDetectorViewController - -- (void)viewDidLoad -{ - [super viewDidLoad]; - // Do any additional setup after loading the view. - - self.session = [[AVCaptureSession alloc] init]; - self.session.sessionPreset = AVCaptureSessionPresetPhoto; - - AVCaptureVideoPreviewLayer *captureVideoPreviewLayer = [[AVCaptureVideoPreviewLayer alloc] initWithSession:self.session]; - captureVideoPreviewLayer.frame = self.faceImageView.bounds; - - UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; - - AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationLandscapeLeft; - if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) - orientation = AVCaptureVideoOrientationLandscapeLeft; - else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) - orientation = AVCaptureVideoOrientationLandscapeRight; - - captureVideoPreviewLayer.orientation = orientation; - - [self.faceImageView.layer addSublayer:captureVideoPreviewLayer]; - - self.captureVideoPreviewLayer = captureVideoPreviewLayer; - - // Get all cameras in the application and find the frontal camera. - AVCaptureDevice *frontalCamera; - NSArray *allCameras = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo]; - - // Find the frontal camera. - for ( int i = 0; i < allCameras.count; i++ ) - { - AVCaptureDevice *camera = [allCameras objectAtIndex:(NSUInteger)i]; - - if ( camera.position == AVCaptureDevicePositionFront ) - { - frontalCamera = camera; - } - } - - [frontalCamera lockForConfiguration:nil]; - - if ([frontalCamera isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) { - [frontalCamera setFocusMode:AVCaptureFocusModeContinuousAutoFocus]; - } - - if ([frontalCamera isExposureModeSupported:AVCaptureExposureModeContinuousAutoExposure]) { - [frontalCamera setExposureMode:AVCaptureExposureModeContinuousAutoExposure]; - } - - [frontalCamera unlockForConfiguration]; - - NSError *error = nil; - AVCaptureDeviceInput *input = [AVCaptureDeviceInput deviceInputWithDevice:frontalCamera error:&error]; - - [self.session addInput:input]; - [self.session startRunning]; -} - -- (void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - return UIDeviceOrientationIsLandscape(toInterfaceOrientation); -} - -- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation -{ - UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; - - AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationLandscapeLeft; - if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) - orientation = AVCaptureVideoOrientationLandscapeLeft; - else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) - orientation = AVCaptureVideoOrientationLandscapeRight; - - self.captureVideoPreviewLayer.orientation = orientation; - - [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; -} - - -- (NSUInteger)supportedInterfaceOrientations -{ - return UIInterfaceOrientationMaskLandscape; -} - -- (IBAction)dismissController:(id)sender -{ - [self dismissModalViewControllerAnimated:YES]; -} - -- (IBAction)performDistanceDetection:(id)sender -{ - AVCaptureStillImageOutput *stillImageOutput = [[AVCaptureStillImageOutput alloc] init]; - [self.session addOutput:stillImageOutput]; - - AVCaptureConnection *videoConnection = nil; - for (AVCaptureConnection *connection in stillImageOutput.connections) - { - for (AVCaptureInputPort *port in [connection inputPorts]) - { - if ([[port mediaType] isEqual:AVMediaTypeVideo] ) - { - videoConnection = connection; - break; - } - } - - if (videoConnection) { break; } - } - - UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; - - AVCaptureVideoOrientation orientation = AVCaptureVideoOrientationLandscapeLeft; - if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) - orientation = AVCaptureVideoOrientationLandscapeLeft; - else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight) - orientation = AVCaptureVideoOrientationLandscapeRight; - - [videoConnection setVideoOrientation:orientation]; - [videoConnection setVideoMirrored:YES]; - - [stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler:^(CMSampleBufferRef imageDataSampleBuffer, NSError *error) - { - [self.captureVideoPreviewLayer removeFromSuperlayer]; - NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageDataSampleBuffer]; - UIImage *image = [[UIImage alloc] initWithData:imageData]; - self.photo = image; - [self drawImage]; - - [self.session removeOutput:stillImageOutput]; - }]; -} - -- (void)drawImage -{ - //self.faceImageView.image = self.photo; - - UIGraphicsBeginImageContextWithOptions(self.photo.size, YES, 0); - - CGContextRef context = UIGraphicsGetCurrentContext(); - - UIInterfaceOrientation interfaceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; - - if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) - { - CGContextTranslateCTM(context, self.photo.size.width, self.photo.size.height); - CGContextScaleCTM(context, -1.0, -1.0); - } - - CGContextDrawImage(context, - CGRectMake(0, 0, self.photo.size.width, self.photo.size.height), - self.photo.CGImage); - - NSDictionary *options = [NSDictionary dictionaryWithObject:CIDetectorAccuracyLow forKey:CIDetectorAccuracy]; - CIDetector *detector = [CIDetector detectorOfType:CIDetectorTypeFace context:nil options:options]; - - CIImage *image = [CIImage imageWithCGImage:self.photo.CGImage]; - - int exifOrientation; - - enum { - PHOTOS_EXIF_0ROW_TOP_0COL_LEFT = 1, // 1 = 0th row is at the top, and 0th column is on the left (THE DEFAULT). - PHOTOS_EXIF_0ROW_TOP_0COL_RIGHT = 2, // 2 = 0th row is at the top, and 0th column is on the right. - PHOTOS_EXIF_0ROW_BOTTOM_0COL_RIGHT = 3, // 3 = 0th row is at the bottom, and 0th column is on the right. - PHOTOS_EXIF_0ROW_BOTTOM_0COL_LEFT = 4, // 4 = 0th row is at the bottom, and 0th column is on the left. - PHOTOS_EXIF_0ROW_LEFT_0COL_TOP = 5, // 5 = 0th row is on the left, and 0th column is the top. - PHOTOS_EXIF_0ROW_RIGHT_0COL_TOP = 6, // 6 = 0th row is on the right, and 0th column is the top. - PHOTOS_EXIF_0ROW_RIGHT_0COL_BOTTOM = 7, // 7 = 0th row is on the right, and 0th column is the bottom. - PHOTOS_EXIF_0ROW_LEFT_0COL_BOTTOM = 8 // 8 = 0th row is on the left, and 0th column is the bottom. - }; - - switch (interfaceOrientation) { - case UIInterfaceOrientationLandscapeRight: // Device oriented horizontally, home button on the right - exifOrientation = PHOTOS_EXIF_0ROW_BOTTOM_0COL_RIGHT; - break; - case UIInterfaceOrientationLandscapeLeft: // Device oriented horizontally, home button on the left - default: - exifOrientation = PHOTOS_EXIF_0ROW_TOP_0COL_LEFT; - break; - } - - NSDictionary *imageOptions = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:exifOrientation] forKey:CIDetectorImageOrientation]; - - NSArray *features = [detector featuresInImage:image options:imageOptions]; - - for (CIFaceFeature *feature in features) - { - CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 0.5f); - CGContextSetStrokeColorWithColor(context, [UIColor whiteColor].CGColor); - CGContextSetLineWidth(context, 2.0f); - - CGContextAddRect(context, feature.bounds); - CGContextDrawPath(context, kCGPathFillStroke); - - CGContextSetRGBFillColor(context, 1.0f, 0.0f, 0.0f, 0.4f); - - CGPoint leftEyePosition, rightEyePosition; - - if (feature.hasLeftEyePosition) - { - leftEyePosition = feature.leftEyePosition; - [self drawFeatureInContext:context atPoint:feature.leftEyePosition]; - } - - if (feature.hasRightEyePosition) - { - rightEyePosition = feature.rightEyePosition; - [self drawFeatureInContext:context atPoint:feature.rightEyePosition]; - } - - CGFloat xDist = (rightEyePosition.x - leftEyePosition.x); - CGFloat yDist = (rightEyePosition.y - leftEyePosition.y); - CGFloat distance = (CGFloat)sqrt((xDist * xDist) + (yDist * yDist)); - - CGFloat calibration_pixel = 142; - CGFloat calibration_distance = 30; - - self.resultsLabel.text = [NSString stringWithFormat:@"Detected distance from camera: %.5fpixels = %.5fcm", distance, (calibration_pixel*calibration_distance)/distance]; - - if (feature.hasMouthPosition) - { - [self drawFeatureInContext:context atPoint:feature.mouthPosition]; - } - } - - self.faceImageView.image = UIGraphicsGetImageFromCurrentImageContext(); - - UIGraphicsEndImageContext(); -} - -- (void)drawFeatureInContext:(CGContextRef)context atPoint:(CGPoint)featurePoint -{ - CGFloat radius = 20.0f; - CGContextAddArc(context, featurePoint.x, featurePoint.y, radius, 0, (CGFloat)(M_PI * 2), 1); - CGContextDrawPath(context, kCGPathFillStroke); -} - -- (void)viewDidUnload -{ - [self setFaceImageView:nil]; - [self setResultsLabel:nil]; - [super viewDidUnload]; -} - -@end diff --git a/PsyPad/Test/TestViewController.h b/PsyPad/Test/TestViewController.h index fb65760..8d471a4 100755 --- a/PsyPad/Test/TestViewController.h +++ b/PsyPad/Test/TestViewController.h @@ -1,6 +1,6 @@ // // TestViewController.h -// eTASM +// PsyPad // // Created by David Lawson on 5/12/12. // diff --git a/PsyPad/Test/TestViewController.m b/PsyPad/Test/TestViewController.m index ffdff75..2df0837 100755 --- a/PsyPad/Test/TestViewController.m +++ b/PsyPad/Test/TestViewController.m @@ -1,6 +1,6 @@ // // TestViewController.m -// eTASM +// PsyPad // // Created by David Lawson on 5/12/12. // @@ -20,9 +20,7 @@ #import "TestLogItem.h" #import "TestLogTableViewController.h" #import "NSObject+DelayBlock.h" -#import "AFHTTPClient.h" -#import "AFHTTPRequestOperation.h" -#import "DistanceDetector.h" +#import #import "UIImage+Picker.h" #import "Staircase.h" #import "NSString+getNumberFromString.h" @@ -87,8 +85,6 @@ - (void)viewDidLoad self.exitButton.hidden = YES; } - self.distanceDetector = [[DistanceDetector alloc] init]; - [[UIScreen mainScreen] setBrightness:1.0]; } @@ -306,7 +302,7 @@ - (IBAction)pressExitButton:(id)sender [UIView cancelPreviousPerformRequestsWithTarget:self]; [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationFade]; - [self dismissModalViewControllerAnimated:YES]; + [self dismissViewControllerAnimated:YES completion:nil]; } } @@ -469,9 +465,6 @@ - (void)pressTestButton:(id)sender [self log:@"button_press" info:@"%d (%@)", pressedButton.number, [pressedButton titleForState:UIControlStateNormal]]; - if (self.currentConfiguration.attempt_facial_recognition.boolValue) - [self.distanceDetector takePhoto:self question:self.questionNumber]; - if (self.currentConfiguration.use_staircase_method.boolValue) { bool answerCorrect; @@ -913,8 +906,6 @@ - (void)viewDidUnload { free(self.seedState); - [self.distanceDetector done]; - [self setBeginTestButton:nil]; [self setQuestionLabel:nil]; [self setConfigurationNameLabel:nil]; diff --git a/PsyPad/User Interface/MainStoryboard.storyboard b/PsyPad/User Interface/MainStoryboard.storyboard index 2ed3397..dd8863f 100755 --- a/PsyPad/User Interface/MainStoryboard.storyboard +++ b/PsyPad/User Interface/MainStoryboard.storyboard @@ -1,8 +1,8 @@ - + - - + + @@ -1776,36 +1776,12 @@ - - - - - - - - - - - - - - - - - - - + @@ -1836,7 +1812,7 @@ - + @@ -1871,7 +1847,7 @@ - + @@ -1895,7 +1871,7 @@ - + @@ -1923,7 +1899,7 @@ - + @@ -1947,7 +1923,7 @@ - + @@ -1979,7 +1955,6 @@ - @@ -2751,64 +2726,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -3050,9 +2967,6 @@ - - -