Commit cb975bb5 authored by Fabio Pelosin's avatar Fabio Pelosin

[Specs] Added integration specs

parent 08a3fbc9
Subproject commit f7176f4798d068d233dca5223ae4bd9c8059e830 Subproject commit 4ec575e4b074dcc87c44018cce656672a979b34a
Subproject commit 84ea24c2f3a5d463da1e7945c60fd3f33f73dee2 Subproject commit 7f3cc9e12b0a459582d606baa7fc906006965f54
platform :ios, '6.0'
pod "Reachability", "3.1.0"
pod "JSONKit", "1.5pre"
PODS:
- JSONKit (1.5pre)
- Reachability (3.1.0)
DEPENDENCIES:
- JSONKit (= 1.5pre)
- Reachability (= 3.1.0)
SPEC CHECKSUMS:
JSONKit: 3d4708953ea7ae399a49777372d8b060a43ddd27
Reachability: 1c8584c5f26fa776695efef95caaa50402c94cfb
COCOAPODS: 0.16.2
../../JSONKit/JSONKit.h
\ No newline at end of file
../../JSONKit/JSONKit.h
\ No newline at end of file
//
// JSONKit.h
// http://github.com/johnezang/JSONKit
// Dual licensed under either the terms of the BSD License, or alternatively
// under the terms of the Apache License, Version 2.0, as specified below.
//
/*
Copyright (c) 2011, John Engelhart
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Zang Industries nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright 2011 John Engelhart
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <stddef.h>
#include <stdint.h>
#include <limits.h>
#include <TargetConditionals.h>
#include <AvailabilityMacros.h>
#ifdef __OBJC__
#import <Foundation/NSArray.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSError.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSString.h>
#endif // __OBJC__
#ifdef __cplusplus
extern "C" {
#endif
// For Mac OS X < 10.5.
#ifndef NSINTEGER_DEFINED
#define NSINTEGER_DEFINED
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef long NSInteger;
typedef unsigned long NSUInteger;
#define NSIntegerMin LONG_MIN
#define NSIntegerMax LONG_MAX
#define NSUIntegerMax ULONG_MAX
#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef int NSInteger;
typedef unsigned int NSUInteger;
#define NSIntegerMin INT_MIN
#define NSIntegerMax INT_MAX
#define NSUIntegerMax UINT_MAX
#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
#endif // NSINTEGER_DEFINED
#ifndef _JSONKIT_H_
#define _JSONKIT_H_
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465)
#define JK_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
#else
#define JK_DEPRECATED_ATTRIBUTE
#endif
#define JSONKIT_VERSION_MAJOR 1
#define JSONKIT_VERSION_MINOR 4
typedef NSUInteger JKFlags;
/*
JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON.
JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines.
JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode.
This option allows JSON with malformed Unicode to be parsed without reporting an error.
Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER".
*/
enum {
JKParseOptionNone = 0,
JKParseOptionStrict = 0,
JKParseOptionComments = (1 << 0),
JKParseOptionUnicodeNewlines = (1 << 1),
JKParseOptionLooseUnicode = (1 << 2),
JKParseOptionPermitTextAfterValidJSON = (1 << 3),
JKParseOptionValidFlags = (JKParseOptionComments | JKParseOptionUnicodeNewlines | JKParseOptionLooseUnicode | JKParseOptionPermitTextAfterValidJSON),
};
typedef JKFlags JKParseOptionFlags;
enum {
JKSerializeOptionNone = 0,
JKSerializeOptionPretty = (1 << 0),
JKSerializeOptionEscapeUnicode = (1 << 1),
JKSerializeOptionEscapeForwardSlashes = (1 << 4),
JKSerializeOptionValidFlags = (JKSerializeOptionPretty | JKSerializeOptionEscapeUnicode | JKSerializeOptionEscapeForwardSlashes),
};
typedef JKFlags JKSerializeOptionFlags;
#ifdef __OBJC__
typedef struct JKParseState JKParseState; // Opaque internal, private type.
// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict
@interface JSONDecoder : NSObject {
JKParseState *parseState;
}
+ (id)decoder;
+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (void)clearCache;
// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods.
- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead.
- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead.
// The NSData MUST be UTF8 encoded JSON.
- (id)parseJSONData:(NSData *)jsonData JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead.
- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead.
// Methods that return immutable collection objects.
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)objectWithData:(NSData *)jsonData;
- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
// Methods that return mutable collection objects.
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)mutableObjectWithData:(NSData *)jsonData;
- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
@end
////////////
#pragma mark Deserializing methods
////////////
@interface NSString (JSONKitDeserializing)
- (id)objectFromJSONString;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONString;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
@interface NSData (JSONKitDeserializing)
// The NSData MUST be UTF8 encoded JSON.
- (id)objectFromJSONData;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONData;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
////////////
#pragma mark Serializing methods
////////////
@interface NSString (JSONKitSerializing)
// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString).
// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes:
// includeQuotes:YES `a "test"...` -> `"a \"test\"..."`
// includeQuotes:NO `a "test"...` -> `a \"test\"...`
- (NSData *)JSONData; // Invokes JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
- (NSString *)JSONString; // Invokes JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
@end
@interface NSArray (JSONKitSerializing)
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializing)
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
#ifdef __BLOCKS__
@interface NSArray (JSONKitSerializingBlockAdditions)
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializingBlockAdditions)
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
#endif
#endif // __OBJC__
#endif // _JSONKIT_H_
#ifdef __cplusplus
} // extern "C"
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
# JSONKit
JSONKit is dual licensed under either the terms of the BSD License, or alternatively under the terms of the Apache License, Version 2.0.<br />
Copyright &copy; 2011, John Engelhart.
### A Very High Performance Objective-C JSON Library
**UPDATE:** (2011/12/18) The benchmarks below were performed before Apples [`NSJSONSerialization`][NSJSONSerialization] was available (as of Mac OS X 10.7 and iOS 5). The obvious question is: Which is faster, [`NSJSONSerialization`][NSJSONSerialization] or JSONKit? According to [this site](http://www.bonto.ch/blog/2011/12/08/json-libraries-for-ios-comparison-updated/), JSONKit is faster than [`NSJSONSerialization`][NSJSONSerialization]. Some quick "back of the envelope" calculations using the numbers reported, JSONKit appears to be approximately 25% to 40% faster than [`NSJSONSerialization`][NSJSONSerialization], which is pretty significant.
Parsing | Serializing
:---------:|:-------------:
<img src="http://chart.googleapis.com/chart?chf=a,s,000000%7Cb0,lg,0,6589C760,0,6589C7B4,1%7Cbg,lg,90,EFEFEF,0,F8F8F8,1&chxl=0:%7CTouchJSON%7CXML+.plist%7Cjson-framework%7CYAJL-ObjC%7Cgzip+JSONKit%7CBinary+.plist%7CJSONKit%7C2:%7CTime+to+Deserialize+in+%C2%B5sec&chxp=2,40&chxr=0,0,5%7C1,0,3250&chxs=0,676767,11.5,1,lt,676767&chxt=y,x,x&chbh=a,5,4&chs=350x185&cht=bhs&chco=6589C783&chds=0,3250&chd=t:410.517,510.262,539.614,1351.257,1683.346,1747.953,2955.881&chg=-1,0,1,3&chm=N+*s*+%C2%B5s,676767,0,0:5,10.5%7CN+*s*+%C2%B5s,3d3d3d,0,6,10.5,,r:-5:1&chem=y;s=text_outline;d=666,10.5,l,fff,_,Decompress+%2b+Parse+is+just;ds=0;dp=2;py=0;of=58,7%7Cy;s=text_outline;d=666,10.5,l,fff,_,5.6%25+slower+than+Binary+.plist%21;ds=0;dp=2;py=0;of=53,-5" width="350" height="185" alt="Deserialize from JSON" /> | <img src="http://chart.googleapis.com/chart?chf=a,s,000000%7Cb0,lg,0,699E7260,0,699E72B4,1%7Cbg,lg,90,EFEFEF,0,F8F8F8,1&chxl=0:%7CTouchJSON%7CYAJL-ObjC%7CXML+.plist%7Cjson-framework%7CBinary+.plist%7Cgzip+JSONKit%7CJSONKit%7C2:%7CTime+to+Serialize+in+%C2%B5sec&chxp=2,40&chxr=0,0,5%7C1,0,3250&chxs=0,676767,11.5,1,lt,676767&chxt=y,x,x&chbh=a,5,4&chs=350x175&cht=bhs&chco=699E7284&chds=0,3250&chd=t:96.387,466.947,626.153,1028.432,1945.511,2156.978,3051.976&chg=-1,0,1,3&chm=N+*s*+%C2%B5s,676767,0,0:5,10.5%7CN+*s*+%C2%B5s,4d4d4d,0,6,10.5,,r:-5:1&chem=y;s=text_outline;d=666,10.5,l,fff,_,Serialize+%2b+Compress+is+34%25;ds=0;dp=1;py=0;of=51,7%7Cy;s=text_outline;d=666,10.5,l,fff,_,faster+than+Binary+.plist%21;ds=0;dp=1;py=0;of=62,-5" width="350" height="185" alt="Serialize to JSON" />
*23% Faster than Binary* <code><em>.plist</em></code>*&thinsp;!* | *549% Faster than Binary* <code><em>.plist</em></code>*&thinsp;!*
* Benchmarking was performed on a MacBook Pro with a 2.66GHz Core 2.
* All JSON libraries were compiled with `gcc-4.2 -DNS_BLOCK_ASSERTIONS -O3 -arch x86_64`.
* Timing results are the average of 1,000 iterations of the user + system time reported by [`getrusage`][getrusage].
* The JSON used was [`twitter_public_timeline.json`](https://github.com/samsoffes/json-benchmarks/blob/master/Resources/twitter_public_timeline.json) from [samsoffes / json-benchmarks](https://github.com/samsoffes/json-benchmarks).
* Since the `.plist` format does not support serializing [`NSNull`][NSNull], the `null` values in the original JSON were changed to `"null"`.
* The [experimental](https://github.com/johnezang/JSONKit/tree/experimental) branch contains the `gzip` compression changes.
* JSONKit automagically links to `libz.dylib` on the fly at run time&ndash; no manual linking required.
* Parsing / deserializing will automagically decompress a buffer if it detects a `gzip` signature header.
* You can compress / `gzip` the serialized JSON by passing `JKSerializeOptionCompress` to `-JSONDataWithOptions:error:`.
[JSON versus PLIST, the Ultimate Showdown](http://www.cocoanetics.com/2011/03/json-versus-plist-the-ultimate-showdown/) benchmarks the common JSON libraries and compares them to Apples `.plist` format.
***
JavaScript Object Notation, or [JSON][], is a lightweight, text-based, serialization format for structured data that is used by many web-based services and API's. It is defined by [RFC 4627][].
JSON provides the following primitive types:
* `null`
* Boolean `true` and `false`
* Number
* String
* Array
* Object (a.k.a. Associative Arrays, Key / Value Hash Tables, Maps, Dictionaries, etc.)
These primitive types are mapped to the following Objective-C Foundation classes:
JSON | Objective-C
-------------------|-------------
`null` | [`NSNull`][NSNull]
`true` and `false` | [`NSNumber`][NSNumber]
Number | [`NSNumber`][NSNumber]
String | [`NSString`][NSString]
Array | [`NSArray`][NSArray]
Object | [`NSDictionary`][NSDictionary]
JSONKit uses Core Foundation internally, and it is assumed that Core Foundation &equiv; Foundation for every equivalent base type, i.e. [`CFString`][CFString] &equiv; [`NSString`][NSString].
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119][].
### JSON To Objective-C Primitive Mapping Details
* The [JSON specification][RFC 4627] is somewhat ambiguous about the details and requirements when it comes to Unicode, and it does not specify how Unicode issues and errors should be handled. Most of the ambiguity stems from the interpretation and scope [RFC 4627][] Section 3, Encoding: `JSON text SHALL be encoded in Unicode.` It is the authors opinion and interpretation that the language of [RFC 4627][] requires that a JSON implementation MUST follow the requirements specified in the [Unicode Standard][], and in particular the [Conformance][Unicode Standard - Conformance] chapter of the [Unicode Standard][], which specifies requirements related to handling, interpreting, and manipulating Unicode text.
The default behavior for JSONKit is strict [RFC 4627][] conformance. It is the authors opinion and interpretation that [RFC 4627][] requires JSON to be encoded in Unicode, and therefore JSON that is not legal Unicode as defined by the [Unicode Standard][] is invalid JSON. Therefore, JSONKit will not accept JSON that contains ill-formed Unicode. The default, strict behavior implies that the `JKParseOptionLooseUnicode` option is not enabled.
When the `JKParseOptionLooseUnicode` option is enabled, JSONKit follows the specifications and recommendations given in [The Unicode 6.0 standard, Chapter 3 - Conformance][Unicode Standard - Conformance], section 3.9 *Unicode Encoding Forms*. As a general rule of thumb, the Unicode code point `U+FFFD` is substituted for any ill-formed Unicode encountered. JSONKit attempts to follow the recommended *Best Practice for Using U+FFFD*: ***Replace each maximal subpart of an ill-formed subsequence by a single U+FFFD.***
The following Unicode code points are treated as ill-formed Unicode, and if `JKParseOptionLooseUnicode` is enabled, cause `U+FFFD` to be substituted in their place:
`U+0000`.<br>
`U+D800` thru `U+DFFF`, inclusive.<br>
`U+FDD0` thru `U+FDEF`, inclusive.<br>
<code>U+<i>n</i>FFFE</code> and <code>U+<i>n</i>FFFF</code>, where *n* is from `0x0` to `0x10`
The code points `U+FDD0` thru `U+FDEF`, <code>U+<i>n</i>FFFE</code>, and <code>U+<i>n</i>FFFF</code> (where *n* is from `0x0` to `0x10`), are defined as ***Noncharacters*** by the Unicode standard and "should never be interchanged".
An exception is made for the code point `U+0000`, which is legal Unicode. The reason for this is that this particular code point is used by C string handling code to specify the end of the string, and any such string handling code will incorrectly stop processing a string at the point where `U+0000` occurs. Although reasonable people may have different opinions on this point, it is the authors considered opinion that the risks of permitting JSON Strings that contain `U+0000` outweigh the benefits. One of the risks in allowing `U+0000` to appear unaltered in a string is that it has the potential to create security problems by subtly altering the semantics of the string which can then be exploited by a malicious attacker. This is similar to the issue of [arbitrarily deleting characters from Unicode text][Unicode_UTR36_Deleting].
[RFC 4627][] allows for these limitations under section 4, Parsers: `An implementation may set limits on the length and character contents of strings.` While the [Unicode Standard][] permits the mutation of the original JSON (i.e., substituting `U+FFFD` for ill-formed Unicode), [RFC 4627][] is silent on this issue. It is the authors opinion and interpretation that [RFC 4627][], section 3 &ndash; *Encoding*, `JSON text SHALL be encoded in Unicode.` implies that such mutations are not only permitted but MUST be expected by any strictly conforming [RFC 4627][] JSON implementation. The author feels obligated to note that this opinion and interpretation may not be shared by others and, in fact, may be a minority opinion and interpretation. You should be aware that any mutation of the original JSON may subtly alter its semantics and, as a result, may have security related implications for anything that consumes the final result.
It is important to note that JSONKit will not delete characters from the JSON being parsed as this is a [requirement specified by the Unicode Standard][Unicode_UTR36_Deleting]. Additional information can be found in the [Unicode Security FAQ][Unicode_Security_FAQ] and [Unicode Technical Report #36 - Unicode Security Consideration][Unicode_UTR36], in particular the section on [non-visual security][Unicode_UTR36_NonVisualSecurity].
* The [JSON specification][RFC 4627] does not specify the details or requirements for JSON String values, other than such strings must consist of Unicode code points, nor does it specify how errors should be handled. While JSONKit makes an effort (subject to the reasonable caveats above regarding Unicode) to preserve the parsed JSON String exactly, it can not guarantee that [`NSString`][NSString] will preserve the exact Unicode semantics of the original JSON String.
JSONKit does not perform any form of Unicode Normalization on the parsed JSON Strings, but can not make any guarantees that the [`NSString`][NSString] class will not perform Unicode Normalization on the parsed JSON String used to instantiate the [`NSString`][NSString] object. The [`NSString`][NSString] class may place additional restrictions or otherwise transform the JSON String in such a way so that the JSON String is not bijective with the instantiated [`NSString`][NSString] object. In other words, JSONKit can not guarantee that when you round trip a JSON String to a [`NSString`][NSString] and then back to a JSON String that the two JSON Strings will be exactly the same, even though in practice they are. For clarity, "exactly" in this case means bit for bit identical. JSONKit can not even guarantee that the two JSON Strings will be [Unicode equivalent][Unicode_equivalence], even though in practice they will be and would be the most likely cause for the two round tripped JSON Strings to no longer be bit for bit identical.
* JSONKit maps `true` and `false` to the [`CFBoolean`][CFBoolean] values [`kCFBooleanTrue`][kCFBooleanTrue] and [`kCFBooleanFalse`][kCFBooleanFalse], respectively. Conceptually, [`CFBoolean`][CFBoolean] values can be thought of, and treated as, [`NSNumber`][NSNumber] class objects. The benefit to using [`CFBoolean`][CFBoolean] is that `true` and `false` JSON values can be round trip deserialized and serialized without conversion or promotion to a [`NSNumber`][NSNumber] with a value of `0` or `1`.
* The [JSON specification][RFC 4627] does not specify the details or requirements for JSON Number values, nor does it specify how errors due to conversion should be handled. In general, JSONKit will not accept JSON that contains JSON Number values that it can not convert with out error or loss of precision.
For non-floating-point numbers (i.e., JSON Number values that do not include a `.` or `e|E`), JSONKit uses a 64-bit C primitive type internally, regardless of whether the target architecture is 32-bit or 64-bit. For unsigned values (i.e., those that do not begin with a `-`), this allows for values up to <code>2<sup>64</sup>-1</code> and up to <code>-2<sup>63</sup></code> for negative values. As a special case, the JSON Number `-0` is treated as a floating-point number since the underlying floating-point primitive type is capable of representing a negative zero, whereas the underlying twos-complement non-floating-point primitive type can not. JSON that contains Number values that exceed these limits will fail to parse and optionally return a [`NSError`][NSError] object. The functions [`strtoll()`][strtoll] and [`strtoull()`][strtoull] are used to perform the conversions.
The C `double` primitive type, or [IEEE 754 Double 64-bit floating-point][Double Precision], is used to represent floating-point JSON Number values. JSON that contains floating-point Number values that can not be represented as a `double` (i.e., due to over or underflow) will fail to parse and optionally return a [`NSError`][NSError] object. The function [`strtod()`][strtod] is used to perform the conversion. Note that the JSON standard does not allow for infinities or `NaN` (Not a Number). The conversion and manipulation of [floating-point values is non-trivial](http://www.validlab.com/goldberg/paper.pdf). Unfortunately, [RFC 4627][] is silent on how such details should be handled. You should not depend on or expect that when a floating-point value is round tripped that it will have the same textual representation or even compare equal. This is true even when JSONKit is used as both the parser and creator of the JSON, let alone when transferring JSON between different systems and implementations.
* For JSON Objects (or [`NSDictionary`][NSDictionary] in JSONKit nomenclature), [RFC 4627][] says `The names within an object SHOULD be unique` (note: `name` is a `key` in JSONKit nomenclature). At this time the JSONKit behavior is `undefined` for JSON that contains names within an object that are not unique. However, JSONKit currently tries to follow a "the last key / value pair parsed is the one chosen" policy. This behavior is not finalized and should not be depended on.
The previously covered limitations regarding JSON Strings have important consequences for JSON Objects since JSON Strings are used as the `key`. The [JSON specification][RFC 4627] does not specify the details or requirements for JSON Strings used as `keys` in JSON Objects, specifically what it means for two `keys` to compare equal. Unfortunately, because [RFC 4627][] states `JSON text SHALL be encoded in Unicode.`, this means that one must use the [Unicode Standard][] to interpret the JSON, and the [Unicode Standard][] allows for strings that are encoded with different Unicode Code Points to "compare equal". JSONKit uses [`NSString`][NSString] exclusively to manage the parsed JSON Strings. Because [`NSString`][NSString] uses [Unicode][Unicode Standard] as its basis, there exists the possibility that [`NSString`][NSString] may subtly and silently convert the Unicode Code Points contained in the original JSON String in to a [Unicode equivalent][Unicode_equivalence] string. Due to this, the JSONKit behavior for JSON Strings used as `keys` in JSON Objects that may be [Unicode equivalent][Unicode_equivalence] but not binary equivalent is `undefined`.
**See also:**<br />
&nbsp;&nbsp;&nbsp;&nbsp;[W3C - Requirements for String Identity Matching and String Indexing](http://www.w3.org/TR/charreq/#sec2)
### Objective-C To JSON Primitive Mapping Details
* When serializing, the top level container, and all of its children, are required to be *strictly* [invariant][wiki_invariant] during enumeration. This property is used to make certain optimizations, such as if a particular object has already been serialized, the result of the previous serialized `UTF8` string can be reused (i.e., the `UTF8` string of the previous serialization can simply be copied instead of performing all the serialization work again). While this is probably only of interest to those who are doing extraordinarily unusual things with the run-time or custom classes inheriting from the classes that JSONKit will serialize (i.e, a custom object whose value mutates each time it receives a message requesting its value for serialization), it also covers the case where any of the objects to be serialized are mutated during enumeration (i.e., mutated by another thread). The number of times JSONKit will request an objects value is non-deterministic, from a minimum of once up to the number of times it appears in the serialized JSON&ndash; therefore an object MUST NOT depend on receiving a message requesting its value each time it appears in the serialized output. The behavior is `undefined` if these requirements are violated.
* The objects to be serialized MUST be acyclic. If the objects to be serialized contain circular references the behavior is `undefined`. For example,
```objective-c
[arrayOne addObject:arrayTwo];
[arrayTwo addObject:arrayOne];
id json = [arrayOne JSONString];
```
&hellip; will result in `undefined` behavior.
* The contents of [`NSString`][NSString] objects are encoded as `UTF8` and added to the serialized JSON. JSONKit assumes that [`NSString`][NSString] produces well-formed `UTF8` Unicode and does no additional validation of the conversion. When `JKSerializeOptionEscapeUnicode` is enabled, JSONKit will encode Unicode code points that can be encoded as a single `UTF16` code unit as <code>\u<i>XXXX</i></code>, and will encode Unicode code points that require `UTF16` surrogate pairs as <code>\u<i>high</i>\u<i>low</i></code>. While JSONKit makes every effort to serialize the contents of a [`NSString`][NSString] object exactly, modulo any [RFC 4627][] requirements, the [`NSString`][NSString] class uses the [Unicode Standard][] as its basis for representing strings. You should be aware that the [Unicode Standard][] defines [string equivalence][Unicode_equivalence] in a such a way that two strings that compare equal are not required to be bit for bit identical. Therefore there exists the possibility that [`NSString`][NSString] may mutate a string in such a way that it is [Unicode equivalent][Unicode_equivalence], but not bit for bit identical with the original string.
* The [`NSDictionary`][NSDictionary] class allows for any object, which can be of any class, to be used as a `key`. JSON, however, only permits Strings to be used as `keys`. Therefore JSONKit will fail with an error if it encounters a [`NSDictionary`][NSDictionary] that contains keys that are not [`NSString`][NSString] objects during serialization. More specifically, the keys must return `YES` when sent [`-isKindOfClass:[NSString class]`][-isKindOfClass:].
* JSONKit will fail with an error if it encounters an object that is not a [`NSNull`][NSNull], [`NSNumber`][NSNumber], [`NSString`][NSString], [`NSArray`][NSArray], or [`NSDictionary`][NSDictionary] class object during serialization. More specifically, JSONKit will fail with an error if it encounters an object where [`-isKindOfClass:`][-isKindOfClass:] returns `NO` for all of the previously mentioned classes.
* JSON does not allow for Numbers that are <code>&plusmn;Infinity</code> or <code>&plusmn;NaN</code>. Therefore JSONKit will fail with an error if it encounters a [`NSNumber`][NSNumber] that contains such a value during serialization.
* Objects created with [`[NSNumber numberWithBool:YES]`][NSNumber_numberWithBool] and [`[NSNumber numberWithBool:NO]`][NSNumber_numberWithBool] will be mapped to the JSON values of `true` and `false`, respectively. More specifically, an object must have pointer equality with [`kCFBooleanTrue`][kCFBooleanTrue] or [`kCFBooleanFalse`][kCFBooleanFalse] (i.e., `if((id)object == (id)kCFBooleanTrue)`) in order to be mapped to the JSON values `true` and `false`.
* [`NSNumber`][NSNumber] objects that are not booleans (as defined above) are sent [`-objCType`][-objCType] to determine what type of C primitive type they represent. Those that respond with a type from the set `cislq` are treated as `long long`, those that respond with a type from the set `CISLQB` are treated as `unsigned long long`, and those that respond with a type from the set `fd` are treated as `double`. [`NSNumber`][NSNumber] objects that respond with a type not in the set of types mentioned will cause JSONKit to fail with an error.
More specifically, [`CFNumberGetValue(object, kCFNumberLongLongType, &longLong)`][CFNumberGetValue] is used to retrieve the value of both the signed and unsigned integer values, and the type reported by [`-objCType`][-objCType] is used to determine whether the result is signed or unsigned. For floating-point values, [`CFNumberGetValue`][CFNumberGetValue] is used to retrieve the value using [`kCFNumberDoubleType`][kCFNumberDoubleType] for the type argument.
Floating-point numbers are converted to their decimal representation using the [`printf`][printf] format conversion specifier `%.17g`. Theoretically this allows up to a `float`, or [IEEE 754 Single 32-bit floating-point][Single Precision], worth of precision to be represented. This means that for practical purposes, `double` values are converted to `float` values with the associated loss of precision. The [RFC 4627][] standard is silent on how floating-point numbers should be dealt with and the author has found that real world JSON implementations vary wildly in how they handle this issue. Furthermore, the `%g` format conversion specifier may convert floating-point values that can be exactly represented as an integer to a textual representation that does not include a `.` or `e`&ndash; essentially silently promoting a floating-point value to an integer value (i.e, `5.0` becomes `5`). Because of these and many other issues surrounding the conversion and manipulation of floating-point values, you should not expect or depend on floating point values to maintain their full precision, or when round tripped, to compare equal.
### Reporting Bugs
Please use the [github.com JSONKit Issue Tracker](https://github.com/johnezang/JSONKit/issues) to report bugs.
The author requests that you do not file a bug report with JSONKit regarding problems reported by the `clang` static analyzer unless you first manually verify that it is an actual, bona-fide problem with JSONKit and, if appropriate, is not "legal" C code as defined by the C99 language specification. If the `clang` static analyzer is reporting a problem with JSONKit that is not an actual, bona-fide problem and is perfectly legal code as defined by the C99 language specification, then the appropriate place to file a bug report or complaint is with the developers of the `clang` static analyzer.
### Important Details
* JSONKit is not designed to be used with the Mac OS X Garbage Collection. The behavior of JSONKit when compiled with `-fobjc-gc` is `undefined`. It is extremely unlikely that Mac OS X Garbage Collection will ever be supported.
* JSONKit is not designed to be used with [Objective-C Automatic Reference Counting (ARC)][ARC]. The behavior of JSONKit when compiled with `-fobjc-arc` is `undefined`. The behavior of JSONKit compiled without [ARC][] mixed with code that has been compiled with [ARC][] is normatively `undefined` since at this time no analysis has been done to understand if this configuration is safe to use. At this time, there are no plans to support [ARC][] in JSONKit. Although tenative, it is extremely unlikely that [ARC][] will ever be supported, for many of the same reasons that Mac OS X Garbage Collection is not supported.
* The JSON to be parsed by JSONKit MUST be encoded as Unicode. In the unlikely event you end up with JSON that is not encoded as Unicode, you must first convert the JSON to Unicode, preferably as `UTF8`. One way to accomplish this is with the [`NSString`][NSString] methods [`-initWithBytes:length:encoding:`][NSString_initWithBytes] and [`-initWithData:encoding:`][NSString_initWithData].
* Internally, the low level parsing engine uses `UTF8` exclusively. The `JSONDecoder` method `-objectWithData:` takes a [`NSData`][NSData] object as its argument and it is assumed that the raw bytes contained in the [`NSData`][NSData] is `UTF8` encoded, otherwise the behavior is `undefined`.
* It is not safe to use the same instantiated `JSONDecoder` object from multiple threads at the same time. If you wish to share a `JSONDecoder` between threads, you are responsible for adding mutex barriers to ensure that only one thread is decoding JSON using the shared `JSONDecoder` object at a time.
### Tips for speed
* Enable the `NS_BLOCK_ASSERTIONS` pre-processor flag. JSONKit makes heavy use of [`NSCParameterAssert()`][NSCParameterAssert] internally to ensure that various arguments, variables, and other state contains only legal and expected values. If an assertion check fails it causes a run time exception that will normally cause a program to terminate. These checks and assertions come with a price: they take time to execute and do not contribute to the work being performed. It is perfectly safe to enable `NS_BLOCK_ASSERTIONS` as JSONKit always performs checks that are required for correct operation. The checks performed with [`NSCParameterAssert()`][NSCParameterAssert] are completely optional and are meant to be used in "debug" builds where extra integrity checks are usually desired. While your mileage may vary, the author has found that adding `-DNS_BLOCK_ASSERTIONS` to an `-O2` optimization setting can generally result in an approximate <span style="white-space: nowrap;">7-12%</span> increase in performance.
* Since the very low level parsing engine works exclusively with `UTF8` byte streams, anything that is not already encoded as `UTF8` must first be converted to `UTF8`. While JSONKit provides additions to the [`NSString`][NSString] class which allows you to conveniently convert JSON contained in a [`NSString`][NSString], this convenience does come with a price. JSONKit must allocate an autoreleased [`NSMutableData`][NSMutableData] large enough to hold the strings `UTF8` conversion and then convert the string to `UTF8` before it can begin parsing. This takes both memory and time. Once the parsing has finished, JSONKit sets the autoreleased [`NSMutableData`][NSMutableData] length to `0`, which allows the [`NSMutableData`][NSMutableData] to release the memory. This helps to minimize the amount of memory that is in use but unavailable until the autorelease pool pops. Therefore, if speed and memory usage are a priority, you should avoid using the [`NSString`][NSString] convenience methods if possible.
* If you are receiving JSON data from a web server, and you are able to determine that the raw bytes returned by the web server is JSON encoded as `UTF8`, you should use the `JSONDecoder` method `-objectWithUTF8String:length:` which immediately begins parsing the pointers bytes. In practice, every JSONKit method that converts JSON to an Objective-C object eventually calls this method to perform the conversion.
* If you are using one of the various ways provided by the `NSURL` family of classes to receive JSON results from a web server, which typically return the results in the form of a [`NSData`][NSData] object, and you are able to determine that the raw bytes contained in the [`NSData`][NSData] are encoded as `UTF8`, then you should use either the `JSONDecoder` method `objectWithData:` or the [`NSData`][NSData] method `-objectFromJSONData`. If are going to be converting a lot of JSON, the better choice is to instantiate a `JSONDecoder` object once and use the same instantiated object to perform all your conversions. This has two benefits:
1. The [`NSData`][NSData] method `-objectFromJSONData` creates an autoreleased `JSONDecoder` object to perform the one time conversion. By instantiating a `JSONDecoder` object once and using the `objectWithData:` method repeatedly, you can avoid this overhead.
2. The instantiated object cache from the previous JSON conversion is reused. This can result in both better performance and a reduction in memory usage if the JSON your are converting is very similar. A typical example might be if you are converting JSON at periodic intervals that consists of real time status updates.
* On average, the <code>JSONData&hellip;</code> methods are nearly four times faster than the <code>JSONString&hellip;</code> methods when serializing a [`NSDictionary`][NSDictionary] or [`NSArray`][NSArray] to JSON. The difference in speed is due entirely to the instantiation overhead of [`NSString`][NSString].
* If at all possible, use [`NSData`][NSData] instead of [`NSString`][NSString] methods when processing JSON. This avoids the sometimes significant conversion overhead that [`NSString`][NSString] performs in order to provide an object oriented interface for its contents. For many uses, using [`NSString`][NSString] is not needed and results in wasted effort&ndash; for example, using JSONKit to serialize a [`NSDictionary`][NSDictionary] or [`NSArray`][NSArray] to a [`NSString`][NSString]. This [`NSString`][NSString] is then passed to a method that sends the JSON to a web server, and this invariably requires converting the [`NSString`][NSString] to [`NSData`][NSData] before it can be sent. In this case, serializing the collection object directly to [`NSData`][NSData] would avoid the unnecessary conversions to and from a [`NSString`][NSString] object.
### Parsing Interface
#### JSONDecoder Interface
The <code>objectWith&hellip;</code> methods return immutable collection objects and their respective <code>mutableObjectWith&hellip;</code> methods return mutable collection objects.
**Note:** The bytes contained in a [`NSData`][NSData] object ***MUST*** be `UTF8` encoded.
**Important:** Methods will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `parseOptionFlags` is not valid.
**Important:** `objectWithUTF8String:` and `mutableObjectWithUTF8String:` will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `string` is `NULL`.
**Important:** `objectWithData:` and `mutableObjectWithData:` will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `jsonData` is `NULL`.
```objective-c
+ (id)decoder;
+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (void)clearCache;
- (id)objectWithUTF8String:(const unsigned char *)string length:(size_t)length;
- (id)objectWithUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(size_t)length;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error;
- (id)objectWithData:(NSData *)jsonData;
- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
- (id)mutableObjectWithData:(NSData *)jsonData;
- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
```
#### NSString Interface
```objective-c
- (id)objectFromJSONString;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONString;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
```
#### NSData Interface
```objective-c
- (id)objectFromJSONData;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONData;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
```
#### JKParseOptionFlags
<table>
<tr><th>Parsing Option</th><th>Description</th></tr>
<tr><td valign="top"><code>JKParseOptionNone</code></td><td>This is the default if no other other parse option flags are specified, and the option used when a convenience method does not provide an argument for explicitly specifying the parse options to use. Synonymous with <code>JKParseOptionStrict</code>.</td></tr>
<tr><td valign="top"><code>JKParseOptionStrict</code></td><td>The JSON will be parsed in strict accordance with the <a href="http://tools.ietf.org/html/rfc4627">RFC 4627</a> specification.</td></tr>
<tr><td valign="top"><code>JKParseOptionComments</code></td><td>Allow C style <code>//</code> and <code>/* &hellip; */</code> comments in JSON. This is a fairly common extension to JSON, but JSON that contains C style comments is not strictly conforming JSON.</td></tr>
<tr><td valign="top"><code>JKParseOptionUnicodeNewlines</code></td><td>Allow Unicode recommended <code>(?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}])</code> newlines in JSON. The <a href="http://tools.ietf.org/html/rfc4627">JSON specification</a> only allows the newline characters <code>\r</code> and <code>\n</code>, but this option allows JSON that contains the <a href="http://en.wikipedia.org/wiki/Newline#Unicode">Unicode recommended newline characters</a> to be parsed. JSON that contains these additional newline characters is not strictly conforming JSON.</td></tr>
<tr><td valign="top"><code>JKParseOptionLooseUnicode</code></td><td>Normally the decoder will stop with an error at any malformed Unicode. This option allows JSON with malformed Unicode to be parsed without reporting an error. Any malformed Unicode is replaced with <code>\uFFFD</code>, or <code>REPLACEMENT CHARACTER</code>, as specified in <a href="http://www.unicode.org/versions/Unicode6.0.0/ch03.pdf">The Unicode 6.0 standard, Chapter 3</a>, section 3.9 <em>Unicode Encoding Forms</em>.</td></tr>
<tr><td valign="top"><code>JKParseOptionPermitTextAfterValidJSON</code></td><td>Normally, <code>non-white-space</code> that follows the JSON is interpreted as a parsing failure. This option allows for any trailing <code>non-white-space</code> to be ignored and not cause a parsing error.</td></tr>
</table>
### Serializing Interface
The serializing interface includes [`NSString`][NSString] convenience methods for those that need to serialize a single [`NSString`][NSString]. For those that need this functionality, the [`NSString`][NSString] additions are much more convenient than having to wrap a single [`NSString`][NSString] in a [`NSArray`][NSArray], which then requires stripping the unneeded `[`&hellip;`]` characters from the serialized JSON result. When serializing a single [`NSString`][NSString], you can control whether or not the serialized JSON result is surrounded by quotation marks using the `includeQuotes:` argument:
Example | Result | Argument
--------------|-------------------|--------------------
`a "test"...` | `"a \"test\"..."` | `includeQuotes:YES`
`a "test"...` | `a \"test\"...` | `includeQuotes:NO`
**Note:** The [`NSString`][NSString] methods that do not include a `includeQuotes:` argument behave as if invoked with `includeQuotes:YES`.
**Note:** The bytes contained in the returned [`NSData`][NSData] object are `UTF8` encoded.
#### NSArray and NSDictionary Interface
```objective-c
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
```
#### NSString Interface
```objective-c
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
```
#### JKSerializeOptionFlags
<table>
<tr><th>Serializing Option</th><th>Description</th></tr>
<tr><td valign="top"><code>JKSerializeOptionNone</code></td><td>This is the default if no other other serialize option flags are specified, and the option used when a convenience method does not provide an argument for explicitly specifying the serialize options to use.</td></tr>
<tr><td valign="top"><code>JKSerializeOptionPretty</code></td><td>Normally the serialized JSON does not include any unnecessary <code>white-space</code>. While this form is the most compact, the lack of any <code>white-space</code> means that it's something only another JSON parser could love. Enabling this option causes JSONKit to add additional <code>white-space</code> that makes it easier for people to read. Other than the extra <code>white-space</code>, the serialized JSON is identical to the JSON that would have been produced had this option not been enabled.</td></tr>
<tr><td valign="top"><code>JKSerializeOptionEscapeUnicode</code></td><td>When JSONKit encounters Unicode characters in <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html"><code>NSString</code></a> objects, the default behavior is to encode those Unicode characters as <code>UTF8</code>. This option causes JSONKit to encode those characters as <code>\u<i>XXXX</i></code>. For example,<br/><code>["w&isin;L&#10234;y(&#8739;y&#8739;&le;&#8739;w&#8739;)"]</code><br/>becomes:<br/><code>["w\u2208L\u27fa\u2203y(\u2223y\u2223\u2264\u2223w\u2223)"]</code></td></tr>
<tr><td valign="top"><code>JKSerializeOptionEscapeForwardSlashes</code></td><td>According to the <a href="http://tools.ietf.org/html/rfc4627">JSON specification</a>, the <code>/</code> (<code>U+002F</code>) character may be backslash escaped (i.e., <code>\/</code>), but it is not required. The default behavior of JSONKit is to <b><i>not</i></b> backslash escape the <code>/</code> character. Unfortunately, it was found some real world implementations of the <a href="http://weblogs.asp.net/bleroy/archive/2008/01/18/dates-and-json.aspx">ASP.NET Date Format</a> require the date to be <i>strictly</i> encoded as <code>\/Date(...)\/</code>, and the only way to achieve this is through the use of <code>JKSerializeOptionEscapeForwardSlashes</code>. See <a href="https://github.com/johnezang/JSONKit/issues/21">github issue #21</a> for more information.</td></tr>
</table>
[JSON]: http://www.json.org/
[RFC 4627]: http://tools.ietf.org/html/rfc4627
[RFC 2119]: http://tools.ietf.org/html/rfc2119
[Single Precision]: http://en.wikipedia.org/wiki/Single_precision_floating-point_format
[Double Precision]: http://en.wikipedia.org/wiki/Double_precision_floating-point_format
[wiki_invariant]: http://en.wikipedia.org/wiki/Invariant_(computer_science)
[ARC]: http://clang.llvm.org/docs/AutomaticReferenceCounting.html
[CFBoolean]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/index.html
[kCFBooleanTrue]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFBooleanTrue
[kCFBooleanFalse]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFBooleanFalse
[kCFNumberDoubleType]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFNumberRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFNumberDoubleType
[CFNumberGetValue]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFNumberRef/Reference/reference.html#//apple_ref/c/func/CFNumberGetValue
[Unicode Standard]: http://www.unicode.org/versions/Unicode6.0.0/
[Unicode Standard - Conformance]: http://www.unicode.org/versions/Unicode6.0.0/ch03.pdf
[Unicode_equivalence]: http://en.wikipedia.org/wiki/Unicode_equivalence
[UnicodeNewline]: http://en.wikipedia.org/wiki/Newline#Unicode
[Unicode_UTR36]: http://www.unicode.org/reports/tr36/
[Unicode_UTR36_NonVisualSecurity]: http://www.unicode.org/reports/tr36/#Canonical_Represenation
[Unicode_UTR36_Deleting]: http://www.unicode.org/reports/tr36/#Deletion_of_Noncharacters
[Unicode_Security_FAQ]: http://www.unicode.org/faq/security.html
[NSNull]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSNull_Class/index.html
[NSNumber]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/index.html
[NSNumber_numberWithBool]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Reference.html#//apple_ref/occ/clm/NSNumber/numberWithBool:
[NSString]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html
[NSString_initWithBytes]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/initWithBytes:length:encoding:
[NSString_initWithData]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/initWithData:encoding:
[NSString_UTF8String]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/UTF8String
[NSArray]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/index.html
[NSDictionary]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/index.html
[NSError]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/index.html
[NSData]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/index.html
[NSMutableData]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableData_Class/index.html
[NSInvalidArgumentException]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html#//apple_ref/doc/c_ref/NSInvalidArgumentException
[CFString]: http://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html
[NSCParameterAssert]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/macro/NSCParameterAssert
[-mutableCopy]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html%23//apple_ref/occ/instm/NSObject/mutableCopy
[-isKindOfClass:]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html%23//apple_ref/occ/intfm/NSObject/isKindOfClass:
[-objCType]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Reference.html#//apple_ref/occ/instm/NSNumber/objCType
[strtoll]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtoll.3.html
[strtod]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtod.3.html
[strtoull]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtoull.3.html
[getrusage]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/getrusage.2.html
[printf]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/printf.3.html
[NSJSONSerialization]: http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS}
OTHER_LDFLAGS = -ObjC -framework SystemConfiguration
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/JSONKit" "${PODS_ROOT}/BuildHeaders/Reachability"
PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/JSONKit" "${PODS_ROOT}/Headers/Reachability"
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>0983CE7C630A4595BB31F737</key>
<dict>
<key>children</key>
<array>
<string>AF757137E37D41A4A2EB630D</string>
<string>DD920C2C00444195BDE346CB</string>
<string>E3899BD0E3044CAF9C37C1C8</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>0C31F3CF8CCB424C983964AF</key>
<dict>
<key>fileRef</key>
<string>611D185BF13D4660BF733DCA</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>0D20137EBBF245E2B91D9170</key>
<dict>
<key>fileRef</key>
<string>58F23E57B9A845C6ABB58C29</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict>
<key>COMPILER_FLAGS</key>
<string>-fobjc-arc -DOS_OBJECT_USE_OBJC=0</string>
</dict>
</dict>
<key>165F9AE1F7C94DBDAEE04D9C</key>
<dict>
<key>children</key>
<array>
<string>611D185BF13D4660BF733DCA</string>
<string>58F23E57B9A845C6ABB58C29</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Reachability</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>20933AC1FC8746B9839CB103</key>
<dict>
<key>children</key>
<array>
<string>883449757312410E8C3924EA</string>
<string>165F9AE1F7C94DBDAEE04D9C</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>2DE123CAED384121B435A671</key>
<dict>
<key>children</key>
<array>
<string>0983CE7C630A4595BB31F737</string>
<string>44BA96265DF144E0AD5C1F72</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Targets Support Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>2E7F9198573A43A1AB5B882A</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>JSONKit.m</string>
<key>path</key>
<string>JSONKit/JSONKit.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>364EA48A7695478C93156020</key>
<dict>
<key>fileRef</key>
<string>44E2AB06D4CB45369F4FE1CE</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>44BA96265DF144E0AD5C1F72</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>PodsDummy_Pods.m</string>
<key>path</key>
<string>PodsDummy_Pods.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>44E2AB06D4CB45369F4FE1CE</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>JSONKit.h</string>
<key>path</key>
<string>JSONKit/JSONKit.h</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>58F23E57B9A845C6ABB58C29</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>Reachability.m</string>
<key>path</key>
<string>Reachability/Reachability.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>5E550BC5C85F4B18B782C782</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>611D185BF13D4660BF733DCA</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>Reachability.h</string>
<key>path</key>
<string>Reachability/Reachability.h</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>6A3BDA181F324096B364CD72</key>
<dict>
<key>attributes</key>
<dict>
<key>LastUpgradeCheck</key>
<string>0450</string>
</dict>
<key>buildConfigurationList</key>
<string>A0FD9B07B68E4C1286BA65E7</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>B1FCD6BF220940C0BA1277CE</string>
<key>productRefGroup</key>
<string>E0A7DB051AC442A1A8851AB7</string>
<key>projectReferences</key>
<array/>
<key>targets</key>
<array>
<string>8B4407ED0FE641D1B550464C</string>
</array>
</dict>
<key>6B0F6B46C29C4EFC91779099</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>71B2F0E3AAA94957828A6936</key>
<dict>
<key>children</key>
<array>
<string>7B568D3E86F74479AD2E14E4</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>779F93CEABEC4228B7C466E5</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>364EA48A7695478C93156020</string>
<string>0C31F3CF8CCB424C983964AF</string>
</array>
<key>isa</key>
<string>PBXHeadersBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>7B568D3E86F74479AD2E14E4</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>DEVELOPER_DIR</string>
</dict>
<key>883449757312410E8C3924EA</key>
<dict>
<key>children</key>
<array>
<string>44E2AB06D4CB45369F4FE1CE</string>
<string>2E7F9198573A43A1AB5B882A</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>JSONKit</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>8B2E989BA06A420DA7196E86</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>8B4407ED0FE641D1B550464C</key>
<dict>
<key>buildConfigurationList</key>
<string>C1ABDED7B2C5416CBE0E2B45</string>
<key>buildPhases</key>
<array>
<string>AA4CA4365CBD412BBEE49978</string>
<string>F5D7534C9B524F0FA3C245AB</string>
<string>779F93CEABEC4228B7C466E5</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>Pods</string>
<key>productName</key>
<string>Pods</string>
<key>productReference</key>
<string>6B0F6B46C29C4EFC91779099</string>
<key>productType</key>
<string>com.apple.product-type.library.static</string>
</dict>
<key>8EAC792AE5AB4D7FA7BDE0BB</key>
<dict>
<key>baseConfigurationReference</key>
<string>E3899BD0E3044CAF9C37C1C8</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>A0FD9B07B68E4C1286BA65E7</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>8B2E989BA06A420DA7196E86</string>
<string>5E550BC5C85F4B18B782C782</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>A30ECD3B8FD646658EDB9499</key>
<dict>
<key>baseConfigurationReference</key>
<string>E3899BD0E3044CAF9C37C1C8</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
<key>VALIDATE_PRODUCT</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>AA4CA4365CBD412BBEE49978</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>D13A06C258EF4BDA9FFAB6AA</string>
<string>0D20137EBBF245E2B91D9170</string>
<string>C0D4D8128F21403083EC3F5B</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>AF757137E37D41A4A2EB630D</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-resources.sh</string>
<key>path</key>
<string>Pods-resources.sh</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>B1FCD6BF220940C0BA1277CE</key>
<dict>
<key>children</key>
<array>
<string>E0A7DB051AC442A1A8851AB7</string>
<string>71B2F0E3AAA94957828A6936</string>
<string>20933AC1FC8746B9839CB103</string>
<string>2DE123CAED384121B435A671</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>C0D4D8128F21403083EC3F5B</key>
<dict>
<key>fileRef</key>
<string>44BA96265DF144E0AD5C1F72</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>C1ABDED7B2C5416CBE0E2B45</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>A30ECD3B8FD646658EDB9499</string>
<string>8EAC792AE5AB4D7FA7BDE0BB</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>D13A06C258EF4BDA9FFAB6AA</key>
<dict>
<key>fileRef</key>
<string>2E7F9198573A43A1AB5B882A</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict>
<key>COMPILER_FLAGS</key>
<string>-Wno-deprecated-objc-isa-usage -Wno-format</string>
</dict>
</dict>
<key>DD920C2C00444195BDE346CB</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-prefix.pch</string>
<key>path</key>
<string>Pods-prefix.pch</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>E0A7DB051AC442A1A8851AB7</key>
<dict>
<key>children</key>
<array>
<string>6B0F6B46C29C4EFC91779099</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E3899BD0E3044CAF9C37C1C8</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>ECA55F95AFF743A6B0A70FCC</key>
<dict>
<key>fileRef</key>
<string>7B568D3E86F74479AD2E14E4</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>F5D7534C9B524F0FA3C245AB</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>ECA55F95AFF743A6B0A70FCC</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
</dict>
<key>rootObject</key>
<string>6A3BDA181F324096B364CD72</string>
</dict>
</plist>
$ pod install --no-update --no-doc --verbose --no-color
Resolving dependencies of `./Podfile'
Finding added, modified or removed dependencies:
A JSONKit
- Reachability
Resolving dependencies for target `default' (iOS 6.0)
- Reachability (= 3.1.0)
- JSONKit (= 1.5pre)
Downloading dependencies
-> Installing JSONKit (1.5pre)
$ /usr/bin/git config core.bare
true
> Cloning git repo
$ /usr/bin/git rev-list --max-count=1 0aff3deb5e1bb2bbc88a83fd71c8ad5550185cce
0aff3deb5e1bb2bbc88a83fd71c8ad5550185cce
> Cloning to Pods folder
$ /usr/bin/git clone "CACHES_DIR/Git/de3e1c97c03ac13b29e7533beea2d2131589900f"
"ROOT/tmp/Pods/JSONKit"
Cloning into 'ROOT/tmp/Pods/JSONKit'...
done.
$ /usr/bin/git checkout -b activated-pod-commit 0aff3deb5e1bb2bbc88a83fd71c8ad5550185cce
> Using existing documentation
-> Using Reachability (3.1.0)
Generating support files
- Running pre install hooks
- Generating project
- Installing targets
- Generating xcconfig file at `./Pods/Pods.xcconfig'
- Generating prefix header at `./Pods/Pods-prefix.pch'
- Generating copy resources script at `./Pods/Pods-resources.sh'
- Running post install hooks
- Writing Xcode project file to `./Pods/Pods.xcodeproj'
- Writing lockfile in `./Podfile.lock'
platform :ios, '6.0'
pod "Reachability", "3.1.0"
pod "JSONKit", "1.5pre"
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
# Acknowledgements
This application makes use of the following third party libraries:
## Reachability
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Generated by CocoaPods - http://cocoapods.org
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</string>
<key>Title</key>
<string>Reachability</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#!/bin/sh
install_resource()
{
case $1 in
*.storyboard)
echo "ibtool --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 --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 --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 --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 "rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -rp "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*)
echo "cp -R ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
;;
esac
}
@interface PodsDummy_Pods : NSObject
@end
@implementation PodsDummy_Pods
@end
# Reachability
This is a drop-in replacement for Apples Reachability class. It is ARC compatible, uses the new GCD methods to notify of network interface changes.
In addition to the standard NSNotification it supports the use of Blocks for when the network becomes reachable and unreachable.
Finally you can specify wether or not a WWAN connection is considered "reachable".
## A Simple example
This sample uses Blocks to tell you when the interface state has changed. The blocks will be called on a BACKGROUND THREAD so you need to dispatch UI updates onto the main thread.
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// set the blocks
reach.reachableBlock = ^(Reachability*reach)
{
NSLog(@"REACHABLE!");
};
reach.unreachableBlock = ^(Reachability*reach)
{
NSLog(@"UNREACHABLE!");
};
// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];
## Another simple example
This sample will use NSNotifications to tell you when the interface has changed, they will be delivered on the MAIN THREAD so you *can* do UI updates from within the function.
In addition it asks the Reachability object to consider the WWAN (3G/EDGE/CDMA) as a non-reachable connection (you might use this if you are writing a video streaming app, for example, to save the users data plan).
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// tell the reachability that we DONT want to be reachable on 3G/EDGE/CDMA
reach.reachableOnWWAN = NO;
// here we set up a NSNotification observer. The Reachability that caused the notification
// is passed in the object parameter
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
[reach startNotifier]
\ No newline at end of file
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import "Reachability.h"
NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification";
@interface Reachability ()
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
#if NEEDS_DISPATCH_RETAIN_RELEASE
@property (nonatomic, assign) dispatch_queue_t reachabilitySerialQueue;
#else
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
#endif
@property (nonatomic, strong) id reachabilityObject;
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags;
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
@end
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
{
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
#if TARGET_OS_IPHONE
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
#else
'X',
#endif
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
}
//Start listening for reachability notifications on the current run loop
static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
#pragma unused (target)
#if __has_feature(objc_arc)
Reachability *reachability = ((__bridge Reachability*)info);
#else
Reachability *reachability = ((Reachability*)info);
#endif
// we probably dont need an autoreleasepool here as GCD docs state each queue has its own autorelease pool
// but what the heck eh?
@autoreleasepool
{
[reachability reachabilityChanged:flags];
}
}
@implementation Reachability
@synthesize reachabilityRef;
@synthesize reachabilitySerialQueue;
@synthesize reachableOnWWAN;
@synthesize reachableBlock;
@synthesize unreachableBlock;
@synthesize reachabilityObject;
#pragma mark - class constructor methods
+(Reachability*)reachabilityWithHostname:(NSString*)hostname
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress:&zeroAddress];
}
+(Reachability*)reachabilityForLocalWiFi
{
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
return [self reachabilityWithAddress:&localWifiAddress];
}
// initialization methods
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref
{
self = [super init];
if (self != nil)
{
self.reachableOnWWAN = YES;
self.reachabilityRef = ref;
}
return self;
}
-(void)dealloc
{
[self stopNotifier];
if(self.reachabilityRef)
{
CFRelease(self.reachabilityRef);
self.reachabilityRef = nil;
}
self.reachableBlock = nil;
self.unreachableBlock = nil;
#if !(__has_feature(objc_arc))
[super dealloc];
#endif
}
#pragma mark - notifier methods
// Notifier
// NOTE: this uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD
// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS.
// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want)
-(BOOL)startNotifier
{
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
// this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves
// woah
self.reachabilityObject = self;
// first we need to create a serial queue
// we allocate this once for the lifetime of the notifier
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
if(!self.reachabilitySerialQueue)
{
return NO;
}
#if __has_feature(objc_arc)
context.info = (__bridge void *)self;
#else
context.info = (void *)self;
#endif
if (!SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
#endif
//clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
// set it as our reachability queue which will retain the queue
if(!SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
#endif
//UH OH - FAILURE!
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// then clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
return YES;
}
-(void)stopNotifier
{
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// unregister target from the GCD serial dispatch queue
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
}
#pragma mark - reachability tests
// this is for the case where you flick the airplane mode
// you end up getting something like this:
//Reachability: WR ct-----
//Reachability: -- -------
//Reachability: WR ct-----
//Reachability: -- -------
// we treat this as 4 UNREACHABLE triggers - really apple should do better than this
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags
{
BOOL connectionUP = YES;
if(!(flags & kSCNetworkReachabilityFlagsReachable))
connectionUP = NO;
if( (flags & testcase) == testcase )
connectionUP = NO;
#if TARGET_OS_IPHONE
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
// we're on 3G
if(!self.reachableOnWWAN)
{
// we dont want to connect when on 3G
connectionUP = NO;
}
}
#endif
return connectionUP;
}
-(BOOL)isReachable
{
SCNetworkReachabilityFlags flags;
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
return NO;
return [self isReachableWithFlags:flags];
}
-(BOOL)isReachableViaWWAN
{
#if TARGET_OS_IPHONE
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're REACHABLE
if(flags & kSCNetworkReachabilityFlagsReachable)
{
// now, check we're on WWAN
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
return YES;
}
}
}
#endif
return NO;
}
-(BOOL)isReachableViaWiFi
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're reachable
if((flags & kSCNetworkReachabilityFlagsReachable))
{
#if TARGET_OS_IPHONE
// check we're NOT on WWAN
if((flags & kSCNetworkReachabilityFlagsIsWWAN))
{
return NO;
}
#endif
return YES;
}
}
return NO;
}
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired
{
return [self connectionRequired];
}
-(BOOL)connectionRequired
{
SCNetworkReachabilityFlags flags;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
}
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
}
return NO;
}
// Is user intervention required?
-(BOOL)isInterventionRequired
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
}
return NO;
}
#pragma mark - reachability status stuff
-(NetworkStatus)currentReachabilityStatus
{
if([self isReachable])
{
if([self isReachableViaWiFi])
return ReachableViaWiFi;
#if TARGET_OS_IPHONE
return ReachableViaWWAN;
#endif
}
return NotReachable;
}
-(SCNetworkReachabilityFlags)reachabilityFlags
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return flags;
}
return 0;
}
-(NSString*)currentReachabilityString
{
NetworkStatus temp = [self currentReachabilityStatus];
if(temp == reachableOnWWAN)
{
// updated for the fact we have CDMA phones now!
return NSLocalizedString(@"Cellular", @"");
}
if (temp == ReachableViaWiFi)
{
return NSLocalizedString(@"WiFi", @"");
}
return NSLocalizedString(@"No Connection", @"");
}
-(NSString*)currentReachabilityFlags
{
return reachabilityFlags([self reachabilityFlags]);
}
#pragma mark - callback function calls this method
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags
{
if([self isReachableWithFlags:flags])
{
if(self.reachableBlock)
{
self.reachableBlock(self);
}
}
else
{
if(self.unreachableBlock)
{
self.unreachableBlock(self);
}
}
// this makes sure the change notification happens on the MAIN THREAD
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification
object:self];
});
}
@end
Pod::Spec.new do |s|
s.name = 'Reachability'
s.version = '3.1.0'
s.license = 'BSD'
s.homepage = 'https://github.com/tonymillion/Reachability'
s.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
s.summary = 'ARC and GCD Compatible Reachability Class for iOS. Drop in replacement for Apple Reachability.'
s.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
s.source_files = 'Reachability.{h,m}'
s.framework = 'SystemConfiguration'
s.requires_arc = false
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>061523DA9D2646ACA1EF295C</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>0AEC166B36EA4BBAB35AEB94</key>
<dict>
<key>fileRef</key>
<string>061523DA9D2646ACA1EF295C</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>26E99B1E26B641169EE1B5F6</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array/>
<key>inputPaths</key>
<array/>
<key>isa</key>
<string>PBXShellScriptBuildPhase</string>
<key>name</key>
<string>Copy Pods Resources</string>
<key>outputPaths</key>
<array/>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
<key>shellPath</key>
<string>/bin/sh</string>
<key>shellScript</key>
<string>"${SRCROOT}/Pods/Pods-resources.sh"
</string>
<key>showEnvVarsInLog</key>
<string>1</string>
</dict>
<key>E575589216C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A416C5943000DC1500</string>
<string>E575589D16C5943000DC1500</string>
<string>E575589C16C5943000DC1500</string>
<string>EFF75FAF8D54497F8417E948</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589316C5943000DC1500</key>
<dict>
<key>attributes</key>
<dict>
<key>CLASSPREFIX</key>
<string>CP</string>
<key>LastUpgradeCheck</key>
<string>0460</string>
<key>ORGANIZATIONNAME</key>
<string>CocoaPods</string>
</dict>
<key>buildConfigurationList</key>
<string>E575589616C5943000DC1500</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>E575589216C5943000DC1500</string>
<key>productRefGroup</key>
<string>E575589C16C5943000DC1500</string>
<key>projectDirPath</key>
<string></string>
<key>projectReferences</key>
<array/>
<key>projectRoot</key>
<string></string>
<key>targets</key>
<array>
<string>E575589A16C5943000DC1500</string>
</array>
</dict>
<key>E575589616C5943000DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B616C5943100DC1500</string>
<string>E57558B716C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E575589716C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558AB16C5943000DC1500</string>
<string>E57558B216C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589816C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E575589F16C5943000DC1500</string>
<string>0AEC166B36EA4BBAB35AEB94</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589916C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558A916C5943000DC1500</string>
<string>E57558AF16C5943000DC1500</string>
<string>E57558B516C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXResourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589A16C5943000DC1500</key>
<dict>
<key>buildConfigurationList</key>
<string>E57558B816C5943100DC1500</string>
<key>buildPhases</key>
<array>
<string>E575589716C5943000DC1500</string>
<string>E575589816C5943000DC1500</string>
<string>E575589916C5943000DC1500</string>
<string>26E99B1E26B641169EE1B5F6</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>SampleApp</string>
<key>productName</key>
<string>SampleApp</string>
<key>productReference</key>
<string>E575589B16C5943000DC1500</string>
<key>productType</key>
<string>com.apple.product-type.application</string>
</dict>
<key>E575589B16C5943000DC1500</key>
<dict>
<key>explicitFileType</key>
<string>wrapper.application</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>SampleApp.app</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>E575589C16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589B16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589D16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589E16C5943000DC1500</string>
<string>E57558A016C5943000DC1500</string>
<string>061523DA9D2646ACA1EF295C</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589E16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Cocoa.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Cocoa.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E575589F16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E575589E16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558A016C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A116C5943000DC1500</string>
<string>E57558A216C5943000DC1500</string>
<string>E57558A316C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Other Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>AppKit.framework</string>
<key>path</key>
<string>System/Library/Frameworks/AppKit.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A216C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>CoreData.framework</string>
<key>path</key>
<string>System/Library/Frameworks/CoreData.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A316C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A416C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B016C5943000DC1500</string>
<string>E57558B116C5943000DC1500</string>
<string>E57558B316C5943100DC1500</string>
<string>E57558A516C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>path</key>
<string>SampleApp</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A516C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A616C5943000DC1500</string>
<string>E57558A716C5943000DC1500</string>
<string>E57558AA16C5943000DC1500</string>
<string>E57558AC16C5943000DC1500</string>
<string>E57558AD16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Supporting Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A616C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.xml</string>
<key>path</key>
<string>SampleApp-Info.plist</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A716C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A816C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A816C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.strings</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A916C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558A716C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AA16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>main.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AB16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AA16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AC16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>SampleApp-Prefix.pch</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AD16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558AE16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AE16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.rtf</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AF16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AD16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B016C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>CPAppDelegate.h</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>CPAppDelegate.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B216C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B116C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B316C5943100DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B416C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B416C5943100DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>file.xib</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B516C5943100DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B316C5943100DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B616C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>ONLY_ACTIVE_ARCH</key>
<string>YES</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558B716C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>E57558B816C5943100DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B916C5943100DC1500</string>
<string>E57558BA16C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E57558B916C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558BA16C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>EFF75FAF8D54497F8417E948</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods/Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
</dict>
<key>rootObject</key>
<string>E575589316C5943000DC1500</string>
</dict>
</plist>
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:Pods/Pods.xcodeproj'/><FileRef location='group:SampleApp.xcodeproj'/></Workspace>
\ No newline at end of file
ruby ROOT/bin/pod install --no-update --no-doc --verbose --no-color $ pod install --no-update --no-doc --verbose --no-color
Resolving dependencies of `./Podfile' Resolving dependencies of `./Podfile'
Resolving dependencies for target `default' (iOS 6.0) Resolving dependencies for target `default' (iOS 6.0)
......
PODS:
- Reachability (3.1.0)
DEPENDENCIES:
- Reachability (= 3.1.0)
SPEC CHECKSUMS:
Reachability: 1c8584c5f26fa776695efef95caaa50402c94cfb
COCOAPODS: 0.16.2
../../Reachability/Reachability.h
\ No newline at end of file
../../Reachability/Reachability.h
\ No newline at end of file
# Acknowledgements
This application makes use of the following third party libraries:
## Reachability
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Generated by CocoaPods - http://cocoapods.org
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</string>
<key>Title</key>
<string>Reachability</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#!/bin/sh
install_resource()
{
case $1 in
*.storyboard)
echo "ibtool --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 --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 --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 --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 "rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -rp "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*)
echo "cp -R ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
;;
esac
}
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS}
OTHER_LDFLAGS = -ObjC -framework SystemConfiguration
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/Reachability"
PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Reachability"
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>00DD1010F5394BEE81356529</key>
<dict>
<key>buildConfigurationList</key>
<string>1BBA212443F44EEEAAA66FB4</string>
<key>buildPhases</key>
<array>
<string>65481547B93A41FE976F2C13</string>
<string>AF08B32879FA47258A68C90A</string>
<string>BEB9361C2DAA45E6A56EF811</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>Pods</string>
<key>productName</key>
<string>Pods</string>
<key>productReference</key>
<string>EC29F5F6CFD84982A041AAB9</string>
<key>productType</key>
<string>com.apple.product-type.library.static</string>
</dict>
<key>127860E82AB2415994BF2184</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>1B2307C3A3C5404DAD0E56BE</key>
<dict>
<key>children</key>
<array>
<string>A6D1B279E4B642BDB2DC13A9</string>
<string>8FA7EF4ED8E345469F206120</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Reachability</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>1BBA212443F44EEEAAA66FB4</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>45972BDA680B4FAFBCD975D4</string>
<string>CBC7333C7477479EBD3F2D4C</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>2A4E667ADC4E472993861E35</key>
<dict>
<key>fileRef</key>
<string>B914A59A880A40B986D10310</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>2DCCB1EC59E74E46811EDF17</key>
<dict>
<key>children</key>
<array>
<string>1B2307C3A3C5404DAD0E56BE</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>45972BDA680B4FAFBCD975D4</key>
<dict>
<key>baseConfigurationReference</key>
<string>127860E82AB2415994BF2184</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
<key>VALIDATE_PRODUCT</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>5D69D9FCD15240F7B515DEF6</key>
<dict>
<key>children</key>
<array>
<string>EC29F5F6CFD84982A041AAB9</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>5F51CD6A6E8A4C93A3F2D543</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E13FBFA044E34F7FB7953B54</string>
<string>97E49F178121406DAB1891DB</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>65481547B93A41FE976F2C13</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>91867938D6264D9DBB1DF6C8</string>
<string>AD527E8190E44ACC9A90A95C</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>654E702666E745889FF3235F</key>
<dict>
<key>fileRef</key>
<string>A6D1B279E4B642BDB2DC13A9</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>798D2EC3C86948708A19A411</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-resources.sh</string>
<key>path</key>
<string>Pods-resources.sh</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>818B879319C3459E8F602FD0</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-prefix.pch</string>
<key>path</key>
<string>Pods-prefix.pch</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>85B947A905E04A3CA5EFD29E</key>
<dict>
<key>children</key>
<array>
<string>798D2EC3C86948708A19A411</string>
<string>818B879319C3459E8F602FD0</string>
<string>127860E82AB2415994BF2184</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>8FA7EF4ED8E345469F206120</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>Reachability.m</string>
<key>path</key>
<string>Reachability/Reachability.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>91867938D6264D9DBB1DF6C8</key>
<dict>
<key>fileRef</key>
<string>8FA7EF4ED8E345469F206120</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict>
<key>COMPILER_FLAGS</key>
<string>-fobjc-arc -DOS_OBJECT_USE_OBJC=0</string>
</dict>
</dict>
<key>97E49F178121406DAB1891DB</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>A6D1B279E4B642BDB2DC13A9</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>Reachability.h</string>
<key>path</key>
<string>Reachability/Reachability.h</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>AD527E8190E44ACC9A90A95C</key>
<dict>
<key>fileRef</key>
<string>CD04A367A1D9402D8B7E4C02</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>AF08B32879FA47258A68C90A</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>2A4E667ADC4E472993861E35</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>B914A59A880A40B986D10310</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>DEVELOPER_DIR</string>
</dict>
<key>BEB9361C2DAA45E6A56EF811</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>654E702666E745889FF3235F</string>
</array>
<key>isa</key>
<string>PBXHeadersBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>CBC7333C7477479EBD3F2D4C</key>
<dict>
<key>baseConfigurationReference</key>
<string>127860E82AB2415994BF2184</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>CD04A367A1D9402D8B7E4C02</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>PodsDummy_Pods.m</string>
<key>path</key>
<string>PodsDummy_Pods.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>DF0141F81653478BBB7C39C2</key>
<dict>
<key>children</key>
<array>
<string>85B947A905E04A3CA5EFD29E</string>
<string>CD04A367A1D9402D8B7E4C02</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Targets Support Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E13FBFA044E34F7FB7953B54</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>E1D71DCF7E1540FB8F6E32B9</key>
<dict>
<key>children</key>
<array>
<string>5D69D9FCD15240F7B515DEF6</string>
<string>F61D99441BC849739E767F95</string>
<string>2DCCB1EC59E74E46811EDF17</string>
<string>DF0141F81653478BBB7C39C2</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>EBA2375641584DB19A8FAB21</key>
<dict>
<key>attributes</key>
<dict>
<key>LastUpgradeCheck</key>
<string>0450</string>
</dict>
<key>buildConfigurationList</key>
<string>5F51CD6A6E8A4C93A3F2D543</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>E1D71DCF7E1540FB8F6E32B9</string>
<key>productRefGroup</key>
<string>5D69D9FCD15240F7B515DEF6</string>
<key>projectReferences</key>
<array/>
<key>targets</key>
<array>
<string>00DD1010F5394BEE81356529</string>
</array>
</dict>
<key>EC29F5F6CFD84982A041AAB9</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>F61D99441BC849739E767F95</key>
<dict>
<key>children</key>
<array>
<string>B914A59A880A40B986D10310</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
</dict>
<key>rootObject</key>
<string>EBA2375641584DB19A8FAB21</string>
</dict>
</plist>
@interface PodsDummy_Pods : NSObject
@end
@implementation PodsDummy_Pods
@end
# Reachability
This is a drop-in replacement for Apples Reachability class. It is ARC compatible, uses the new GCD methods to notify of network interface changes.
In addition to the standard NSNotification it supports the use of Blocks for when the network becomes reachable and unreachable.
Finally you can specify wether or not a WWAN connection is considered "reachable".
## A Simple example
This sample uses Blocks to tell you when the interface state has changed. The blocks will be called on a BACKGROUND THREAD so you need to dispatch UI updates onto the main thread.
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// set the blocks
reach.reachableBlock = ^(Reachability*reach)
{
NSLog(@"REACHABLE!");
};
reach.unreachableBlock = ^(Reachability*reach)
{
NSLog(@"UNREACHABLE!");
};
// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];
## Another simple example
This sample will use NSNotifications to tell you when the interface has changed, they will be delivered on the MAIN THREAD so you *can* do UI updates from within the function.
In addition it asks the Reachability object to consider the WWAN (3G/EDGE/CDMA) as a non-reachable connection (you might use this if you are writing a video streaming app, for example, to save the users data plan).
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// tell the reachability that we DONT want to be reachable on 3G/EDGE/CDMA
reach.reachableOnWWAN = NO;
// here we set up a NSNotification observer. The Reachability that caused the notification
// is passed in the object parameter
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
[reach startNotifier]
\ No newline at end of file
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import "Reachability.h"
NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification";
@interface Reachability ()
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
#if NEEDS_DISPATCH_RETAIN_RELEASE
@property (nonatomic, assign) dispatch_queue_t reachabilitySerialQueue;
#else
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
#endif
@property (nonatomic, strong) id reachabilityObject;
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags;
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
@end
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
{
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
#if TARGET_OS_IPHONE
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
#else
'X',
#endif
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
}
//Start listening for reachability notifications on the current run loop
static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
#pragma unused (target)
#if __has_feature(objc_arc)
Reachability *reachability = ((__bridge Reachability*)info);
#else
Reachability *reachability = ((Reachability*)info);
#endif
// we probably dont need an autoreleasepool here as GCD docs state each queue has its own autorelease pool
// but what the heck eh?
@autoreleasepool
{
[reachability reachabilityChanged:flags];
}
}
@implementation Reachability
@synthesize reachabilityRef;
@synthesize reachabilitySerialQueue;
@synthesize reachableOnWWAN;
@synthesize reachableBlock;
@synthesize unreachableBlock;
@synthesize reachabilityObject;
#pragma mark - class constructor methods
+(Reachability*)reachabilityWithHostname:(NSString*)hostname
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress:&zeroAddress];
}
+(Reachability*)reachabilityForLocalWiFi
{
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
return [self reachabilityWithAddress:&localWifiAddress];
}
// initialization methods
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref
{
self = [super init];
if (self != nil)
{
self.reachableOnWWAN = YES;
self.reachabilityRef = ref;
}
return self;
}
-(void)dealloc
{
[self stopNotifier];
if(self.reachabilityRef)
{
CFRelease(self.reachabilityRef);
self.reachabilityRef = nil;
}
self.reachableBlock = nil;
self.unreachableBlock = nil;
#if !(__has_feature(objc_arc))
[super dealloc];
#endif
}
#pragma mark - notifier methods
// Notifier
// NOTE: this uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD
// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS.
// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want)
-(BOOL)startNotifier
{
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
// this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves
// woah
self.reachabilityObject = self;
// first we need to create a serial queue
// we allocate this once for the lifetime of the notifier
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
if(!self.reachabilitySerialQueue)
{
return NO;
}
#if __has_feature(objc_arc)
context.info = (__bridge void *)self;
#else
context.info = (void *)self;
#endif
if (!SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
#endif
//clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
// set it as our reachability queue which will retain the queue
if(!SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
#endif
//UH OH - FAILURE!
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// then clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
return YES;
}
-(void)stopNotifier
{
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// unregister target from the GCD serial dispatch queue
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
}
#pragma mark - reachability tests
// this is for the case where you flick the airplane mode
// you end up getting something like this:
//Reachability: WR ct-----
//Reachability: -- -------
//Reachability: WR ct-----
//Reachability: -- -------
// we treat this as 4 UNREACHABLE triggers - really apple should do better than this
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags
{
BOOL connectionUP = YES;
if(!(flags & kSCNetworkReachabilityFlagsReachable))
connectionUP = NO;
if( (flags & testcase) == testcase )
connectionUP = NO;
#if TARGET_OS_IPHONE
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
// we're on 3G
if(!self.reachableOnWWAN)
{
// we dont want to connect when on 3G
connectionUP = NO;
}
}
#endif
return connectionUP;
}
-(BOOL)isReachable
{
SCNetworkReachabilityFlags flags;
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
return NO;
return [self isReachableWithFlags:flags];
}
-(BOOL)isReachableViaWWAN
{
#if TARGET_OS_IPHONE
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're REACHABLE
if(flags & kSCNetworkReachabilityFlagsReachable)
{
// now, check we're on WWAN
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
return YES;
}
}
}
#endif
return NO;
}
-(BOOL)isReachableViaWiFi
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're reachable
if((flags & kSCNetworkReachabilityFlagsReachable))
{
#if TARGET_OS_IPHONE
// check we're NOT on WWAN
if((flags & kSCNetworkReachabilityFlagsIsWWAN))
{
return NO;
}
#endif
return YES;
}
}
return NO;
}
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired
{
return [self connectionRequired];
}
-(BOOL)connectionRequired
{
SCNetworkReachabilityFlags flags;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
}
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
}
return NO;
}
// Is user intervention required?
-(BOOL)isInterventionRequired
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
}
return NO;
}
#pragma mark - reachability status stuff
-(NetworkStatus)currentReachabilityStatus
{
if([self isReachable])
{
if([self isReachableViaWiFi])
return ReachableViaWiFi;
#if TARGET_OS_IPHONE
return ReachableViaWWAN;
#endif
}
return NotReachable;
}
-(SCNetworkReachabilityFlags)reachabilityFlags
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return flags;
}
return 0;
}
-(NSString*)currentReachabilityString
{
NetworkStatus temp = [self currentReachabilityStatus];
if(temp == reachableOnWWAN)
{
// updated for the fact we have CDMA phones now!
return NSLocalizedString(@"Cellular", @"");
}
if (temp == ReachableViaWiFi)
{
return NSLocalizedString(@"WiFi", @"");
}
return NSLocalizedString(@"No Connection", @"");
}
-(NSString*)currentReachabilityFlags
{
return reachabilityFlags([self reachabilityFlags]);
}
#pragma mark - callback function calls this method
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags
{
if([self isReachableWithFlags:flags])
{
if(self.reachableBlock)
{
self.reachableBlock(self);
}
}
else
{
if(self.unreachableBlock)
{
self.unreachableBlock(self);
}
}
// this makes sure the change notification happens on the MAIN THREAD
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification
object:self];
});
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>061523DA9D2646ACA1EF295C</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>0AEC166B36EA4BBAB35AEB94</key>
<dict>
<key>fileRef</key>
<string>061523DA9D2646ACA1EF295C</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>26E99B1E26B641169EE1B5F6</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array/>
<key>inputPaths</key>
<array/>
<key>isa</key>
<string>PBXShellScriptBuildPhase</string>
<key>name</key>
<string>Copy Pods Resources</string>
<key>outputPaths</key>
<array/>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
<key>shellPath</key>
<string>/bin/sh</string>
<key>shellScript</key>
<string>"${SRCROOT}/Pods/Pods-resources.sh"
</string>
<key>showEnvVarsInLog</key>
<string>1</string>
</dict>
<key>E575589216C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A416C5943000DC1500</string>
<string>E575589D16C5943000DC1500</string>
<string>E575589C16C5943000DC1500</string>
<string>EFF75FAF8D54497F8417E948</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589316C5943000DC1500</key>
<dict>
<key>attributes</key>
<dict>
<key>CLASSPREFIX</key>
<string>CP</string>
<key>LastUpgradeCheck</key>
<string>0460</string>
<key>ORGANIZATIONNAME</key>
<string>CocoaPods</string>
</dict>
<key>buildConfigurationList</key>
<string>E575589616C5943000DC1500</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>E575589216C5943000DC1500</string>
<key>productRefGroup</key>
<string>E575589C16C5943000DC1500</string>
<key>projectDirPath</key>
<string></string>
<key>projectReferences</key>
<array/>
<key>projectRoot</key>
<string></string>
<key>targets</key>
<array>
<string>E575589A16C5943000DC1500</string>
</array>
</dict>
<key>E575589616C5943000DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B616C5943100DC1500</string>
<string>E57558B716C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E575589716C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558AB16C5943000DC1500</string>
<string>E57558B216C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589816C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E575589F16C5943000DC1500</string>
<string>0AEC166B36EA4BBAB35AEB94</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589916C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558A916C5943000DC1500</string>
<string>E57558AF16C5943000DC1500</string>
<string>E57558B516C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXResourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589A16C5943000DC1500</key>
<dict>
<key>buildConfigurationList</key>
<string>E57558B816C5943100DC1500</string>
<key>buildPhases</key>
<array>
<string>E575589716C5943000DC1500</string>
<string>E575589816C5943000DC1500</string>
<string>E575589916C5943000DC1500</string>
<string>26E99B1E26B641169EE1B5F6</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>SampleApp</string>
<key>productName</key>
<string>SampleApp</string>
<key>productReference</key>
<string>E575589B16C5943000DC1500</string>
<key>productType</key>
<string>com.apple.product-type.application</string>
</dict>
<key>E575589B16C5943000DC1500</key>
<dict>
<key>explicitFileType</key>
<string>wrapper.application</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>SampleApp.app</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>E575589C16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589B16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589D16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589E16C5943000DC1500</string>
<string>E57558A016C5943000DC1500</string>
<string>061523DA9D2646ACA1EF295C</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589E16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Cocoa.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Cocoa.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E575589F16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E575589E16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558A016C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A116C5943000DC1500</string>
<string>E57558A216C5943000DC1500</string>
<string>E57558A316C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Other Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>AppKit.framework</string>
<key>path</key>
<string>System/Library/Frameworks/AppKit.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A216C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>CoreData.framework</string>
<key>path</key>
<string>System/Library/Frameworks/CoreData.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A316C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A416C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B016C5943000DC1500</string>
<string>E57558B116C5943000DC1500</string>
<string>E57558B316C5943100DC1500</string>
<string>E57558A516C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>path</key>
<string>SampleApp</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A516C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A616C5943000DC1500</string>
<string>E57558A716C5943000DC1500</string>
<string>E57558AA16C5943000DC1500</string>
<string>E57558AC16C5943000DC1500</string>
<string>E57558AD16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Supporting Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A616C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.xml</string>
<key>path</key>
<string>SampleApp-Info.plist</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A716C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A816C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A816C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.strings</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A916C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558A716C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AA16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>main.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AB16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AA16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AC16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>SampleApp-Prefix.pch</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AD16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558AE16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AE16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.rtf</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AF16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AD16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B016C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>CPAppDelegate.h</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>CPAppDelegate.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B216C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B116C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B316C5943100DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B416C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B416C5943100DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>file.xib</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B516C5943100DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B316C5943100DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B616C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>ONLY_ACTIVE_ARCH</key>
<string>YES</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558B716C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>E57558B816C5943100DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B916C5943100DC1500</string>
<string>E57558BA16C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E57558B916C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558BA16C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>EFF75FAF8D54497F8417E948</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods/Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
</dict>
<key>rootObject</key>
<string>E575589316C5943000DC1500</string>
</dict>
</plist>
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:Pods/Pods.xcodeproj'/><FileRef location='group:SampleApp.xcodeproj'/></Workspace>
\ No newline at end of file
$ pod install --no-update --no-doc --verbose --no-color
Resolving dependencies of `./Podfile'
Resolving dependencies for target `default' (iOS 6.0)
- Reachability (= 3.1.0)
Downloading dependencies
-> Installing Reachability (3.1.0)
$ /usr/bin/git config core.bare
true
> Cloning git repo
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/Git/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git fetch origin tags/v3.1.0
$ /usr/bin/git reset --hard FETCH_HEAD
HEAD is now at f7176f4 updated podspec
$ /usr/bin/git checkout -b activated-pod-commit
> Using existing documentation
Generating support files
- Running pre install hooks
- Generating project
- Installing targets
- Generating xcconfig file at `./Pods/Pods.xcconfig'
- Generating prefix header at `./Pods/Pods-prefix.pch'
- Generating copy resources script at `./Pods/Pods-resources.sh'
- Running post install hooks
- Writing Xcode project file to `./Pods/Pods.xcodeproj'
- Writing lockfile in `./Podfile.lock'
[!] From now on use `SampleApp.xcworkspace'.
Integrating `libPods.a' into target `SampleApp' of Xcode project `./SampleApp.xcodeproj'.
platform :ios, '6.0'
pod "Reachability", "3.1.0"
\ No newline at end of file
PODS:
- Reachability (3.1.0)
DEPENDENCIES:
- Reachability (= 3.1.0)
SPEC CHECKSUMS:
Reachability: 1c8584c5f26fa776695efef95caaa50402c94cfb
COCOAPODS: 0.16.2
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
# Acknowledgements
This application makes use of the following third party libraries:
## Reachability
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Generated by CocoaPods - http://cocoapods.org
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</string>
<key>Title</key>
<string>Reachability</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#!/bin/sh
install_resource()
{
case $1 in
*.storyboard)
echo "ibtool --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 --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 --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 --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 "rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -rp "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*)
echo "cp -R ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
;;
esac
}
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS}
OTHER_LDFLAGS = -ObjC -framework SystemConfiguration
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/Reachability"
PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Reachability"
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>00DD1010F5394BEE81356529</key>
<dict>
<key>buildConfigurationList</key>
<string>1BBA212443F44EEEAAA66FB4</string>
<key>buildPhases</key>
<array>
<string>65481547B93A41FE976F2C13</string>
<string>AF08B32879FA47258A68C90A</string>
<string>BEB9361C2DAA45E6A56EF811</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>Pods</string>
<key>productName</key>
<string>Pods</string>
<key>productReference</key>
<string>EC29F5F6CFD84982A041AAB9</string>
<key>productType</key>
<string>com.apple.product-type.library.static</string>
</dict>
<key>127860E82AB2415994BF2184</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>1B2307C3A3C5404DAD0E56BE</key>
<dict>
<key>children</key>
<array>
<string>A6D1B279E4B642BDB2DC13A9</string>
<string>8FA7EF4ED8E345469F206120</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Reachability</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>1BBA212443F44EEEAAA66FB4</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>45972BDA680B4FAFBCD975D4</string>
<string>CBC7333C7477479EBD3F2D4C</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>2A4E667ADC4E472993861E35</key>
<dict>
<key>fileRef</key>
<string>B914A59A880A40B986D10310</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>2DCCB1EC59E74E46811EDF17</key>
<dict>
<key>children</key>
<array>
<string>1B2307C3A3C5404DAD0E56BE</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>45972BDA680B4FAFBCD975D4</key>
<dict>
<key>baseConfigurationReference</key>
<string>127860E82AB2415994BF2184</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
<key>VALIDATE_PRODUCT</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>5D69D9FCD15240F7B515DEF6</key>
<dict>
<key>children</key>
<array>
<string>EC29F5F6CFD84982A041AAB9</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>5F51CD6A6E8A4C93A3F2D543</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E13FBFA044E34F7FB7953B54</string>
<string>97E49F178121406DAB1891DB</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>65481547B93A41FE976F2C13</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>91867938D6264D9DBB1DF6C8</string>
<string>AD527E8190E44ACC9A90A95C</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>654E702666E745889FF3235F</key>
<dict>
<key>fileRef</key>
<string>A6D1B279E4B642BDB2DC13A9</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>798D2EC3C86948708A19A411</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-resources.sh</string>
<key>path</key>
<string>Pods-resources.sh</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>818B879319C3459E8F602FD0</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-prefix.pch</string>
<key>path</key>
<string>Pods-prefix.pch</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>85B947A905E04A3CA5EFD29E</key>
<dict>
<key>children</key>
<array>
<string>798D2EC3C86948708A19A411</string>
<string>818B879319C3459E8F602FD0</string>
<string>127860E82AB2415994BF2184</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>8FA7EF4ED8E345469F206120</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>Reachability.m</string>
<key>path</key>
<string>Reachability/Reachability.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>91867938D6264D9DBB1DF6C8</key>
<dict>
<key>fileRef</key>
<string>8FA7EF4ED8E345469F206120</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict>
<key>COMPILER_FLAGS</key>
<string>-fobjc-arc -DOS_OBJECT_USE_OBJC=0</string>
</dict>
</dict>
<key>97E49F178121406DAB1891DB</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>A6D1B279E4B642BDB2DC13A9</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>Reachability.h</string>
<key>path</key>
<string>Reachability/Reachability.h</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>AD527E8190E44ACC9A90A95C</key>
<dict>
<key>fileRef</key>
<string>CD04A367A1D9402D8B7E4C02</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>AF08B32879FA47258A68C90A</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>2A4E667ADC4E472993861E35</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>B914A59A880A40B986D10310</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>DEVELOPER_DIR</string>
</dict>
<key>BEB9361C2DAA45E6A56EF811</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>654E702666E745889FF3235F</string>
</array>
<key>isa</key>
<string>PBXHeadersBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>CBC7333C7477479EBD3F2D4C</key>
<dict>
<key>baseConfigurationReference</key>
<string>127860E82AB2415994BF2184</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>CD04A367A1D9402D8B7E4C02</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>PodsDummy_Pods.m</string>
<key>path</key>
<string>PodsDummy_Pods.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>DF0141F81653478BBB7C39C2</key>
<dict>
<key>children</key>
<array>
<string>85B947A905E04A3CA5EFD29E</string>
<string>CD04A367A1D9402D8B7E4C02</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Targets Support Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E13FBFA044E34F7FB7953B54</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>E1D71DCF7E1540FB8F6E32B9</key>
<dict>
<key>children</key>
<array>
<string>5D69D9FCD15240F7B515DEF6</string>
<string>F61D99441BC849739E767F95</string>
<string>2DCCB1EC59E74E46811EDF17</string>
<string>DF0141F81653478BBB7C39C2</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>EBA2375641584DB19A8FAB21</key>
<dict>
<key>attributes</key>
<dict>
<key>LastUpgradeCheck</key>
<string>0450</string>
</dict>
<key>buildConfigurationList</key>
<string>5F51CD6A6E8A4C93A3F2D543</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>E1D71DCF7E1540FB8F6E32B9</string>
<key>productRefGroup</key>
<string>5D69D9FCD15240F7B515DEF6</string>
<key>projectReferences</key>
<array/>
<key>targets</key>
<array>
<string>00DD1010F5394BEE81356529</string>
</array>
</dict>
<key>EC29F5F6CFD84982A041AAB9</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>F61D99441BC849739E767F95</key>
<dict>
<key>children</key>
<array>
<string>B914A59A880A40B986D10310</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
</dict>
<key>rootObject</key>
<string>EBA2375641584DB19A8FAB21</string>
</dict>
</plist>
@interface PodsDummy_Pods : NSObject
@end
@implementation PodsDummy_Pods
@end
# Reachability
This is a drop-in replacement for Apples Reachability class. It is ARC compatible, uses the new GCD methods to notify of network interface changes.
In addition to the standard NSNotification it supports the use of Blocks for when the network becomes reachable and unreachable.
Finally you can specify wether or not a WWAN connection is considered "reachable".
## A Simple example
This sample uses Blocks to tell you when the interface state has changed. The blocks will be called on a BACKGROUND THREAD so you need to dispatch UI updates onto the main thread.
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// set the blocks
reach.reachableBlock = ^(Reachability*reach)
{
NSLog(@"REACHABLE!");
};
reach.unreachableBlock = ^(Reachability*reach)
{
NSLog(@"UNREACHABLE!");
};
// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];
## Another simple example
This sample will use NSNotifications to tell you when the interface has changed, they will be delivered on the MAIN THREAD so you *can* do UI updates from within the function.
In addition it asks the Reachability object to consider the WWAN (3G/EDGE/CDMA) as a non-reachable connection (you might use this if you are writing a video streaming app, for example, to save the users data plan).
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// tell the reachability that we DONT want to be reachable on 3G/EDGE/CDMA
reach.reachableOnWWAN = NO;
// here we set up a NSNotification observer. The Reachability that caused the notification
// is passed in the object parameter
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
[reach startNotifier]
\ No newline at end of file
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import "Reachability.h"
NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification";
@interface Reachability ()
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
#if NEEDS_DISPATCH_RETAIN_RELEASE
@property (nonatomic, assign) dispatch_queue_t reachabilitySerialQueue;
#else
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
#endif
@property (nonatomic, strong) id reachabilityObject;
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags;
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
@end
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
{
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
#if TARGET_OS_IPHONE
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
#else
'X',
#endif
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
}
//Start listening for reachability notifications on the current run loop
static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
#pragma unused (target)
#if __has_feature(objc_arc)
Reachability *reachability = ((__bridge Reachability*)info);
#else
Reachability *reachability = ((Reachability*)info);
#endif
// we probably dont need an autoreleasepool here as GCD docs state each queue has its own autorelease pool
// but what the heck eh?
@autoreleasepool
{
[reachability reachabilityChanged:flags];
}
}
@implementation Reachability
@synthesize reachabilityRef;
@synthesize reachabilitySerialQueue;
@synthesize reachableOnWWAN;
@synthesize reachableBlock;
@synthesize unreachableBlock;
@synthesize reachabilityObject;
#pragma mark - class constructor methods
+(Reachability*)reachabilityWithHostname:(NSString*)hostname
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress:&zeroAddress];
}
+(Reachability*)reachabilityForLocalWiFi
{
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
return [self reachabilityWithAddress:&localWifiAddress];
}
// initialization methods
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref
{
self = [super init];
if (self != nil)
{
self.reachableOnWWAN = YES;
self.reachabilityRef = ref;
}
return self;
}
-(void)dealloc
{
[self stopNotifier];
if(self.reachabilityRef)
{
CFRelease(self.reachabilityRef);
self.reachabilityRef = nil;
}
self.reachableBlock = nil;
self.unreachableBlock = nil;
#if !(__has_feature(objc_arc))
[super dealloc];
#endif
}
#pragma mark - notifier methods
// Notifier
// NOTE: this uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD
// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS.
// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want)
-(BOOL)startNotifier
{
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
// this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves
// woah
self.reachabilityObject = self;
// first we need to create a serial queue
// we allocate this once for the lifetime of the notifier
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
if(!self.reachabilitySerialQueue)
{
return NO;
}
#if __has_feature(objc_arc)
context.info = (__bridge void *)self;
#else
context.info = (void *)self;
#endif
if (!SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
#endif
//clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
// set it as our reachability queue which will retain the queue
if(!SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
#endif
//UH OH - FAILURE!
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// then clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
return YES;
}
-(void)stopNotifier
{
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// unregister target from the GCD serial dispatch queue
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
}
#pragma mark - reachability tests
// this is for the case where you flick the airplane mode
// you end up getting something like this:
//Reachability: WR ct-----
//Reachability: -- -------
//Reachability: WR ct-----
//Reachability: -- -------
// we treat this as 4 UNREACHABLE triggers - really apple should do better than this
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags
{
BOOL connectionUP = YES;
if(!(flags & kSCNetworkReachabilityFlagsReachable))
connectionUP = NO;
if( (flags & testcase) == testcase )
connectionUP = NO;
#if TARGET_OS_IPHONE
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
// we're on 3G
if(!self.reachableOnWWAN)
{
// we dont want to connect when on 3G
connectionUP = NO;
}
}
#endif
return connectionUP;
}
-(BOOL)isReachable
{
SCNetworkReachabilityFlags flags;
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
return NO;
return [self isReachableWithFlags:flags];
}
-(BOOL)isReachableViaWWAN
{
#if TARGET_OS_IPHONE
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're REACHABLE
if(flags & kSCNetworkReachabilityFlagsReachable)
{
// now, check we're on WWAN
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
return YES;
}
}
}
#endif
return NO;
}
-(BOOL)isReachableViaWiFi
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're reachable
if((flags & kSCNetworkReachabilityFlagsReachable))
{
#if TARGET_OS_IPHONE
// check we're NOT on WWAN
if((flags & kSCNetworkReachabilityFlagsIsWWAN))
{
return NO;
}
#endif
return YES;
}
}
return NO;
}
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired
{
return [self connectionRequired];
}
-(BOOL)connectionRequired
{
SCNetworkReachabilityFlags flags;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
}
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
}
return NO;
}
// Is user intervention required?
-(BOOL)isInterventionRequired
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
}
return NO;
}
#pragma mark - reachability status stuff
-(NetworkStatus)currentReachabilityStatus
{
if([self isReachable])
{
if([self isReachableViaWiFi])
return ReachableViaWiFi;
#if TARGET_OS_IPHONE
return ReachableViaWWAN;
#endif
}
return NotReachable;
}
-(SCNetworkReachabilityFlags)reachabilityFlags
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return flags;
}
return 0;
}
-(NSString*)currentReachabilityString
{
NetworkStatus temp = [self currentReachabilityStatus];
if(temp == reachableOnWWAN)
{
// updated for the fact we have CDMA phones now!
return NSLocalizedString(@"Cellular", @"");
}
if (temp == ReachableViaWiFi)
{
return NSLocalizedString(@"WiFi", @"");
}
return NSLocalizedString(@"No Connection", @"");
}
-(NSString*)currentReachabilityFlags
{
return reachabilityFlags([self reachabilityFlags]);
}
#pragma mark - callback function calls this method
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags
{
if([self isReachableWithFlags:flags])
{
if(self.reachableBlock)
{
self.reachableBlock(self);
}
}
else
{
if(self.unreachableBlock)
{
self.unreachableBlock(self);
}
}
// this makes sure the change notification happens on the MAIN THREAD
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification
object:self];
});
}
@end
Pod::Spec.new do |s|
s.name = 'Reachability'
s.version = '3.1.0'
s.license = 'BSD'
s.homepage = 'https://github.com/tonymillion/Reachability'
s.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
s.summary = 'ARC and GCD Compatible Reachability Class for iOS. Drop in replacement for Apple Reachability.'
s.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
s.source_files = 'Reachability.{h,m}'
s.framework = 'SystemConfiguration'
s.requires_arc = false
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>061523DA9D2646ACA1EF295C</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>0AEC166B36EA4BBAB35AEB94</key>
<dict>
<key>fileRef</key>
<string>061523DA9D2646ACA1EF295C</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>26E99B1E26B641169EE1B5F6</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array/>
<key>inputPaths</key>
<array/>
<key>isa</key>
<string>PBXShellScriptBuildPhase</string>
<key>name</key>
<string>Copy Pods Resources</string>
<key>outputPaths</key>
<array/>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
<key>shellPath</key>
<string>/bin/sh</string>
<key>shellScript</key>
<string>"${SRCROOT}/Pods/Pods-resources.sh"
</string>
<key>showEnvVarsInLog</key>
<string>1</string>
</dict>
<key>E575589216C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A416C5943000DC1500</string>
<string>E575589D16C5943000DC1500</string>
<string>E575589C16C5943000DC1500</string>
<string>EFF75FAF8D54497F8417E948</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589316C5943000DC1500</key>
<dict>
<key>attributes</key>
<dict>
<key>CLASSPREFIX</key>
<string>CP</string>
<key>LastUpgradeCheck</key>
<string>0460</string>
<key>ORGANIZATIONNAME</key>
<string>CocoaPods</string>
</dict>
<key>buildConfigurationList</key>
<string>E575589616C5943000DC1500</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>E575589216C5943000DC1500</string>
<key>productRefGroup</key>
<string>E575589C16C5943000DC1500</string>
<key>projectDirPath</key>
<string></string>
<key>projectReferences</key>
<array/>
<key>projectRoot</key>
<string></string>
<key>targets</key>
<array>
<string>E575589A16C5943000DC1500</string>
</array>
</dict>
<key>E575589616C5943000DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B616C5943100DC1500</string>
<string>E57558B716C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E575589716C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558AB16C5943000DC1500</string>
<string>E57558B216C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589816C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E575589F16C5943000DC1500</string>
<string>0AEC166B36EA4BBAB35AEB94</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589916C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558A916C5943000DC1500</string>
<string>E57558AF16C5943000DC1500</string>
<string>E57558B516C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXResourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589A16C5943000DC1500</key>
<dict>
<key>buildConfigurationList</key>
<string>E57558B816C5943100DC1500</string>
<key>buildPhases</key>
<array>
<string>E575589716C5943000DC1500</string>
<string>E575589816C5943000DC1500</string>
<string>E575589916C5943000DC1500</string>
<string>26E99B1E26B641169EE1B5F6</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>SampleApp</string>
<key>productName</key>
<string>SampleApp</string>
<key>productReference</key>
<string>E575589B16C5943000DC1500</string>
<key>productType</key>
<string>com.apple.product-type.application</string>
</dict>
<key>E575589B16C5943000DC1500</key>
<dict>
<key>explicitFileType</key>
<string>wrapper.application</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>SampleApp.app</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>E575589C16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589B16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589D16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589E16C5943000DC1500</string>
<string>E57558A016C5943000DC1500</string>
<string>061523DA9D2646ACA1EF295C</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589E16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Cocoa.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Cocoa.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E575589F16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E575589E16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558A016C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A116C5943000DC1500</string>
<string>E57558A216C5943000DC1500</string>
<string>E57558A316C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Other Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>AppKit.framework</string>
<key>path</key>
<string>System/Library/Frameworks/AppKit.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A216C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>CoreData.framework</string>
<key>path</key>
<string>System/Library/Frameworks/CoreData.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A316C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A416C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B016C5943000DC1500</string>
<string>E57558B116C5943000DC1500</string>
<string>E57558B316C5943100DC1500</string>
<string>E57558A516C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>path</key>
<string>SampleApp</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A516C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A616C5943000DC1500</string>
<string>E57558A716C5943000DC1500</string>
<string>E57558AA16C5943000DC1500</string>
<string>E57558AC16C5943000DC1500</string>
<string>E57558AD16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Supporting Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A616C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.xml</string>
<key>path</key>
<string>SampleApp-Info.plist</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A716C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A816C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A816C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.strings</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A916C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558A716C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AA16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>main.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AB16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AA16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AC16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>SampleApp-Prefix.pch</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AD16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558AE16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AE16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.rtf</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AF16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AD16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B016C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>CPAppDelegate.h</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>CPAppDelegate.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B216C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B116C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B316C5943100DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B416C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B416C5943100DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>file.xib</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B516C5943100DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B316C5943100DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B616C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>ONLY_ACTIVE_ARCH</key>
<string>YES</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558B716C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>E57558B816C5943100DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B916C5943100DC1500</string>
<string>E57558BA16C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E57558B916C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558BA16C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>EFF75FAF8D54497F8417E948</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods/Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
</dict>
<key>rootObject</key>
<string>E575589316C5943000DC1500</string>
</dict>
</plist>
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:Pods/Pods.xcodeproj'/><FileRef location='group:SampleApp.xcodeproj'/></Workspace>
\ No newline at end of file
$ pod install --no-update --no-doc --verbose --no-color
Resolving dependencies of `./Podfile'
Finding added, modified or removed dependencies:
R JSONKit
- Reachability
Resolving dependencies for target `default' (iOS 6.0)
- Reachability (= 3.1.0)
Removing deleted dependencies
-> Removing JSONKit
Downloading dependencies
-> Using Reachability (3.1.0)
Generating support files
- Running pre install hooks
- Generating project
- Installing targets
- Generating xcconfig file at `./Pods/Pods.xcconfig'
- Generating prefix header at `./Pods/Pods-prefix.pch'
- Generating copy resources script at `./Pods/Pods-resources.sh'
- Running post install hooks
- Writing Xcode project file to `./Pods/Pods.xcodeproj'
- Writing lockfile in `./Podfile.lock'
platform :ios, '6.0'
pod "Reachability", "3.1.0"
\ No newline at end of file
PODS:
- JSONKit (1.5pre)
- Reachability (3.1.0)
DEPENDENCIES:
- JSONKit (= 1.5pre)
- Reachability (= 3.1.0)
SPEC CHECKSUMS:
JSONKit: 3d4708953ea7ae399a49777372d8b060a43ddd27
Reachability: 1c8584c5f26fa776695efef95caaa50402c94cfb
COCOAPODS: 0.16.2
//
// JSONKit.h
// http://github.com/johnezang/JSONKit
// Dual licensed under either the terms of the BSD License, or alternatively
// under the terms of the Apache License, Version 2.0, as specified below.
//
/*
Copyright (c) 2011, John Engelhart
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Zang Industries nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright 2011 John Engelhart
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <stddef.h>
#include <stdint.h>
#include <limits.h>
#include <TargetConditionals.h>
#include <AvailabilityMacros.h>
#ifdef __OBJC__
#import <Foundation/NSArray.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSError.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSString.h>
#endif // __OBJC__
#ifdef __cplusplus
extern "C" {
#endif
// For Mac OS X < 10.5.
#ifndef NSINTEGER_DEFINED
#define NSINTEGER_DEFINED
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef long NSInteger;
typedef unsigned long NSUInteger;
#define NSIntegerMin LONG_MIN
#define NSIntegerMax LONG_MAX
#define NSUIntegerMax ULONG_MAX
#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef int NSInteger;
typedef unsigned int NSUInteger;
#define NSIntegerMin INT_MIN
#define NSIntegerMax INT_MAX
#define NSUIntegerMax UINT_MAX
#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
#endif // NSINTEGER_DEFINED
#ifndef _JSONKIT_H_
#define _JSONKIT_H_
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465)
#define JK_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
#else
#define JK_DEPRECATED_ATTRIBUTE
#endif
#define JSONKIT_VERSION_MAJOR 1
#define JSONKIT_VERSION_MINOR 4
typedef NSUInteger JKFlags;
/*
JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON.
JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines.
JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode.
This option allows JSON with malformed Unicode to be parsed without reporting an error.
Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER".
*/
enum {
JKParseOptionNone = 0,
JKParseOptionStrict = 0,
JKParseOptionComments = (1 << 0),
JKParseOptionUnicodeNewlines = (1 << 1),
JKParseOptionLooseUnicode = (1 << 2),
JKParseOptionPermitTextAfterValidJSON = (1 << 3),
JKParseOptionValidFlags = (JKParseOptionComments | JKParseOptionUnicodeNewlines | JKParseOptionLooseUnicode | JKParseOptionPermitTextAfterValidJSON),
};
typedef JKFlags JKParseOptionFlags;
enum {
JKSerializeOptionNone = 0,
JKSerializeOptionPretty = (1 << 0),
JKSerializeOptionEscapeUnicode = (1 << 1),
JKSerializeOptionEscapeForwardSlashes = (1 << 4),
JKSerializeOptionValidFlags = (JKSerializeOptionPretty | JKSerializeOptionEscapeUnicode | JKSerializeOptionEscapeForwardSlashes),
};
typedef JKFlags JKSerializeOptionFlags;
#ifdef __OBJC__
typedef struct JKParseState JKParseState; // Opaque internal, private type.
// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict
@interface JSONDecoder : NSObject {
JKParseState *parseState;
}
+ (id)decoder;
+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (void)clearCache;
// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods.
- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead.
- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead.
// The NSData MUST be UTF8 encoded JSON.
- (id)parseJSONData:(NSData *)jsonData JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead.
- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead.
// Methods that return immutable collection objects.
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)objectWithData:(NSData *)jsonData;
- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
// Methods that return mutable collection objects.
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)mutableObjectWithData:(NSData *)jsonData;
- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
@end
////////////
#pragma mark Deserializing methods
////////////
@interface NSString (JSONKitDeserializing)
- (id)objectFromJSONString;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONString;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
@interface NSData (JSONKitDeserializing)
// The NSData MUST be UTF8 encoded JSON.
- (id)objectFromJSONData;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONData;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
////////////
#pragma mark Serializing methods
////////////
@interface NSString (JSONKitSerializing)
// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString).
// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes:
// includeQuotes:YES `a "test"...` -> `"a \"test\"..."`
// includeQuotes:NO `a "test"...` -> `a \"test\"...`
- (NSData *)JSONData; // Invokes JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
- (NSString *)JSONString; // Invokes JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
@end
@interface NSArray (JSONKitSerializing)
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializing)
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
#ifdef __BLOCKS__
@interface NSArray (JSONKitSerializingBlockAdditions)
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializingBlockAdditions)
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
#endif
#endif // __OBJC__
#endif // _JSONKIT_H_
#ifdef __cplusplus
} // extern "C"
#endif
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
//
// JSONKit.h
// http://github.com/johnezang/JSONKit
// Dual licensed under either the terms of the BSD License, or alternatively
// under the terms of the Apache License, Version 2.0, as specified below.
//
/*
Copyright (c) 2011, John Engelhart
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Zang Industries nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright 2011 John Engelhart
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <stddef.h>
#include <stdint.h>
#include <limits.h>
#include <TargetConditionals.h>
#include <AvailabilityMacros.h>
#ifdef __OBJC__
#import <Foundation/NSArray.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSError.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSString.h>
#endif // __OBJC__
#ifdef __cplusplus
extern "C" {
#endif
// For Mac OS X < 10.5.
#ifndef NSINTEGER_DEFINED
#define NSINTEGER_DEFINED
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef long NSInteger;
typedef unsigned long NSUInteger;
#define NSIntegerMin LONG_MIN
#define NSIntegerMax LONG_MAX
#define NSUIntegerMax ULONG_MAX
#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef int NSInteger;
typedef unsigned int NSUInteger;
#define NSIntegerMin INT_MIN
#define NSIntegerMax INT_MAX
#define NSUIntegerMax UINT_MAX
#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
#endif // NSINTEGER_DEFINED
#ifndef _JSONKIT_H_
#define _JSONKIT_H_
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465)
#define JK_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
#else
#define JK_DEPRECATED_ATTRIBUTE
#endif
#define JSONKIT_VERSION_MAJOR 1
#define JSONKIT_VERSION_MINOR 4
typedef NSUInteger JKFlags;
/*
JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON.
JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines.
JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode.
This option allows JSON with malformed Unicode to be parsed without reporting an error.
Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER".
*/
enum {
JKParseOptionNone = 0,
JKParseOptionStrict = 0,
JKParseOptionComments = (1 << 0),
JKParseOptionUnicodeNewlines = (1 << 1),
JKParseOptionLooseUnicode = (1 << 2),
JKParseOptionPermitTextAfterValidJSON = (1 << 3),
JKParseOptionValidFlags = (JKParseOptionComments | JKParseOptionUnicodeNewlines | JKParseOptionLooseUnicode | JKParseOptionPermitTextAfterValidJSON),
};
typedef JKFlags JKParseOptionFlags;
enum {
JKSerializeOptionNone = 0,
JKSerializeOptionPretty = (1 << 0),
JKSerializeOptionEscapeUnicode = (1 << 1),
JKSerializeOptionEscapeForwardSlashes = (1 << 4),
JKSerializeOptionValidFlags = (JKSerializeOptionPretty | JKSerializeOptionEscapeUnicode | JKSerializeOptionEscapeForwardSlashes),
};
typedef JKFlags JKSerializeOptionFlags;
#ifdef __OBJC__
typedef struct JKParseState JKParseState; // Opaque internal, private type.
// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict
@interface JSONDecoder : NSObject {
JKParseState *parseState;
}
+ (id)decoder;
+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (void)clearCache;
// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods.
- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead.
- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead.
// The NSData MUST be UTF8 encoded JSON.
- (id)parseJSONData:(NSData *)jsonData JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead.
- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead.
// Methods that return immutable collection objects.
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)objectWithData:(NSData *)jsonData;
- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
// Methods that return mutable collection objects.
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)mutableObjectWithData:(NSData *)jsonData;
- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
@end
////////////
#pragma mark Deserializing methods
////////////
@interface NSString (JSONKitDeserializing)
- (id)objectFromJSONString;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONString;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
@interface NSData (JSONKitDeserializing)
// The NSData MUST be UTF8 encoded JSON.
- (id)objectFromJSONData;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONData;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
////////////
#pragma mark Serializing methods
////////////
@interface NSString (JSONKitSerializing)
// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString).
// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes:
// includeQuotes:YES `a "test"...` -> `"a \"test\"..."`
// includeQuotes:NO `a "test"...` -> `a \"test\"...`
- (NSData *)JSONData; // Invokes JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
- (NSString *)JSONString; // Invokes JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
@end
@interface NSArray (JSONKitSerializing)
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializing)
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
#ifdef __BLOCKS__
@interface NSArray (JSONKitSerializingBlockAdditions)
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializingBlockAdditions)
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
#endif
#endif // __OBJC__
#endif // _JSONKIT_H_
#ifdef __cplusplus
} // extern "C"
#endif
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
//
// JSONKit.h
// http://github.com/johnezang/JSONKit
// Dual licensed under either the terms of the BSD License, or alternatively
// under the terms of the Apache License, Version 2.0, as specified below.
//
/*
Copyright (c) 2011, John Engelhart
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Zang Industries nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright 2011 John Engelhart
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <stddef.h>
#include <stdint.h>
#include <limits.h>
#include <TargetConditionals.h>
#include <AvailabilityMacros.h>
#ifdef __OBJC__
#import <Foundation/NSArray.h>
#import <Foundation/NSData.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSError.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSString.h>
#endif // __OBJC__
#ifdef __cplusplus
extern "C" {
#endif
// For Mac OS X < 10.5.
#ifndef NSINTEGER_DEFINED
#define NSINTEGER_DEFINED
#if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef long NSInteger;
typedef unsigned long NSUInteger;
#define NSIntegerMin LONG_MIN
#define NSIntegerMax LONG_MAX
#define NSUIntegerMax ULONG_MAX
#else // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
typedef int NSInteger;
typedef unsigned int NSUInteger;
#define NSIntegerMin INT_MIN
#define NSIntegerMax INT_MAX
#define NSUIntegerMax UINT_MAX
#endif // defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
#endif // NSINTEGER_DEFINED
#ifndef _JSONKIT_H_
#define _JSONKIT_H_
#if defined(__GNUC__) && (__GNUC__ >= 4) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5465)
#define JK_DEPRECATED_ATTRIBUTE __attribute__((deprecated))
#else
#define JK_DEPRECATED_ATTRIBUTE
#endif
#define JSONKIT_VERSION_MAJOR 1
#define JSONKIT_VERSION_MINOR 4
typedef NSUInteger JKFlags;
/*
JKParseOptionComments : Allow C style // and /_* ... *_/ (without a _, obviously) comments in JSON.
JKParseOptionUnicodeNewlines : Allow Unicode recommended (?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}]) newlines.
JKParseOptionLooseUnicode : Normally the decoder will stop with an error at any malformed Unicode.
This option allows JSON with malformed Unicode to be parsed without reporting an error.
Any malformed Unicode is replaced with \uFFFD, or "REPLACEMENT CHARACTER".
*/
enum {
JKParseOptionNone = 0,
JKParseOptionStrict = 0,
JKParseOptionComments = (1 << 0),
JKParseOptionUnicodeNewlines = (1 << 1),
JKParseOptionLooseUnicode = (1 << 2),
JKParseOptionPermitTextAfterValidJSON = (1 << 3),
JKParseOptionValidFlags = (JKParseOptionComments | JKParseOptionUnicodeNewlines | JKParseOptionLooseUnicode | JKParseOptionPermitTextAfterValidJSON),
};
typedef JKFlags JKParseOptionFlags;
enum {
JKSerializeOptionNone = 0,
JKSerializeOptionPretty = (1 << 0),
JKSerializeOptionEscapeUnicode = (1 << 1),
JKSerializeOptionEscapeForwardSlashes = (1 << 4),
JKSerializeOptionValidFlags = (JKSerializeOptionPretty | JKSerializeOptionEscapeUnicode | JKSerializeOptionEscapeForwardSlashes),
};
typedef JKFlags JKSerializeOptionFlags;
#ifdef __OBJC__
typedef struct JKParseState JKParseState; // Opaque internal, private type.
// As a general rule of thumb, if you use a method that doesn't accept a JKParseOptionFlags argument, it defaults to JKParseOptionStrict
@interface JSONDecoder : NSObject {
JKParseState *parseState;
}
+ (id)decoder;
+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (void)clearCache;
// The parse... methods were deprecated in v1.4 in favor of the v1.4 objectWith... methods.
- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length: instead.
- (id)parseUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithUTF8String:length:error: instead.
// The NSData MUST be UTF8 encoded JSON.
- (id)parseJSONData:(NSData *)jsonData JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData: instead.
- (id)parseJSONData:(NSData *)jsonData error:(NSError **)error JK_DEPRECATED_ATTRIBUTE; // Deprecated in JSONKit v1.4. Use objectWithData:error: instead.
// Methods that return immutable collection objects.
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)objectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)objectWithData:(NSData *)jsonData;
- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
// Methods that return mutable collection objects.
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(NSUInteger)length error:(NSError **)error;
// The NSData MUST be UTF8 encoded JSON.
- (id)mutableObjectWithData:(NSData *)jsonData;
- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
@end
////////////
#pragma mark Deserializing methods
////////////
@interface NSString (JSONKitDeserializing)
- (id)objectFromJSONString;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONString;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
@interface NSData (JSONKitDeserializing)
// The NSData MUST be UTF8 encoded JSON.
- (id)objectFromJSONData;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONData;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
@end
////////////
#pragma mark Serializing methods
////////////
@interface NSString (JSONKitSerializing)
// Convenience methods for those that need to serialize the receiving NSString (i.e., instead of having to serialize a NSArray with a single NSString, you can "serialize to JSON" just the NSString).
// Normally, a string that is serialized to JSON has quotation marks surrounding it, which you may or may not want when serializing a single string, and can be controlled with includeQuotes:
// includeQuotes:YES `a "test"...` -> `"a \"test\"..."`
// includeQuotes:NO `a "test"...` -> `a \"test\"...`
- (NSData *)JSONData; // Invokes JSONDataWithOptions:JKSerializeOptionNone includeQuotes:YES
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
- (NSString *)JSONString; // Invokes JSONStringWithOptions:JKSerializeOptionNone includeQuotes:YES
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
@end
@interface NSArray (JSONKitSerializing)
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializing)
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingDelegate:(id)delegate selector:(SEL)selector error:(NSError **)error;
@end
#ifdef __BLOCKS__
@interface NSArray (JSONKitSerializingBlockAdditions)
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
@interface NSDictionary (JSONKitSerializingBlockAdditions)
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions serializeUnsupportedClassesUsingBlock:(id(^)(id object))block error:(NSError **)error;
@end
#endif
#endif // __OBJC__
#endif // _JSONKIT_H_
#ifdef __cplusplus
} // extern "C"
#endif
This source diff could not be displayed because it is too large. You can view the blob instead.
# JSONKit
JSONKit is dual licensed under either the terms of the BSD License, or alternatively under the terms of the Apache License, Version 2.0.<br />
Copyright &copy; 2011, John Engelhart.
### A Very High Performance Objective-C JSON Library
**UPDATE:** (2011/12/18) The benchmarks below were performed before Apples [`NSJSONSerialization`][NSJSONSerialization] was available (as of Mac OS X 10.7 and iOS 5). The obvious question is: Which is faster, [`NSJSONSerialization`][NSJSONSerialization] or JSONKit? According to [this site](http://www.bonto.ch/blog/2011/12/08/json-libraries-for-ios-comparison-updated/), JSONKit is faster than [`NSJSONSerialization`][NSJSONSerialization]. Some quick "back of the envelope" calculations using the numbers reported, JSONKit appears to be approximately 25% to 40% faster than [`NSJSONSerialization`][NSJSONSerialization], which is pretty significant.
Parsing | Serializing
:---------:|:-------------:
<img src="http://chart.googleapis.com/chart?chf=a,s,000000%7Cb0,lg,0,6589C760,0,6589C7B4,1%7Cbg,lg,90,EFEFEF,0,F8F8F8,1&chxl=0:%7CTouchJSON%7CXML+.plist%7Cjson-framework%7CYAJL-ObjC%7Cgzip+JSONKit%7CBinary+.plist%7CJSONKit%7C2:%7CTime+to+Deserialize+in+%C2%B5sec&chxp=2,40&chxr=0,0,5%7C1,0,3250&chxs=0,676767,11.5,1,lt,676767&chxt=y,x,x&chbh=a,5,4&chs=350x185&cht=bhs&chco=6589C783&chds=0,3250&chd=t:410.517,510.262,539.614,1351.257,1683.346,1747.953,2955.881&chg=-1,0,1,3&chm=N+*s*+%C2%B5s,676767,0,0:5,10.5%7CN+*s*+%C2%B5s,3d3d3d,0,6,10.5,,r:-5:1&chem=y;s=text_outline;d=666,10.5,l,fff,_,Decompress+%2b+Parse+is+just;ds=0;dp=2;py=0;of=58,7%7Cy;s=text_outline;d=666,10.5,l,fff,_,5.6%25+slower+than+Binary+.plist%21;ds=0;dp=2;py=0;of=53,-5" width="350" height="185" alt="Deserialize from JSON" /> | <img src="http://chart.googleapis.com/chart?chf=a,s,000000%7Cb0,lg,0,699E7260,0,699E72B4,1%7Cbg,lg,90,EFEFEF,0,F8F8F8,1&chxl=0:%7CTouchJSON%7CYAJL-ObjC%7CXML+.plist%7Cjson-framework%7CBinary+.plist%7Cgzip+JSONKit%7CJSONKit%7C2:%7CTime+to+Serialize+in+%C2%B5sec&chxp=2,40&chxr=0,0,5%7C1,0,3250&chxs=0,676767,11.5,1,lt,676767&chxt=y,x,x&chbh=a,5,4&chs=350x175&cht=bhs&chco=699E7284&chds=0,3250&chd=t:96.387,466.947,626.153,1028.432,1945.511,2156.978,3051.976&chg=-1,0,1,3&chm=N+*s*+%C2%B5s,676767,0,0:5,10.5%7CN+*s*+%C2%B5s,4d4d4d,0,6,10.5,,r:-5:1&chem=y;s=text_outline;d=666,10.5,l,fff,_,Serialize+%2b+Compress+is+34%25;ds=0;dp=1;py=0;of=51,7%7Cy;s=text_outline;d=666,10.5,l,fff,_,faster+than+Binary+.plist%21;ds=0;dp=1;py=0;of=62,-5" width="350" height="185" alt="Serialize to JSON" />
*23% Faster than Binary* <code><em>.plist</em></code>*&thinsp;!* | *549% Faster than Binary* <code><em>.plist</em></code>*&thinsp;!*
* Benchmarking was performed on a MacBook Pro with a 2.66GHz Core 2.
* All JSON libraries were compiled with `gcc-4.2 -DNS_BLOCK_ASSERTIONS -O3 -arch x86_64`.
* Timing results are the average of 1,000 iterations of the user + system time reported by [`getrusage`][getrusage].
* The JSON used was [`twitter_public_timeline.json`](https://github.com/samsoffes/json-benchmarks/blob/master/Resources/twitter_public_timeline.json) from [samsoffes / json-benchmarks](https://github.com/samsoffes/json-benchmarks).
* Since the `.plist` format does not support serializing [`NSNull`][NSNull], the `null` values in the original JSON were changed to `"null"`.
* The [experimental](https://github.com/johnezang/JSONKit/tree/experimental) branch contains the `gzip` compression changes.
* JSONKit automagically links to `libz.dylib` on the fly at run time&ndash; no manual linking required.
* Parsing / deserializing will automagically decompress a buffer if it detects a `gzip` signature header.
* You can compress / `gzip` the serialized JSON by passing `JKSerializeOptionCompress` to `-JSONDataWithOptions:error:`.
[JSON versus PLIST, the Ultimate Showdown](http://www.cocoanetics.com/2011/03/json-versus-plist-the-ultimate-showdown/) benchmarks the common JSON libraries and compares them to Apples `.plist` format.
***
JavaScript Object Notation, or [JSON][], is a lightweight, text-based, serialization format for structured data that is used by many web-based services and API's. It is defined by [RFC 4627][].
JSON provides the following primitive types:
* `null`
* Boolean `true` and `false`
* Number
* String
* Array
* Object (a.k.a. Associative Arrays, Key / Value Hash Tables, Maps, Dictionaries, etc.)
These primitive types are mapped to the following Objective-C Foundation classes:
JSON | Objective-C
-------------------|-------------
`null` | [`NSNull`][NSNull]
`true` and `false` | [`NSNumber`][NSNumber]
Number | [`NSNumber`][NSNumber]
String | [`NSString`][NSString]
Array | [`NSArray`][NSArray]
Object | [`NSDictionary`][NSDictionary]
JSONKit uses Core Foundation internally, and it is assumed that Core Foundation &equiv; Foundation for every equivalent base type, i.e. [`CFString`][CFString] &equiv; [`NSString`][NSString].
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC 2119][].
### JSON To Objective-C Primitive Mapping Details
* The [JSON specification][RFC 4627] is somewhat ambiguous about the details and requirements when it comes to Unicode, and it does not specify how Unicode issues and errors should be handled. Most of the ambiguity stems from the interpretation and scope [RFC 4627][] Section 3, Encoding: `JSON text SHALL be encoded in Unicode.` It is the authors opinion and interpretation that the language of [RFC 4627][] requires that a JSON implementation MUST follow the requirements specified in the [Unicode Standard][], and in particular the [Conformance][Unicode Standard - Conformance] chapter of the [Unicode Standard][], which specifies requirements related to handling, interpreting, and manipulating Unicode text.
The default behavior for JSONKit is strict [RFC 4627][] conformance. It is the authors opinion and interpretation that [RFC 4627][] requires JSON to be encoded in Unicode, and therefore JSON that is not legal Unicode as defined by the [Unicode Standard][] is invalid JSON. Therefore, JSONKit will not accept JSON that contains ill-formed Unicode. The default, strict behavior implies that the `JKParseOptionLooseUnicode` option is not enabled.
When the `JKParseOptionLooseUnicode` option is enabled, JSONKit follows the specifications and recommendations given in [The Unicode 6.0 standard, Chapter 3 - Conformance][Unicode Standard - Conformance], section 3.9 *Unicode Encoding Forms*. As a general rule of thumb, the Unicode code point `U+FFFD` is substituted for any ill-formed Unicode encountered. JSONKit attempts to follow the recommended *Best Practice for Using U+FFFD*: ***Replace each maximal subpart of an ill-formed subsequence by a single U+FFFD.***
The following Unicode code points are treated as ill-formed Unicode, and if `JKParseOptionLooseUnicode` is enabled, cause `U+FFFD` to be substituted in their place:
`U+0000`.<br>
`U+D800` thru `U+DFFF`, inclusive.<br>
`U+FDD0` thru `U+FDEF`, inclusive.<br>
<code>U+<i>n</i>FFFE</code> and <code>U+<i>n</i>FFFF</code>, where *n* is from `0x0` to `0x10`
The code points `U+FDD0` thru `U+FDEF`, <code>U+<i>n</i>FFFE</code>, and <code>U+<i>n</i>FFFF</code> (where *n* is from `0x0` to `0x10`), are defined as ***Noncharacters*** by the Unicode standard and "should never be interchanged".
An exception is made for the code point `U+0000`, which is legal Unicode. The reason for this is that this particular code point is used by C string handling code to specify the end of the string, and any such string handling code will incorrectly stop processing a string at the point where `U+0000` occurs. Although reasonable people may have different opinions on this point, it is the authors considered opinion that the risks of permitting JSON Strings that contain `U+0000` outweigh the benefits. One of the risks in allowing `U+0000` to appear unaltered in a string is that it has the potential to create security problems by subtly altering the semantics of the string which can then be exploited by a malicious attacker. This is similar to the issue of [arbitrarily deleting characters from Unicode text][Unicode_UTR36_Deleting].
[RFC 4627][] allows for these limitations under section 4, Parsers: `An implementation may set limits on the length and character contents of strings.` While the [Unicode Standard][] permits the mutation of the original JSON (i.e., substituting `U+FFFD` for ill-formed Unicode), [RFC 4627][] is silent on this issue. It is the authors opinion and interpretation that [RFC 4627][], section 3 &ndash; *Encoding*, `JSON text SHALL be encoded in Unicode.` implies that such mutations are not only permitted but MUST be expected by any strictly conforming [RFC 4627][] JSON implementation. The author feels obligated to note that this opinion and interpretation may not be shared by others and, in fact, may be a minority opinion and interpretation. You should be aware that any mutation of the original JSON may subtly alter its semantics and, as a result, may have security related implications for anything that consumes the final result.
It is important to note that JSONKit will not delete characters from the JSON being parsed as this is a [requirement specified by the Unicode Standard][Unicode_UTR36_Deleting]. Additional information can be found in the [Unicode Security FAQ][Unicode_Security_FAQ] and [Unicode Technical Report #36 - Unicode Security Consideration][Unicode_UTR36], in particular the section on [non-visual security][Unicode_UTR36_NonVisualSecurity].
* The [JSON specification][RFC 4627] does not specify the details or requirements for JSON String values, other than such strings must consist of Unicode code points, nor does it specify how errors should be handled. While JSONKit makes an effort (subject to the reasonable caveats above regarding Unicode) to preserve the parsed JSON String exactly, it can not guarantee that [`NSString`][NSString] will preserve the exact Unicode semantics of the original JSON String.
JSONKit does not perform any form of Unicode Normalization on the parsed JSON Strings, but can not make any guarantees that the [`NSString`][NSString] class will not perform Unicode Normalization on the parsed JSON String used to instantiate the [`NSString`][NSString] object. The [`NSString`][NSString] class may place additional restrictions or otherwise transform the JSON String in such a way so that the JSON String is not bijective with the instantiated [`NSString`][NSString] object. In other words, JSONKit can not guarantee that when you round trip a JSON String to a [`NSString`][NSString] and then back to a JSON String that the two JSON Strings will be exactly the same, even though in practice they are. For clarity, "exactly" in this case means bit for bit identical. JSONKit can not even guarantee that the two JSON Strings will be [Unicode equivalent][Unicode_equivalence], even though in practice they will be and would be the most likely cause for the two round tripped JSON Strings to no longer be bit for bit identical.
* JSONKit maps `true` and `false` to the [`CFBoolean`][CFBoolean] values [`kCFBooleanTrue`][kCFBooleanTrue] and [`kCFBooleanFalse`][kCFBooleanFalse], respectively. Conceptually, [`CFBoolean`][CFBoolean] values can be thought of, and treated as, [`NSNumber`][NSNumber] class objects. The benefit to using [`CFBoolean`][CFBoolean] is that `true` and `false` JSON values can be round trip deserialized and serialized without conversion or promotion to a [`NSNumber`][NSNumber] with a value of `0` or `1`.
* The [JSON specification][RFC 4627] does not specify the details or requirements for JSON Number values, nor does it specify how errors due to conversion should be handled. In general, JSONKit will not accept JSON that contains JSON Number values that it can not convert with out error or loss of precision.
For non-floating-point numbers (i.e., JSON Number values that do not include a `.` or `e|E`), JSONKit uses a 64-bit C primitive type internally, regardless of whether the target architecture is 32-bit or 64-bit. For unsigned values (i.e., those that do not begin with a `-`), this allows for values up to <code>2<sup>64</sup>-1</code> and up to <code>-2<sup>63</sup></code> for negative values. As a special case, the JSON Number `-0` is treated as a floating-point number since the underlying floating-point primitive type is capable of representing a negative zero, whereas the underlying twos-complement non-floating-point primitive type can not. JSON that contains Number values that exceed these limits will fail to parse and optionally return a [`NSError`][NSError] object. The functions [`strtoll()`][strtoll] and [`strtoull()`][strtoull] are used to perform the conversions.
The C `double` primitive type, or [IEEE 754 Double 64-bit floating-point][Double Precision], is used to represent floating-point JSON Number values. JSON that contains floating-point Number values that can not be represented as a `double` (i.e., due to over or underflow) will fail to parse and optionally return a [`NSError`][NSError] object. The function [`strtod()`][strtod] is used to perform the conversion. Note that the JSON standard does not allow for infinities or `NaN` (Not a Number). The conversion and manipulation of [floating-point values is non-trivial](http://www.validlab.com/goldberg/paper.pdf). Unfortunately, [RFC 4627][] is silent on how such details should be handled. You should not depend on or expect that when a floating-point value is round tripped that it will have the same textual representation or even compare equal. This is true even when JSONKit is used as both the parser and creator of the JSON, let alone when transferring JSON between different systems and implementations.
* For JSON Objects (or [`NSDictionary`][NSDictionary] in JSONKit nomenclature), [RFC 4627][] says `The names within an object SHOULD be unique` (note: `name` is a `key` in JSONKit nomenclature). At this time the JSONKit behavior is `undefined` for JSON that contains names within an object that are not unique. However, JSONKit currently tries to follow a "the last key / value pair parsed is the one chosen" policy. This behavior is not finalized and should not be depended on.
The previously covered limitations regarding JSON Strings have important consequences for JSON Objects since JSON Strings are used as the `key`. The [JSON specification][RFC 4627] does not specify the details or requirements for JSON Strings used as `keys` in JSON Objects, specifically what it means for two `keys` to compare equal. Unfortunately, because [RFC 4627][] states `JSON text SHALL be encoded in Unicode.`, this means that one must use the [Unicode Standard][] to interpret the JSON, and the [Unicode Standard][] allows for strings that are encoded with different Unicode Code Points to "compare equal". JSONKit uses [`NSString`][NSString] exclusively to manage the parsed JSON Strings. Because [`NSString`][NSString] uses [Unicode][Unicode Standard] as its basis, there exists the possibility that [`NSString`][NSString] may subtly and silently convert the Unicode Code Points contained in the original JSON String in to a [Unicode equivalent][Unicode_equivalence] string. Due to this, the JSONKit behavior for JSON Strings used as `keys` in JSON Objects that may be [Unicode equivalent][Unicode_equivalence] but not binary equivalent is `undefined`.
**See also:**<br />
&nbsp;&nbsp;&nbsp;&nbsp;[W3C - Requirements for String Identity Matching and String Indexing](http://www.w3.org/TR/charreq/#sec2)
### Objective-C To JSON Primitive Mapping Details
* When serializing, the top level container, and all of its children, are required to be *strictly* [invariant][wiki_invariant] during enumeration. This property is used to make certain optimizations, such as if a particular object has already been serialized, the result of the previous serialized `UTF8` string can be reused (i.e., the `UTF8` string of the previous serialization can simply be copied instead of performing all the serialization work again). While this is probably only of interest to those who are doing extraordinarily unusual things with the run-time or custom classes inheriting from the classes that JSONKit will serialize (i.e, a custom object whose value mutates each time it receives a message requesting its value for serialization), it also covers the case where any of the objects to be serialized are mutated during enumeration (i.e., mutated by another thread). The number of times JSONKit will request an objects value is non-deterministic, from a minimum of once up to the number of times it appears in the serialized JSON&ndash; therefore an object MUST NOT depend on receiving a message requesting its value each time it appears in the serialized output. The behavior is `undefined` if these requirements are violated.
* The objects to be serialized MUST be acyclic. If the objects to be serialized contain circular references the behavior is `undefined`. For example,
```objective-c
[arrayOne addObject:arrayTwo];
[arrayTwo addObject:arrayOne];
id json = [arrayOne JSONString];
```
&hellip; will result in `undefined` behavior.
* The contents of [`NSString`][NSString] objects are encoded as `UTF8` and added to the serialized JSON. JSONKit assumes that [`NSString`][NSString] produces well-formed `UTF8` Unicode and does no additional validation of the conversion. When `JKSerializeOptionEscapeUnicode` is enabled, JSONKit will encode Unicode code points that can be encoded as a single `UTF16` code unit as <code>\u<i>XXXX</i></code>, and will encode Unicode code points that require `UTF16` surrogate pairs as <code>\u<i>high</i>\u<i>low</i></code>. While JSONKit makes every effort to serialize the contents of a [`NSString`][NSString] object exactly, modulo any [RFC 4627][] requirements, the [`NSString`][NSString] class uses the [Unicode Standard][] as its basis for representing strings. You should be aware that the [Unicode Standard][] defines [string equivalence][Unicode_equivalence] in a such a way that two strings that compare equal are not required to be bit for bit identical. Therefore there exists the possibility that [`NSString`][NSString] may mutate a string in such a way that it is [Unicode equivalent][Unicode_equivalence], but not bit for bit identical with the original string.
* The [`NSDictionary`][NSDictionary] class allows for any object, which can be of any class, to be used as a `key`. JSON, however, only permits Strings to be used as `keys`. Therefore JSONKit will fail with an error if it encounters a [`NSDictionary`][NSDictionary] that contains keys that are not [`NSString`][NSString] objects during serialization. More specifically, the keys must return `YES` when sent [`-isKindOfClass:[NSString class]`][-isKindOfClass:].
* JSONKit will fail with an error if it encounters an object that is not a [`NSNull`][NSNull], [`NSNumber`][NSNumber], [`NSString`][NSString], [`NSArray`][NSArray], or [`NSDictionary`][NSDictionary] class object during serialization. More specifically, JSONKit will fail with an error if it encounters an object where [`-isKindOfClass:`][-isKindOfClass:] returns `NO` for all of the previously mentioned classes.
* JSON does not allow for Numbers that are <code>&plusmn;Infinity</code> or <code>&plusmn;NaN</code>. Therefore JSONKit will fail with an error if it encounters a [`NSNumber`][NSNumber] that contains such a value during serialization.
* Objects created with [`[NSNumber numberWithBool:YES]`][NSNumber_numberWithBool] and [`[NSNumber numberWithBool:NO]`][NSNumber_numberWithBool] will be mapped to the JSON values of `true` and `false`, respectively. More specifically, an object must have pointer equality with [`kCFBooleanTrue`][kCFBooleanTrue] or [`kCFBooleanFalse`][kCFBooleanFalse] (i.e., `if((id)object == (id)kCFBooleanTrue)`) in order to be mapped to the JSON values `true` and `false`.
* [`NSNumber`][NSNumber] objects that are not booleans (as defined above) are sent [`-objCType`][-objCType] to determine what type of C primitive type they represent. Those that respond with a type from the set `cislq` are treated as `long long`, those that respond with a type from the set `CISLQB` are treated as `unsigned long long`, and those that respond with a type from the set `fd` are treated as `double`. [`NSNumber`][NSNumber] objects that respond with a type not in the set of types mentioned will cause JSONKit to fail with an error.
More specifically, [`CFNumberGetValue(object, kCFNumberLongLongType, &longLong)`][CFNumberGetValue] is used to retrieve the value of both the signed and unsigned integer values, and the type reported by [`-objCType`][-objCType] is used to determine whether the result is signed or unsigned. For floating-point values, [`CFNumberGetValue`][CFNumberGetValue] is used to retrieve the value using [`kCFNumberDoubleType`][kCFNumberDoubleType] for the type argument.
Floating-point numbers are converted to their decimal representation using the [`printf`][printf] format conversion specifier `%.17g`. Theoretically this allows up to a `float`, or [IEEE 754 Single 32-bit floating-point][Single Precision], worth of precision to be represented. This means that for practical purposes, `double` values are converted to `float` values with the associated loss of precision. The [RFC 4627][] standard is silent on how floating-point numbers should be dealt with and the author has found that real world JSON implementations vary wildly in how they handle this issue. Furthermore, the `%g` format conversion specifier may convert floating-point values that can be exactly represented as an integer to a textual representation that does not include a `.` or `e`&ndash; essentially silently promoting a floating-point value to an integer value (i.e, `5.0` becomes `5`). Because of these and many other issues surrounding the conversion and manipulation of floating-point values, you should not expect or depend on floating point values to maintain their full precision, or when round tripped, to compare equal.
### Reporting Bugs
Please use the [github.com JSONKit Issue Tracker](https://github.com/johnezang/JSONKit/issues) to report bugs.
The author requests that you do not file a bug report with JSONKit regarding problems reported by the `clang` static analyzer unless you first manually verify that it is an actual, bona-fide problem with JSONKit and, if appropriate, is not "legal" C code as defined by the C99 language specification. If the `clang` static analyzer is reporting a problem with JSONKit that is not an actual, bona-fide problem and is perfectly legal code as defined by the C99 language specification, then the appropriate place to file a bug report or complaint is with the developers of the `clang` static analyzer.
### Important Details
* JSONKit is not designed to be used with the Mac OS X Garbage Collection. The behavior of JSONKit when compiled with `-fobjc-gc` is `undefined`. It is extremely unlikely that Mac OS X Garbage Collection will ever be supported.
* JSONKit is not designed to be used with [Objective-C Automatic Reference Counting (ARC)][ARC]. The behavior of JSONKit when compiled with `-fobjc-arc` is `undefined`. The behavior of JSONKit compiled without [ARC][] mixed with code that has been compiled with [ARC][] is normatively `undefined` since at this time no analysis has been done to understand if this configuration is safe to use. At this time, there are no plans to support [ARC][] in JSONKit. Although tenative, it is extremely unlikely that [ARC][] will ever be supported, for many of the same reasons that Mac OS X Garbage Collection is not supported.
* The JSON to be parsed by JSONKit MUST be encoded as Unicode. In the unlikely event you end up with JSON that is not encoded as Unicode, you must first convert the JSON to Unicode, preferably as `UTF8`. One way to accomplish this is with the [`NSString`][NSString] methods [`-initWithBytes:length:encoding:`][NSString_initWithBytes] and [`-initWithData:encoding:`][NSString_initWithData].
* Internally, the low level parsing engine uses `UTF8` exclusively. The `JSONDecoder` method `-objectWithData:` takes a [`NSData`][NSData] object as its argument and it is assumed that the raw bytes contained in the [`NSData`][NSData] is `UTF8` encoded, otherwise the behavior is `undefined`.
* It is not safe to use the same instantiated `JSONDecoder` object from multiple threads at the same time. If you wish to share a `JSONDecoder` between threads, you are responsible for adding mutex barriers to ensure that only one thread is decoding JSON using the shared `JSONDecoder` object at a time.
### Tips for speed
* Enable the `NS_BLOCK_ASSERTIONS` pre-processor flag. JSONKit makes heavy use of [`NSCParameterAssert()`][NSCParameterAssert] internally to ensure that various arguments, variables, and other state contains only legal and expected values. If an assertion check fails it causes a run time exception that will normally cause a program to terminate. These checks and assertions come with a price: they take time to execute and do not contribute to the work being performed. It is perfectly safe to enable `NS_BLOCK_ASSERTIONS` as JSONKit always performs checks that are required for correct operation. The checks performed with [`NSCParameterAssert()`][NSCParameterAssert] are completely optional and are meant to be used in "debug" builds where extra integrity checks are usually desired. While your mileage may vary, the author has found that adding `-DNS_BLOCK_ASSERTIONS` to an `-O2` optimization setting can generally result in an approximate <span style="white-space: nowrap;">7-12%</span> increase in performance.
* Since the very low level parsing engine works exclusively with `UTF8` byte streams, anything that is not already encoded as `UTF8` must first be converted to `UTF8`. While JSONKit provides additions to the [`NSString`][NSString] class which allows you to conveniently convert JSON contained in a [`NSString`][NSString], this convenience does come with a price. JSONKit must allocate an autoreleased [`NSMutableData`][NSMutableData] large enough to hold the strings `UTF8` conversion and then convert the string to `UTF8` before it can begin parsing. This takes both memory and time. Once the parsing has finished, JSONKit sets the autoreleased [`NSMutableData`][NSMutableData] length to `0`, which allows the [`NSMutableData`][NSMutableData] to release the memory. This helps to minimize the amount of memory that is in use but unavailable until the autorelease pool pops. Therefore, if speed and memory usage are a priority, you should avoid using the [`NSString`][NSString] convenience methods if possible.
* If you are receiving JSON data from a web server, and you are able to determine that the raw bytes returned by the web server is JSON encoded as `UTF8`, you should use the `JSONDecoder` method `-objectWithUTF8String:length:` which immediately begins parsing the pointers bytes. In practice, every JSONKit method that converts JSON to an Objective-C object eventually calls this method to perform the conversion.
* If you are using one of the various ways provided by the `NSURL` family of classes to receive JSON results from a web server, which typically return the results in the form of a [`NSData`][NSData] object, and you are able to determine that the raw bytes contained in the [`NSData`][NSData] are encoded as `UTF8`, then you should use either the `JSONDecoder` method `objectWithData:` or the [`NSData`][NSData] method `-objectFromJSONData`. If are going to be converting a lot of JSON, the better choice is to instantiate a `JSONDecoder` object once and use the same instantiated object to perform all your conversions. This has two benefits:
1. The [`NSData`][NSData] method `-objectFromJSONData` creates an autoreleased `JSONDecoder` object to perform the one time conversion. By instantiating a `JSONDecoder` object once and using the `objectWithData:` method repeatedly, you can avoid this overhead.
2. The instantiated object cache from the previous JSON conversion is reused. This can result in both better performance and a reduction in memory usage if the JSON your are converting is very similar. A typical example might be if you are converting JSON at periodic intervals that consists of real time status updates.
* On average, the <code>JSONData&hellip;</code> methods are nearly four times faster than the <code>JSONString&hellip;</code> methods when serializing a [`NSDictionary`][NSDictionary] or [`NSArray`][NSArray] to JSON. The difference in speed is due entirely to the instantiation overhead of [`NSString`][NSString].
* If at all possible, use [`NSData`][NSData] instead of [`NSString`][NSString] methods when processing JSON. This avoids the sometimes significant conversion overhead that [`NSString`][NSString] performs in order to provide an object oriented interface for its contents. For many uses, using [`NSString`][NSString] is not needed and results in wasted effort&ndash; for example, using JSONKit to serialize a [`NSDictionary`][NSDictionary] or [`NSArray`][NSArray] to a [`NSString`][NSString]. This [`NSString`][NSString] is then passed to a method that sends the JSON to a web server, and this invariably requires converting the [`NSString`][NSString] to [`NSData`][NSData] before it can be sent. In this case, serializing the collection object directly to [`NSData`][NSData] would avoid the unnecessary conversions to and from a [`NSString`][NSString] object.
### Parsing Interface
#### JSONDecoder Interface
The <code>objectWith&hellip;</code> methods return immutable collection objects and their respective <code>mutableObjectWith&hellip;</code> methods return mutable collection objects.
**Note:** The bytes contained in a [`NSData`][NSData] object ***MUST*** be `UTF8` encoded.
**Important:** Methods will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `parseOptionFlags` is not valid.
**Important:** `objectWithUTF8String:` and `mutableObjectWithUTF8String:` will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `string` is `NULL`.
**Important:** `objectWithData:` and `mutableObjectWithData:` will raise [`NSInvalidArgumentException`][NSInvalidArgumentException] if `jsonData` is `NULL`.
```objective-c
+ (id)decoder;
+ (id)decoderWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)initWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (void)clearCache;
- (id)objectWithUTF8String:(const unsigned char *)string length:(size_t)length;
- (id)objectWithUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(size_t)length;
- (id)mutableObjectWithUTF8String:(const unsigned char *)string length:(size_t)length error:(NSError **)error;
- (id)objectWithData:(NSData *)jsonData;
- (id)objectWithData:(NSData *)jsonData error:(NSError **)error;
- (id)mutableObjectWithData:(NSData *)jsonData;
- (id)mutableObjectWithData:(NSData *)jsonData error:(NSError **)error;
```
#### NSString Interface
```objective-c
- (id)objectFromJSONString;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONString;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONStringWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
```
#### NSData Interface
```objective-c
- (id)objectFromJSONData;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)objectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
- (id)mutableObjectFromJSONData;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags;
- (id)mutableObjectFromJSONDataWithParseOptions:(JKParseOptionFlags)parseOptionFlags error:(NSError **)error;
```
#### JKParseOptionFlags
<table>
<tr><th>Parsing Option</th><th>Description</th></tr>
<tr><td valign="top"><code>JKParseOptionNone</code></td><td>This is the default if no other other parse option flags are specified, and the option used when a convenience method does not provide an argument for explicitly specifying the parse options to use. Synonymous with <code>JKParseOptionStrict</code>.</td></tr>
<tr><td valign="top"><code>JKParseOptionStrict</code></td><td>The JSON will be parsed in strict accordance with the <a href="http://tools.ietf.org/html/rfc4627">RFC 4627</a> specification.</td></tr>
<tr><td valign="top"><code>JKParseOptionComments</code></td><td>Allow C style <code>//</code> and <code>/* &hellip; */</code> comments in JSON. This is a fairly common extension to JSON, but JSON that contains C style comments is not strictly conforming JSON.</td></tr>
<tr><td valign="top"><code>JKParseOptionUnicodeNewlines</code></td><td>Allow Unicode recommended <code>(?:\r\n|[\n\v\f\r\x85\p{Zl}\p{Zp}])</code> newlines in JSON. The <a href="http://tools.ietf.org/html/rfc4627">JSON specification</a> only allows the newline characters <code>\r</code> and <code>\n</code>, but this option allows JSON that contains the <a href="http://en.wikipedia.org/wiki/Newline#Unicode">Unicode recommended newline characters</a> to be parsed. JSON that contains these additional newline characters is not strictly conforming JSON.</td></tr>
<tr><td valign="top"><code>JKParseOptionLooseUnicode</code></td><td>Normally the decoder will stop with an error at any malformed Unicode. This option allows JSON with malformed Unicode to be parsed without reporting an error. Any malformed Unicode is replaced with <code>\uFFFD</code>, or <code>REPLACEMENT CHARACTER</code>, as specified in <a href="http://www.unicode.org/versions/Unicode6.0.0/ch03.pdf">The Unicode 6.0 standard, Chapter 3</a>, section 3.9 <em>Unicode Encoding Forms</em>.</td></tr>
<tr><td valign="top"><code>JKParseOptionPermitTextAfterValidJSON</code></td><td>Normally, <code>non-white-space</code> that follows the JSON is interpreted as a parsing failure. This option allows for any trailing <code>non-white-space</code> to be ignored and not cause a parsing error.</td></tr>
</table>
### Serializing Interface
The serializing interface includes [`NSString`][NSString] convenience methods for those that need to serialize a single [`NSString`][NSString]. For those that need this functionality, the [`NSString`][NSString] additions are much more convenient than having to wrap a single [`NSString`][NSString] in a [`NSArray`][NSArray], which then requires stripping the unneeded `[`&hellip;`]` characters from the serialized JSON result. When serializing a single [`NSString`][NSString], you can control whether or not the serialized JSON result is surrounded by quotation marks using the `includeQuotes:` argument:
Example | Result | Argument
--------------|-------------------|--------------------
`a "test"...` | `"a \"test\"..."` | `includeQuotes:YES`
`a "test"...` | `a \"test\"...` | `includeQuotes:NO`
**Note:** The [`NSString`][NSString] methods that do not include a `includeQuotes:` argument behave as if invoked with `includeQuotes:YES`.
**Note:** The bytes contained in the returned [`NSData`][NSData] object are `UTF8` encoded.
#### NSArray and NSDictionary Interface
```objective-c
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions error:(NSError **)error;
```
#### NSString Interface
```objective-c
- (NSData *)JSONData;
- (NSData *)JSONDataWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
- (NSString *)JSONString;
- (NSString *)JSONStringWithOptions:(JKSerializeOptionFlags)serializeOptions includeQuotes:(BOOL)includeQuotes error:(NSError **)error;
```
#### JKSerializeOptionFlags
<table>
<tr><th>Serializing Option</th><th>Description</th></tr>
<tr><td valign="top"><code>JKSerializeOptionNone</code></td><td>This is the default if no other other serialize option flags are specified, and the option used when a convenience method does not provide an argument for explicitly specifying the serialize options to use.</td></tr>
<tr><td valign="top"><code>JKSerializeOptionPretty</code></td><td>Normally the serialized JSON does not include any unnecessary <code>white-space</code>. While this form is the most compact, the lack of any <code>white-space</code> means that it's something only another JSON parser could love. Enabling this option causes JSONKit to add additional <code>white-space</code> that makes it easier for people to read. Other than the extra <code>white-space</code>, the serialized JSON is identical to the JSON that would have been produced had this option not been enabled.</td></tr>
<tr><td valign="top"><code>JKSerializeOptionEscapeUnicode</code></td><td>When JSONKit encounters Unicode characters in <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html"><code>NSString</code></a> objects, the default behavior is to encode those Unicode characters as <code>UTF8</code>. This option causes JSONKit to encode those characters as <code>\u<i>XXXX</i></code>. For example,<br/><code>["w&isin;L&#10234;y(&#8739;y&#8739;&le;&#8739;w&#8739;)"]</code><br/>becomes:<br/><code>["w\u2208L\u27fa\u2203y(\u2223y\u2223\u2264\u2223w\u2223)"]</code></td></tr>
<tr><td valign="top"><code>JKSerializeOptionEscapeForwardSlashes</code></td><td>According to the <a href="http://tools.ietf.org/html/rfc4627">JSON specification</a>, the <code>/</code> (<code>U+002F</code>) character may be backslash escaped (i.e., <code>\/</code>), but it is not required. The default behavior of JSONKit is to <b><i>not</i></b> backslash escape the <code>/</code> character. Unfortunately, it was found some real world implementations of the <a href="http://weblogs.asp.net/bleroy/archive/2008/01/18/dates-and-json.aspx">ASP.NET Date Format</a> require the date to be <i>strictly</i> encoded as <code>\/Date(...)\/</code>, and the only way to achieve this is through the use of <code>JKSerializeOptionEscapeForwardSlashes</code>. See <a href="https://github.com/johnezang/JSONKit/issues/21">github issue #21</a> for more information.</td></tr>
</table>
[JSON]: http://www.json.org/
[RFC 4627]: http://tools.ietf.org/html/rfc4627
[RFC 2119]: http://tools.ietf.org/html/rfc2119
[Single Precision]: http://en.wikipedia.org/wiki/Single_precision_floating-point_format
[Double Precision]: http://en.wikipedia.org/wiki/Double_precision_floating-point_format
[wiki_invariant]: http://en.wikipedia.org/wiki/Invariant_(computer_science)
[ARC]: http://clang.llvm.org/docs/AutomaticReferenceCounting.html
[CFBoolean]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/index.html
[kCFBooleanTrue]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFBooleanTrue
[kCFBooleanFalse]: http://developer.apple.com/mac/library/documentation/CoreFoundation/Reference/CFBooleanRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFBooleanFalse
[kCFNumberDoubleType]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFNumberRef/Reference/reference.html#//apple_ref/doc/c_ref/kCFNumberDoubleType
[CFNumberGetValue]: http://developer.apple.com/library/mac/documentation/CoreFoundation/Reference/CFNumberRef/Reference/reference.html#//apple_ref/c/func/CFNumberGetValue
[Unicode Standard]: http://www.unicode.org/versions/Unicode6.0.0/
[Unicode Standard - Conformance]: http://www.unicode.org/versions/Unicode6.0.0/ch03.pdf
[Unicode_equivalence]: http://en.wikipedia.org/wiki/Unicode_equivalence
[UnicodeNewline]: http://en.wikipedia.org/wiki/Newline#Unicode
[Unicode_UTR36]: http://www.unicode.org/reports/tr36/
[Unicode_UTR36_NonVisualSecurity]: http://www.unicode.org/reports/tr36/#Canonical_Represenation
[Unicode_UTR36_Deleting]: http://www.unicode.org/reports/tr36/#Deletion_of_Noncharacters
[Unicode_Security_FAQ]: http://www.unicode.org/faq/security.html
[NSNull]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSNull_Class/index.html
[NSNumber]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/index.html
[NSNumber_numberWithBool]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Reference.html#//apple_ref/occ/clm/NSNumber/numberWithBool:
[NSString]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/index.html
[NSString_initWithBytes]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/initWithBytes:length:encoding:
[NSString_initWithData]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/initWithData:encoding:
[NSString_UTF8String]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/occ/instm/NSString/UTF8String
[NSArray]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/index.html
[NSDictionary]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSDictionary_Class/index.html
[NSError]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSError_Class/index.html
[NSData]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSData_Class/index.html
[NSMutableData]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSMutableData_Class/index.html
[NSInvalidArgumentException]: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Constants/Reference/reference.html#//apple_ref/doc/c_ref/NSInvalidArgumentException
[CFString]: http://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFStringRef/Reference/reference.html
[NSCParameterAssert]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html#//apple_ref/c/macro/NSCParameterAssert
[-mutableCopy]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html%23//apple_ref/occ/instm/NSObject/mutableCopy
[-isKindOfClass:]: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Protocols/NSObject_Protocol/Reference/NSObject.html%23//apple_ref/occ/intfm/NSObject/isKindOfClass:
[-objCType]: http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSNumber_Class/Reference/Reference.html#//apple_ref/occ/instm/NSNumber/objCType
[strtoll]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtoll.3.html
[strtod]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtod.3.html
[strtoull]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/strtoull.3.html
[getrusage]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/getrusage.2.html
[printf]: http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/printf.3.html
[NSJSONSerialization]: http://developer.apple.com/library/ios/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html
# Acknowledgements
This application makes use of the following third party libraries:
## Reachability
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Generated by CocoaPods - http://cocoapods.org
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</string>
<key>Title</key>
<string>Reachability</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#!/bin/sh
install_resource()
{
case $1 in
*.storyboard)
echo "ibtool --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 --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 --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 --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 "rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -rp "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*)
echo "cp -R ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
;;
esac
}
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS}
OTHER_LDFLAGS = -ObjC -framework SystemConfiguration
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/JSONKit" "${PODS_ROOT}/BuildHeaders/Reachability"
PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/JSONKit" "${PODS_ROOT}/Headers/Reachability"
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>0983CE7C630A4595BB31F737</key>
<dict>
<key>children</key>
<array>
<string>AF757137E37D41A4A2EB630D</string>
<string>DD920C2C00444195BDE346CB</string>
<string>E3899BD0E3044CAF9C37C1C8</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>0C31F3CF8CCB424C983964AF</key>
<dict>
<key>fileRef</key>
<string>611D185BF13D4660BF733DCA</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>0D20137EBBF245E2B91D9170</key>
<dict>
<key>fileRef</key>
<string>58F23E57B9A845C6ABB58C29</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict>
<key>COMPILER_FLAGS</key>
<string>-fobjc-arc -DOS_OBJECT_USE_OBJC=0</string>
</dict>
</dict>
<key>165F9AE1F7C94DBDAEE04D9C</key>
<dict>
<key>children</key>
<array>
<string>611D185BF13D4660BF733DCA</string>
<string>58F23E57B9A845C6ABB58C29</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Reachability</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>20933AC1FC8746B9839CB103</key>
<dict>
<key>children</key>
<array>
<string>883449757312410E8C3924EA</string>
<string>165F9AE1F7C94DBDAEE04D9C</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>2DE123CAED384121B435A671</key>
<dict>
<key>children</key>
<array>
<string>0983CE7C630A4595BB31F737</string>
<string>44BA96265DF144E0AD5C1F72</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Targets Support Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>2E7F9198573A43A1AB5B882A</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>JSONKit.m</string>
<key>path</key>
<string>JSONKit/JSONKit.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>364EA48A7695478C93156020</key>
<dict>
<key>fileRef</key>
<string>44E2AB06D4CB45369F4FE1CE</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>44BA96265DF144E0AD5C1F72</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>PodsDummy_Pods.m</string>
<key>path</key>
<string>PodsDummy_Pods.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>44E2AB06D4CB45369F4FE1CE</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>JSONKit.h</string>
<key>path</key>
<string>JSONKit/JSONKit.h</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>58F23E57B9A845C6ABB58C29</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>Reachability.m</string>
<key>path</key>
<string>Reachability/Reachability.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>5E550BC5C85F4B18B782C782</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>611D185BF13D4660BF733DCA</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>Reachability.h</string>
<key>path</key>
<string>Reachability/Reachability.h</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>6A3BDA181F324096B364CD72</key>
<dict>
<key>attributes</key>
<dict>
<key>LastUpgradeCheck</key>
<string>0450</string>
</dict>
<key>buildConfigurationList</key>
<string>A0FD9B07B68E4C1286BA65E7</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>B1FCD6BF220940C0BA1277CE</string>
<key>productRefGroup</key>
<string>E0A7DB051AC442A1A8851AB7</string>
<key>projectReferences</key>
<array/>
<key>targets</key>
<array>
<string>8B4407ED0FE641D1B550464C</string>
</array>
</dict>
<key>6B0F6B46C29C4EFC91779099</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>71B2F0E3AAA94957828A6936</key>
<dict>
<key>children</key>
<array>
<string>7B568D3E86F74479AD2E14E4</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>779F93CEABEC4228B7C466E5</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>364EA48A7695478C93156020</string>
<string>0C31F3CF8CCB424C983964AF</string>
</array>
<key>isa</key>
<string>PBXHeadersBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>7B568D3E86F74479AD2E14E4</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>DEVELOPER_DIR</string>
</dict>
<key>883449757312410E8C3924EA</key>
<dict>
<key>children</key>
<array>
<string>44E2AB06D4CB45369F4FE1CE</string>
<string>2E7F9198573A43A1AB5B882A</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>JSONKit</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>8B2E989BA06A420DA7196E86</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>8B4407ED0FE641D1B550464C</key>
<dict>
<key>buildConfigurationList</key>
<string>C1ABDED7B2C5416CBE0E2B45</string>
<key>buildPhases</key>
<array>
<string>AA4CA4365CBD412BBEE49978</string>
<string>F5D7534C9B524F0FA3C245AB</string>
<string>779F93CEABEC4228B7C466E5</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>Pods</string>
<key>productName</key>
<string>Pods</string>
<key>productReference</key>
<string>6B0F6B46C29C4EFC91779099</string>
<key>productType</key>
<string>com.apple.product-type.library.static</string>
</dict>
<key>8EAC792AE5AB4D7FA7BDE0BB</key>
<dict>
<key>baseConfigurationReference</key>
<string>E3899BD0E3044CAF9C37C1C8</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>A0FD9B07B68E4C1286BA65E7</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>8B2E989BA06A420DA7196E86</string>
<string>5E550BC5C85F4B18B782C782</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>A30ECD3B8FD646658EDB9499</key>
<dict>
<key>baseConfigurationReference</key>
<string>E3899BD0E3044CAF9C37C1C8</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
<key>VALIDATE_PRODUCT</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>AA4CA4365CBD412BBEE49978</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>D13A06C258EF4BDA9FFAB6AA</string>
<string>0D20137EBBF245E2B91D9170</string>
<string>C0D4D8128F21403083EC3F5B</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>AF757137E37D41A4A2EB630D</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-resources.sh</string>
<key>path</key>
<string>Pods-resources.sh</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>B1FCD6BF220940C0BA1277CE</key>
<dict>
<key>children</key>
<array>
<string>E0A7DB051AC442A1A8851AB7</string>
<string>71B2F0E3AAA94957828A6936</string>
<string>20933AC1FC8746B9839CB103</string>
<string>2DE123CAED384121B435A671</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>C0D4D8128F21403083EC3F5B</key>
<dict>
<key>fileRef</key>
<string>44BA96265DF144E0AD5C1F72</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>C1ABDED7B2C5416CBE0E2B45</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>A30ECD3B8FD646658EDB9499</string>
<string>8EAC792AE5AB4D7FA7BDE0BB</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>D13A06C258EF4BDA9FFAB6AA</key>
<dict>
<key>fileRef</key>
<string>2E7F9198573A43A1AB5B882A</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict>
<key>COMPILER_FLAGS</key>
<string>-Wno-deprecated-objc-isa-usage -Wno-format</string>
</dict>
</dict>
<key>DD920C2C00444195BDE346CB</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-prefix.pch</string>
<key>path</key>
<string>Pods-prefix.pch</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>E0A7DB051AC442A1A8851AB7</key>
<dict>
<key>children</key>
<array>
<string>6B0F6B46C29C4EFC91779099</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E3899BD0E3044CAF9C37C1C8</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>ECA55F95AFF743A6B0A70FCC</key>
<dict>
<key>fileRef</key>
<string>7B568D3E86F74479AD2E14E4</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>F5D7534C9B524F0FA3C245AB</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>ECA55F95AFF743A6B0A70FCC</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
</dict>
<key>rootObject</key>
<string>6A3BDA181F324096B364CD72</string>
</dict>
</plist>
@interface PodsDummy_Pods : NSObject
@end
@implementation PodsDummy_Pods
@end
# Reachability
This is a drop-in replacement for Apples Reachability class. It is ARC compatible, uses the new GCD methods to notify of network interface changes.
In addition to the standard NSNotification it supports the use of Blocks for when the network becomes reachable and unreachable.
Finally you can specify wether or not a WWAN connection is considered "reachable".
## A Simple example
This sample uses Blocks to tell you when the interface state has changed. The blocks will be called on a BACKGROUND THREAD so you need to dispatch UI updates onto the main thread.
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// set the blocks
reach.reachableBlock = ^(Reachability*reach)
{
NSLog(@"REACHABLE!");
};
reach.unreachableBlock = ^(Reachability*reach)
{
NSLog(@"UNREACHABLE!");
};
// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];
## Another simple example
This sample will use NSNotifications to tell you when the interface has changed, they will be delivered on the MAIN THREAD so you *can* do UI updates from within the function.
In addition it asks the Reachability object to consider the WWAN (3G/EDGE/CDMA) as a non-reachable connection (you might use this if you are writing a video streaming app, for example, to save the users data plan).
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// tell the reachability that we DONT want to be reachable on 3G/EDGE/CDMA
reach.reachableOnWWAN = NO;
// here we set up a NSNotification observer. The Reachability that caused the notification
// is passed in the object parameter
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
[reach startNotifier]
\ No newline at end of file
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import "Reachability.h"
NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification";
@interface Reachability ()
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
#if NEEDS_DISPATCH_RETAIN_RELEASE
@property (nonatomic, assign) dispatch_queue_t reachabilitySerialQueue;
#else
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
#endif
@property (nonatomic, strong) id reachabilityObject;
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags;
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
@end
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
{
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
#if TARGET_OS_IPHONE
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
#else
'X',
#endif
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
}
//Start listening for reachability notifications on the current run loop
static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
#pragma unused (target)
#if __has_feature(objc_arc)
Reachability *reachability = ((__bridge Reachability*)info);
#else
Reachability *reachability = ((Reachability*)info);
#endif
// we probably dont need an autoreleasepool here as GCD docs state each queue has its own autorelease pool
// but what the heck eh?
@autoreleasepool
{
[reachability reachabilityChanged:flags];
}
}
@implementation Reachability
@synthesize reachabilityRef;
@synthesize reachabilitySerialQueue;
@synthesize reachableOnWWAN;
@synthesize reachableBlock;
@synthesize unreachableBlock;
@synthesize reachabilityObject;
#pragma mark - class constructor methods
+(Reachability*)reachabilityWithHostname:(NSString*)hostname
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress:&zeroAddress];
}
+(Reachability*)reachabilityForLocalWiFi
{
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
return [self reachabilityWithAddress:&localWifiAddress];
}
// initialization methods
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref
{
self = [super init];
if (self != nil)
{
self.reachableOnWWAN = YES;
self.reachabilityRef = ref;
}
return self;
}
-(void)dealloc
{
[self stopNotifier];
if(self.reachabilityRef)
{
CFRelease(self.reachabilityRef);
self.reachabilityRef = nil;
}
self.reachableBlock = nil;
self.unreachableBlock = nil;
#if !(__has_feature(objc_arc))
[super dealloc];
#endif
}
#pragma mark - notifier methods
// Notifier
// NOTE: this uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD
// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS.
// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want)
-(BOOL)startNotifier
{
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
// this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves
// woah
self.reachabilityObject = self;
// first we need to create a serial queue
// we allocate this once for the lifetime of the notifier
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
if(!self.reachabilitySerialQueue)
{
return NO;
}
#if __has_feature(objc_arc)
context.info = (__bridge void *)self;
#else
context.info = (void *)self;
#endif
if (!SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
#endif
//clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
// set it as our reachability queue which will retain the queue
if(!SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
#endif
//UH OH - FAILURE!
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// then clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
return YES;
}
-(void)stopNotifier
{
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// unregister target from the GCD serial dispatch queue
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
}
#pragma mark - reachability tests
// this is for the case where you flick the airplane mode
// you end up getting something like this:
//Reachability: WR ct-----
//Reachability: -- -------
//Reachability: WR ct-----
//Reachability: -- -------
// we treat this as 4 UNREACHABLE triggers - really apple should do better than this
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags
{
BOOL connectionUP = YES;
if(!(flags & kSCNetworkReachabilityFlagsReachable))
connectionUP = NO;
if( (flags & testcase) == testcase )
connectionUP = NO;
#if TARGET_OS_IPHONE
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
// we're on 3G
if(!self.reachableOnWWAN)
{
// we dont want to connect when on 3G
connectionUP = NO;
}
}
#endif
return connectionUP;
}
-(BOOL)isReachable
{
SCNetworkReachabilityFlags flags;
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
return NO;
return [self isReachableWithFlags:flags];
}
-(BOOL)isReachableViaWWAN
{
#if TARGET_OS_IPHONE
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're REACHABLE
if(flags & kSCNetworkReachabilityFlagsReachable)
{
// now, check we're on WWAN
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
return YES;
}
}
}
#endif
return NO;
}
-(BOOL)isReachableViaWiFi
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're reachable
if((flags & kSCNetworkReachabilityFlagsReachable))
{
#if TARGET_OS_IPHONE
// check we're NOT on WWAN
if((flags & kSCNetworkReachabilityFlagsIsWWAN))
{
return NO;
}
#endif
return YES;
}
}
return NO;
}
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired
{
return [self connectionRequired];
}
-(BOOL)connectionRequired
{
SCNetworkReachabilityFlags flags;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
}
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
}
return NO;
}
// Is user intervention required?
-(BOOL)isInterventionRequired
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
}
return NO;
}
#pragma mark - reachability status stuff
-(NetworkStatus)currentReachabilityStatus
{
if([self isReachable])
{
if([self isReachableViaWiFi])
return ReachableViaWiFi;
#if TARGET_OS_IPHONE
return ReachableViaWWAN;
#endif
}
return NotReachable;
}
-(SCNetworkReachabilityFlags)reachabilityFlags
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return flags;
}
return 0;
}
-(NSString*)currentReachabilityString
{
NetworkStatus temp = [self currentReachabilityStatus];
if(temp == reachableOnWWAN)
{
// updated for the fact we have CDMA phones now!
return NSLocalizedString(@"Cellular", @"");
}
if (temp == ReachableViaWiFi)
{
return NSLocalizedString(@"WiFi", @"");
}
return NSLocalizedString(@"No Connection", @"");
}
-(NSString*)currentReachabilityFlags
{
return reachabilityFlags([self reachabilityFlags]);
}
#pragma mark - callback function calls this method
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags
{
if([self isReachableWithFlags:flags])
{
if(self.reachableBlock)
{
self.reachableBlock(self);
}
}
else
{
if(self.unreachableBlock)
{
self.unreachableBlock(self);
}
}
// this makes sure the change notification happens on the MAIN THREAD
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification
object:self];
});
}
@end
Pod::Spec.new do |s|
s.name = 'Reachability'
s.version = '3.1.0'
s.license = 'BSD'
s.homepage = 'https://github.com/tonymillion/Reachability'
s.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
s.summary = 'ARC and GCD Compatible Reachability Class for iOS. Drop in replacement for Apple Reachability.'
s.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
s.source_files = 'Reachability.{h,m}'
s.framework = 'SystemConfiguration'
s.requires_arc = false
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>061523DA9D2646ACA1EF295C</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>0AEC166B36EA4BBAB35AEB94</key>
<dict>
<key>fileRef</key>
<string>061523DA9D2646ACA1EF295C</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>26E99B1E26B641169EE1B5F6</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array/>
<key>inputPaths</key>
<array/>
<key>isa</key>
<string>PBXShellScriptBuildPhase</string>
<key>name</key>
<string>Copy Pods Resources</string>
<key>outputPaths</key>
<array/>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
<key>shellPath</key>
<string>/bin/sh</string>
<key>shellScript</key>
<string>"${SRCROOT}/Pods/Pods-resources.sh"
</string>
<key>showEnvVarsInLog</key>
<string>1</string>
</dict>
<key>E575589216C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A416C5943000DC1500</string>
<string>E575589D16C5943000DC1500</string>
<string>E575589C16C5943000DC1500</string>
<string>EFF75FAF8D54497F8417E948</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589316C5943000DC1500</key>
<dict>
<key>attributes</key>
<dict>
<key>CLASSPREFIX</key>
<string>CP</string>
<key>LastUpgradeCheck</key>
<string>0460</string>
<key>ORGANIZATIONNAME</key>
<string>CocoaPods</string>
</dict>
<key>buildConfigurationList</key>
<string>E575589616C5943000DC1500</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>E575589216C5943000DC1500</string>
<key>productRefGroup</key>
<string>E575589C16C5943000DC1500</string>
<key>projectDirPath</key>
<string></string>
<key>projectReferences</key>
<array/>
<key>projectRoot</key>
<string></string>
<key>targets</key>
<array>
<string>E575589A16C5943000DC1500</string>
</array>
</dict>
<key>E575589616C5943000DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B616C5943100DC1500</string>
<string>E57558B716C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E575589716C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558AB16C5943000DC1500</string>
<string>E57558B216C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589816C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E575589F16C5943000DC1500</string>
<string>0AEC166B36EA4BBAB35AEB94</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589916C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558A916C5943000DC1500</string>
<string>E57558AF16C5943000DC1500</string>
<string>E57558B516C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXResourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589A16C5943000DC1500</key>
<dict>
<key>buildConfigurationList</key>
<string>E57558B816C5943100DC1500</string>
<key>buildPhases</key>
<array>
<string>E575589716C5943000DC1500</string>
<string>E575589816C5943000DC1500</string>
<string>E575589916C5943000DC1500</string>
<string>26E99B1E26B641169EE1B5F6</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>SampleApp</string>
<key>productName</key>
<string>SampleApp</string>
<key>productReference</key>
<string>E575589B16C5943000DC1500</string>
<key>productType</key>
<string>com.apple.product-type.application</string>
</dict>
<key>E575589B16C5943000DC1500</key>
<dict>
<key>explicitFileType</key>
<string>wrapper.application</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>SampleApp.app</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>E575589C16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589B16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589D16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589E16C5943000DC1500</string>
<string>E57558A016C5943000DC1500</string>
<string>061523DA9D2646ACA1EF295C</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589E16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Cocoa.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Cocoa.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E575589F16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E575589E16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558A016C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A116C5943000DC1500</string>
<string>E57558A216C5943000DC1500</string>
<string>E57558A316C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Other Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>AppKit.framework</string>
<key>path</key>
<string>System/Library/Frameworks/AppKit.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A216C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>CoreData.framework</string>
<key>path</key>
<string>System/Library/Frameworks/CoreData.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A316C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A416C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B016C5943000DC1500</string>
<string>E57558B116C5943000DC1500</string>
<string>E57558B316C5943100DC1500</string>
<string>E57558A516C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>path</key>
<string>SampleApp</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A516C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A616C5943000DC1500</string>
<string>E57558A716C5943000DC1500</string>
<string>E57558AA16C5943000DC1500</string>
<string>E57558AC16C5943000DC1500</string>
<string>E57558AD16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Supporting Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A616C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.xml</string>
<key>path</key>
<string>SampleApp-Info.plist</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A716C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A816C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A816C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.strings</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A916C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558A716C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AA16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>main.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AB16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AA16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AC16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>SampleApp-Prefix.pch</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AD16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558AE16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AE16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.rtf</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AF16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AD16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B016C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>CPAppDelegate.h</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>CPAppDelegate.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B216C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B116C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B316C5943100DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B416C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B416C5943100DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>file.xib</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B516C5943100DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B316C5943100DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B616C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>ONLY_ACTIVE_ARCH</key>
<string>YES</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558B716C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>E57558B816C5943100DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B916C5943100DC1500</string>
<string>E57558BA16C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E57558B916C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558BA16C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>EFF75FAF8D54497F8417E948</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods/Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
</dict>
<key>rootObject</key>
<string>E575589316C5943000DC1500</string>
</dict>
</plist>
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:Pods/Pods.xcodeproj'/><FileRef location='group:SampleApp.xcodeproj'/></Workspace>
\ No newline at end of file
Pod::Spec.new do |s|
s.name = 'Reachability'
s.version = '3.1.0'
s.license = 'BSD'
s.homepage = 'https://github.com/tonymillion/Reachability'
s.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
s.summary = 'ARC and GCD Compatible Reachability Class for iOS. Drop in replacement for Apple Reachability.'
s.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
s.source_files = 'Reachability.{h,m}'
s.framework = 'SystemConfiguration'
s.requires_arc = false
end
$ pod spec lint --quick --verbose --no-color
-> Reachability -> Reachability (3.1.0)
Analyzed 1 podspec.
Reachability.podspec passed validation.
platform :ios, '6.0'
pod "Reachability", "<= 3.1.0"
PODS:
- Reachability (3.1.0)
DEPENDENCIES:
- Reachability (<= 3.1.0)
SPEC CHECKSUMS:
Reachability: 1c8584c5f26fa776695efef95caaa50402c94cfb
COCOAPODS: 0.16.2
../../Reachability/Reachability.h
\ No newline at end of file
../../Reachability/Reachability.h
\ No newline at end of file
# Acknowledgements
This application makes use of the following third party libraries:
## Reachability
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Generated by CocoaPods - http://cocoapods.org
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</string>
<key>Title</key>
<string>Reachability</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#!/bin/sh
install_resource()
{
case $1 in
*.storyboard)
echo "ibtool --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 --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 --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 --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 "rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -rp "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*)
echo "cp -R ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
;;
esac
}
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS}
OTHER_LDFLAGS = -ObjC -framework SystemConfiguration
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/Reachability"
PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Reachability"
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>01BB858C1B5749DF8E4A36BD</key>
<dict>
<key>children</key>
<array>
<string>EF535262F0134684BA9CBFCE</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>0FC419F8D0D14CF2A71C5243</key>
<dict>
<key>children</key>
<array>
<string>BDDD2172739E4BEBB253DE4A</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>1645F0459F1F4018A7987158</key>
<dict>
<key>baseConfigurationReference</key>
<string>E8C0250628194C5CB1FBA1DC</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>20F501275742432C878263E0</key>
<dict>
<key>fileRef</key>
<string>66486C84E094434699CD0FE7</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>35552C796ADD43AB85E0FF1F</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>3BCB1619B7FA4283AEFDB0AA</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>480529539EBC41B181161FF7</string>
<string>20F501275742432C878263E0</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>3F835A6F916841F08BED93A1</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>5E0D8EDC6C854EA698251948</string>
<string>1645F0459F1F4018A7987158</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>46D81C6BB0EB4E62B2A52A6E</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>35552C796ADD43AB85E0FF1F</string>
<string>4DD5DFE0BE4E44F7895E011A</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>480529539EBC41B181161FF7</key>
<dict>
<key>fileRef</key>
<string>CA9426396F4E46B08E417445</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict>
<key>COMPILER_FLAGS</key>
<string>-fobjc-arc -DOS_OBJECT_USE_OBJC=0</string>
</dict>
</dict>
<key>4A4C4BFFCBF4458FBD9D1A3C</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>C5B43C28833B41788E8F5AC5</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>4DD5DFE0BE4E44F7895E011A</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>5E0D8EDC6C854EA698251948</key>
<dict>
<key>baseConfigurationReference</key>
<string>E8C0250628194C5CB1FBA1DC</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
<key>VALIDATE_PRODUCT</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>66486C84E094434699CD0FE7</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>PodsDummy_Pods.m</string>
<key>path</key>
<string>PodsDummy_Pods.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>6E037E196E3440598869BCF0</key>
<dict>
<key>buildConfigurationList</key>
<string>3F835A6F916841F08BED93A1</string>
<key>buildPhases</key>
<array>
<string>3BCB1619B7FA4283AEFDB0AA</string>
<string>4A4C4BFFCBF4458FBD9D1A3C</string>
<string>9F610EF6420F475DB734E12B</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>Pods</string>
<key>productName</key>
<string>Pods</string>
<key>productReference</key>
<string>BDDD2172739E4BEBB253DE4A</string>
<key>productType</key>
<string>com.apple.product-type.library.static</string>
</dict>
<key>734EE7FB5D3346AAAA63F7F8</key>
<dict>
<key>children</key>
<array>
<string>C394347CF8C24EAE836832EF</string>
<string>C692063254334A6088692F19</string>
<string>E8C0250628194C5CB1FBA1DC</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>7C79F793D3BF404DA775D395</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>Reachability.h</string>
<key>path</key>
<string>Reachability/Reachability.h</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>8EFF01346ADE4170BD738F1E</key>
<dict>
<key>fileRef</key>
<string>7C79F793D3BF404DA775D395</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>9F610EF6420F475DB734E12B</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>8EFF01346ADE4170BD738F1E</string>
</array>
<key>isa</key>
<string>PBXHeadersBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>AAE911682BF04CFF98E06801</key>
<dict>
<key>children</key>
<array>
<string>C572989CAD3243D09D7C73BB</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>BDDD2172739E4BEBB253DE4A</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>C394347CF8C24EAE836832EF</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-resources.sh</string>
<key>path</key>
<string>Pods-resources.sh</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>C572989CAD3243D09D7C73BB</key>
<dict>
<key>children</key>
<array>
<string>7C79F793D3BF404DA775D395</string>
<string>CA9426396F4E46B08E417445</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Reachability</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>C5B43C28833B41788E8F5AC5</key>
<dict>
<key>fileRef</key>
<string>EF535262F0134684BA9CBFCE</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>C692063254334A6088692F19</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-prefix.pch</string>
<key>path</key>
<string>Pods-prefix.pch</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>CA9426396F4E46B08E417445</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>Reachability.m</string>
<key>path</key>
<string>Reachability/Reachability.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>E8C0250628194C5CB1FBA1DC</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>EF535262F0134684BA9CBFCE</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>DEVELOPER_DIR</string>
</dict>
<key>F7A055A9BF21479A8CF05FFB</key>
<dict>
<key>children</key>
<array>
<string>0FC419F8D0D14CF2A71C5243</string>
<string>01BB858C1B5749DF8E4A36BD</string>
<string>AAE911682BF04CFF98E06801</string>
<string>FD75BCD4EDB24EC7B3593ED5</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>F8824C18E2284095866DC9A1</key>
<dict>
<key>attributes</key>
<dict>
<key>LastUpgradeCheck</key>
<string>0450</string>
</dict>
<key>buildConfigurationList</key>
<string>46D81C6BB0EB4E62B2A52A6E</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>F7A055A9BF21479A8CF05FFB</string>
<key>productRefGroup</key>
<string>0FC419F8D0D14CF2A71C5243</string>
<key>projectReferences</key>
<array/>
<key>targets</key>
<array>
<string>6E037E196E3440598869BCF0</string>
</array>
</dict>
<key>FD75BCD4EDB24EC7B3593ED5</key>
<dict>
<key>children</key>
<array>
<string>734EE7FB5D3346AAAA63F7F8</string>
<string>66486C84E094434699CD0FE7</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Targets Support Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
</dict>
<key>rootObject</key>
<string>F8824C18E2284095866DC9A1</string>
</dict>
</plist>
@interface PodsDummy_Pods : NSObject
@end
@implementation PodsDummy_Pods
@end
# Reachability
This is a drop-in replacement for Apples Reachability class. It is ARC compatible, uses the new GCD methods to notify of network interface changes.
In addition to the standard NSNotification it supports the use of Blocks for when the network becomes reachable and unreachable.
Finally you can specify wether or not a WWAN connection is considered "reachable".
## A Simple example
This sample uses Blocks to tell you when the interface state has changed. The blocks will be called on a BACKGROUND THREAD so you need to dispatch UI updates onto the main thread.
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// set the blocks
reach.reachableBlock = ^(Reachability*reach)
{
NSLog(@"REACHABLE!");
};
reach.unreachableBlock = ^(Reachability*reach)
{
NSLog(@"UNREACHABLE!");
};
// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];
## Another simple example
This sample will use NSNotifications to tell you when the interface has changed, they will be delivered on the MAIN THREAD so you *can* do UI updates from within the function.
In addition it asks the Reachability object to consider the WWAN (3G/EDGE/CDMA) as a non-reachable connection (you might use this if you are writing a video streaming app, for example, to save the users data plan).
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// tell the reachability that we DONT want to be reachable on 3G/EDGE/CDMA
reach.reachableOnWWAN = NO;
// here we set up a NSNotification observer. The Reachability that caused the notification
// is passed in the object parameter
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(reachabilityChanged:)
name:kReachabilityChangedNotification
object:nil];
[reach startNotifier]
\ No newline at end of file
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
/**
* Does ARC support support GCD objects?
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
**/
#if TARGET_OS_IPHONE
// Compiling for iOS
#if __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000 // iOS 6.0 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else // iOS 5.X or earlier
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
#endif
#else
// Compiling for Mac OS X
#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 // Mac OS X 10.8 or later
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
#else
#define NEEDS_DISPATCH_RETAIN_RELEASE 1 // Mac OS X 10.7 or earlier
#endif
#endif
extern NSString *const kReachabilityChangedNotification;
typedef enum
{
// Apple NetworkStatus Compatible Names.
NotReachable = 0,
ReachableViaWiFi = 2,
ReachableViaWWAN = 1
} NetworkStatus;
@class Reachability;
typedef void (^NetworkReachable)(Reachability * reachability);
typedef void (^NetworkUnreachable)(Reachability * reachability);
@interface Reachability : NSObject
@property (nonatomic, copy) NetworkReachable reachableBlock;
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
@property (nonatomic, assign) BOOL reachableOnWWAN;
+(Reachability*)reachabilityWithHostname:(NSString*)hostname;
+(Reachability*)reachabilityForInternetConnection;
+(Reachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
+(Reachability*)reachabilityForLocalWiFi;
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
-(BOOL)startNotifier;
-(void)stopNotifier;
-(BOOL)isReachable;
-(BOOL)isReachableViaWWAN;
-(BOOL)isReachableViaWiFi;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired; // Identical DDG variant.
-(BOOL)connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand;
// Is user intervention required?
-(BOOL)isInterventionRequired;
-(NetworkStatus)currentReachabilityStatus;
-(SCNetworkReachabilityFlags)reachabilityFlags;
-(NSString*)currentReachabilityString;
-(NSString*)currentReachabilityFlags;
@end
/*
Copyright (c) 2011, Tony Million.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#import "Reachability.h"
NSString *const kReachabilityChangedNotification = @"kReachabilityChangedNotification";
@interface Reachability ()
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
#if NEEDS_DISPATCH_RETAIN_RELEASE
@property (nonatomic, assign) dispatch_queue_t reachabilitySerialQueue;
#else
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
#endif
@property (nonatomic, strong) id reachabilityObject;
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags;
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
@end
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
{
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
#if TARGET_OS_IPHONE
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
#else
'X',
#endif
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
}
//Start listening for reachability notifications on the current run loop
static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
{
#pragma unused (target)
#if __has_feature(objc_arc)
Reachability *reachability = ((__bridge Reachability*)info);
#else
Reachability *reachability = ((Reachability*)info);
#endif
// we probably dont need an autoreleasepool here as GCD docs state each queue has its own autorelease pool
// but what the heck eh?
@autoreleasepool
{
[reachability reachabilityChanged:flags];
}
}
@implementation Reachability
@synthesize reachabilityRef;
@synthesize reachabilitySerialQueue;
@synthesize reachableOnWWAN;
@synthesize reachableBlock;
@synthesize unreachableBlock;
@synthesize reachabilityObject;
#pragma mark - class constructor methods
+(Reachability*)reachabilityWithHostname:(NSString*)hostname
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
{
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
if (ref)
{
id reachability = [[self alloc] initWithReachabilityRef:ref];
#if __has_feature(objc_arc)
return reachability;
#else
return [reachability autorelease];
#endif
}
return nil;
}
+(Reachability *)reachabilityForInternetConnection
{
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
return [self reachabilityWithAddress:&zeroAddress];
}
+(Reachability*)reachabilityForLocalWiFi
{
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
return [self reachabilityWithAddress:&localWifiAddress];
}
// initialization methods
-(Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref
{
self = [super init];
if (self != nil)
{
self.reachableOnWWAN = YES;
self.reachabilityRef = ref;
}
return self;
}
-(void)dealloc
{
[self stopNotifier];
if(self.reachabilityRef)
{
CFRelease(self.reachabilityRef);
self.reachabilityRef = nil;
}
self.reachableBlock = nil;
self.unreachableBlock = nil;
#if !(__has_feature(objc_arc))
[super dealloc];
#endif
}
#pragma mark - notifier methods
// Notifier
// NOTE: this uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD
// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS.
// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want)
-(BOOL)startNotifier
{
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
// this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves
// woah
self.reachabilityObject = self;
// first we need to create a serial queue
// we allocate this once for the lifetime of the notifier
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
if(!self.reachabilitySerialQueue)
{
return NO;
}
#if __has_feature(objc_arc)
context.info = (__bridge void *)self;
#else
context.info = (void *)self;
#endif
if (!SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
#endif
//clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
// set it as our reachability queue which will retain the queue
if(!SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue))
{
#ifdef DEBUG
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
#endif
//UH OH - FAILURE!
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// then clear out the dispatch queue
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
return NO;
}
return YES;
}
-(void)stopNotifier
{
// first stop any callbacks!
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
// unregister target from the GCD serial dispatch queue
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
if(self.reachabilitySerialQueue)
{
#if NEEDS_DISPATCH_RETAIN_RELEASE
dispatch_release(self.reachabilitySerialQueue);
#endif
self.reachabilitySerialQueue = nil;
}
self.reachabilityObject = nil;
}
#pragma mark - reachability tests
// this is for the case where you flick the airplane mode
// you end up getting something like this:
//Reachability: WR ct-----
//Reachability: -- -------
//Reachability: WR ct-----
//Reachability: -- -------
// we treat this as 4 UNREACHABLE triggers - really apple should do better than this
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags
{
BOOL connectionUP = YES;
if(!(flags & kSCNetworkReachabilityFlagsReachable))
connectionUP = NO;
if( (flags & testcase) == testcase )
connectionUP = NO;
#if TARGET_OS_IPHONE
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
// we're on 3G
if(!self.reachableOnWWAN)
{
// we dont want to connect when on 3G
connectionUP = NO;
}
}
#endif
return connectionUP;
}
-(BOOL)isReachable
{
SCNetworkReachabilityFlags flags;
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
return NO;
return [self isReachableWithFlags:flags];
}
-(BOOL)isReachableViaWWAN
{
#if TARGET_OS_IPHONE
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're REACHABLE
if(flags & kSCNetworkReachabilityFlagsReachable)
{
// now, check we're on WWAN
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
{
return YES;
}
}
}
#endif
return NO;
}
-(BOOL)isReachableViaWiFi
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
// check we're reachable
if((flags & kSCNetworkReachabilityFlagsReachable))
{
#if TARGET_OS_IPHONE
// check we're NOT on WWAN
if((flags & kSCNetworkReachabilityFlagsIsWWAN))
{
return NO;
}
#endif
return YES;
}
}
return NO;
}
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
-(BOOL)isConnectionRequired
{
return [self connectionRequired];
}
-(BOOL)connectionRequired
{
SCNetworkReachabilityFlags flags;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
}
// Dynamic, on demand connection?
-(BOOL)isConnectionOnDemand
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
}
return NO;
}
// Is user intervention required?
-(BOOL)isInterventionRequired
{
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
}
return NO;
}
#pragma mark - reachability status stuff
-(NetworkStatus)currentReachabilityStatus
{
if([self isReachable])
{
if([self isReachableViaWiFi])
return ReachableViaWiFi;
#if TARGET_OS_IPHONE
return ReachableViaWWAN;
#endif
}
return NotReachable;
}
-(SCNetworkReachabilityFlags)reachabilityFlags
{
SCNetworkReachabilityFlags flags = 0;
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
return flags;
}
return 0;
}
-(NSString*)currentReachabilityString
{
NetworkStatus temp = [self currentReachabilityStatus];
if(temp == reachableOnWWAN)
{
// updated for the fact we have CDMA phones now!
return NSLocalizedString(@"Cellular", @"");
}
if (temp == ReachableViaWiFi)
{
return NSLocalizedString(@"WiFi", @"");
}
return NSLocalizedString(@"No Connection", @"");
}
-(NSString*)currentReachabilityFlags
{
return reachabilityFlags([self reachabilityFlags]);
}
#pragma mark - callback function calls this method
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags
{
if([self isReachableWithFlags:flags])
{
if(self.reachableBlock)
{
self.reachableBlock(self);
}
}
else
{
if(self.unreachableBlock)
{
self.unreachableBlock(self);
}
}
// this makes sure the change notification happens on the MAIN THREAD
dispatch_async(dispatch_get_main_queue(), ^{
[[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification
object:self];
});
}
@end
Pod::Spec.new do |s|
s.name = 'Reachability'
s.version = '3.1.0'
s.license = 'BSD'
s.homepage = 'https://github.com/tonymillion/Reachability'
s.authors = { 'Tony Million' => 'tonymillion@gmail.com' }
s.summary = 'ARC and GCD Compatible Reachability Class for iOS. Drop in replacement for Apple Reachability.'
s.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }
s.source_files = 'Reachability.{h,m}'
s.framework = 'SystemConfiguration'
s.requires_arc = false
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>061523DA9D2646ACA1EF295C</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>0AEC166B36EA4BBAB35AEB94</key>
<dict>
<key>fileRef</key>
<string>061523DA9D2646ACA1EF295C</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>26E99B1E26B641169EE1B5F6</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array/>
<key>inputPaths</key>
<array/>
<key>isa</key>
<string>PBXShellScriptBuildPhase</string>
<key>name</key>
<string>Copy Pods Resources</string>
<key>outputPaths</key>
<array/>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
<key>shellPath</key>
<string>/bin/sh</string>
<key>shellScript</key>
<string>"${SRCROOT}/Pods/Pods-resources.sh"
</string>
<key>showEnvVarsInLog</key>
<string>1</string>
</dict>
<key>E575589216C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A416C5943000DC1500</string>
<string>E575589D16C5943000DC1500</string>
<string>E575589C16C5943000DC1500</string>
<string>EFF75FAF8D54497F8417E948</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589316C5943000DC1500</key>
<dict>
<key>attributes</key>
<dict>
<key>CLASSPREFIX</key>
<string>CP</string>
<key>LastUpgradeCheck</key>
<string>0460</string>
<key>ORGANIZATIONNAME</key>
<string>CocoaPods</string>
</dict>
<key>buildConfigurationList</key>
<string>E575589616C5943000DC1500</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>E575589216C5943000DC1500</string>
<key>productRefGroup</key>
<string>E575589C16C5943000DC1500</string>
<key>projectDirPath</key>
<string></string>
<key>projectReferences</key>
<array/>
<key>projectRoot</key>
<string></string>
<key>targets</key>
<array>
<string>E575589A16C5943000DC1500</string>
</array>
</dict>
<key>E575589616C5943000DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B616C5943100DC1500</string>
<string>E57558B716C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E575589716C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558AB16C5943000DC1500</string>
<string>E57558B216C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589816C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E575589F16C5943000DC1500</string>
<string>0AEC166B36EA4BBAB35AEB94</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589916C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558A916C5943000DC1500</string>
<string>E57558AF16C5943000DC1500</string>
<string>E57558B516C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXResourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589A16C5943000DC1500</key>
<dict>
<key>buildConfigurationList</key>
<string>E57558B816C5943100DC1500</string>
<key>buildPhases</key>
<array>
<string>E575589716C5943000DC1500</string>
<string>E575589816C5943000DC1500</string>
<string>E575589916C5943000DC1500</string>
<string>26E99B1E26B641169EE1B5F6</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>SampleApp</string>
<key>productName</key>
<string>SampleApp</string>
<key>productReference</key>
<string>E575589B16C5943000DC1500</string>
<key>productType</key>
<string>com.apple.product-type.application</string>
</dict>
<key>E575589B16C5943000DC1500</key>
<dict>
<key>explicitFileType</key>
<string>wrapper.application</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>SampleApp.app</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>E575589C16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589B16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589D16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589E16C5943000DC1500</string>
<string>E57558A016C5943000DC1500</string>
<string>061523DA9D2646ACA1EF295C</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589E16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Cocoa.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Cocoa.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E575589F16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E575589E16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558A016C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A116C5943000DC1500</string>
<string>E57558A216C5943000DC1500</string>
<string>E57558A316C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Other Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>AppKit.framework</string>
<key>path</key>
<string>System/Library/Frameworks/AppKit.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A216C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>CoreData.framework</string>
<key>path</key>
<string>System/Library/Frameworks/CoreData.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A316C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A416C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B016C5943000DC1500</string>
<string>E57558B116C5943000DC1500</string>
<string>E57558B316C5943100DC1500</string>
<string>E57558A516C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>path</key>
<string>SampleApp</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A516C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A616C5943000DC1500</string>
<string>E57558A716C5943000DC1500</string>
<string>E57558AA16C5943000DC1500</string>
<string>E57558AC16C5943000DC1500</string>
<string>E57558AD16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Supporting Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A616C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.xml</string>
<key>path</key>
<string>SampleApp-Info.plist</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A716C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A816C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A816C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.strings</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A916C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558A716C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AA16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>main.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AB16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AA16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AC16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>SampleApp-Prefix.pch</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AD16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558AE16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AE16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.rtf</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AF16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AD16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B016C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>CPAppDelegate.h</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>CPAppDelegate.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B216C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B116C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B316C5943100DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B416C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B416C5943100DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>file.xib</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B516C5943100DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B316C5943100DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B616C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>ONLY_ACTIVE_ARCH</key>
<string>YES</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558B716C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>E57558B816C5943100DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B916C5943100DC1500</string>
<string>E57558BA16C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E57558B916C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558BA16C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>EFF75FAF8D54497F8417E948</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods/Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
</dict>
<key>rootObject</key>
<string>E575589316C5943000DC1500</string>
</dict>
</plist>
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:Pods/Pods.xcodeproj'/><FileRef location='group:SampleApp.xcodeproj'/></Workspace>
\ No newline at end of file
$ pod update --no-update --verbose --no-color
Resolving dependencies of `./Podfile'
Finding added, modified or removed dependencies:
- Reachability
Resolving dependencies for target `default' (iOS 6.0)
- Reachability (<= 3.1.0)
Downloading dependencies
-> Installing Reachability (3.1.0)
$ /usr/bin/git config core.bare
true
> Cloning git repo
$ /usr/bin/git rev-list --max-count=1 v3.1.0
f7176f4798d068d233dca5223ae4bd9c8059e830
$ /usr/bin/git init
Initialized empty Git repository in ROOT/tmp/Pods/Reachability/.git/
$ /usr/bin/git remote add origin 'CACHES_DIR/Git/48f11286750afa2e2eb80564e288f42eed7cbab6'
$ /usr/bin/git fetch origin tags/v3.1.0
$ /usr/bin/git reset --hard FETCH_HEAD
HEAD is now at f7176f4 updated podspec
$ /usr/bin/git checkout -b activated-pod-commit
> Using existing documentation
Generating support files
- Running pre install hooks
- Generating project
- Installing targets
- Generating xcconfig file at `./Pods/Pods.xcconfig'
- Generating prefix header at `./Pods/Pods-prefix.pch'
- Generating copy resources script at `./Pods/Pods-resources.sh'
- Running post install hooks
- Writing Xcode project file to `./Pods/Pods.xcodeproj'
- Writing lockfile in `./Podfile.lock'
platform :ios, '6.0'
pod "Reachability", "<= 3.1.0"
PODS:
- Reachability (2.0.5)
DEPENDENCIES:
- Reachability (= 2.0.5)
SPEC CHECKSUMS:
Reachability: 8d29c8365f72967b6decc8d2892a7d5dc6550799
COCOAPODS: 0.16.2
../../Reachability/Reachability.h
\ No newline at end of file
Documentation set was installed to Xcode!
Path: /Users/fabio/Library/Developer/Shared/Documentation/DocSets/org.cocoapods.Reachability-2.0.5.docset
Time: 2013-02-11 15:07:44 +0000
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleIdentifier</key>
<string>org.cocoapods.Reachability-2.0.5</string>
<key>CFBundleName</key>
<string>Reachability 2.0.5 Documentation</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>DocSetDescription</key>
<string>This is Apples example code of the SystemConfiguration Reachability APIs, adapted by Andrew Donoho, split-off from the ASIHTTPRequest source. (This code needs an actual maintainer.)</string>
<key>DocSetFeedName</key>
<string>Reachability 2.0.5 Documentation</string>
<key>DocSetMinimumXcodeVersion</key>
<string>3.0</string>
<key>DashDocSetFamily</key>
<string>appledoc</string>
<key>DocSetPublisherIdentifier</key>
<string>org.cocoapods.documentation</string>
<key>DocSetPublisherName</key>
<string>Apple and Donoho Design Group, LLC</string>
<key>NSHumanReadableCopyright</key>
<string>Apple and Donoho Design Group, LLC</string>
</dict>
</plist>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
<title>Reachability Class Reference</title>
<meta id="xcode-display" name="xcode-display" content="render"/>
<meta name="viewport" content="width=550" />
<link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
<meta name="generator" content="appledoc 2.0.5 (build 789)" />
</head>
<body>
<header id="top_header">
<div id="library" class="hideInXcode">
<h1><a id="libraryTitle" href="../index.html">Reachability 2.0.5 </a></h1>
<a id="developerHome" href="../index.html">Apple and Donoho Design Group, LLC</a>
</div>
<div id="title" role="banner">
<h1 class="hideInXcode">Reachability Class Reference</h1>
</div>
<ul id="headerButtons" role="toolbar">
<li id="toc_button">
<button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents"><span class="disclosure"></span>Table of Contents</button>
</li>
<li id="jumpto_button" role="navigation">
<select id="jumpTo">
<option value="top">Jump To&#133;</option>
<option value="tasks">Tasks</option>
<option value="properties">Properties</option>
<option value="//api/name/key">&nbsp;&nbsp;&nbsp;&nbsp;key</option>
<option value="class_methods">Class Methods</option>
<option value="//api/name/reachabilityForInternetConnection">&nbsp;&nbsp;&nbsp;&nbsp;+ reachabilityForInternetConnection</option>
<option value="//api/name/reachabilityForLocalWiFi">&nbsp;&nbsp;&nbsp;&nbsp;+ reachabilityForLocalWiFi</option>
<option value="//api/name/reachabilityWithAddress:">&nbsp;&nbsp;&nbsp;&nbsp;+ reachabilityWithAddress:</option>
<option value="//api/name/reachabilityWithHostName:">&nbsp;&nbsp;&nbsp;&nbsp;+ reachabilityWithHostName:</option>
<option value="instance_methods">Instance Methods</option>
<option value="//api/name/connectionRequired">&nbsp;&nbsp;&nbsp;&nbsp;- connectionRequired</option>
<option value="//api/name/currentReachabilityStatus">&nbsp;&nbsp;&nbsp;&nbsp;- currentReachabilityStatus</option>
<option value="//api/name/initWithReachabilityRef:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithReachabilityRef:</option>
<option value="//api/name/isConnectionOnDemand">&nbsp;&nbsp;&nbsp;&nbsp;- isConnectionOnDemand</option>
<option value="//api/name/isConnectionRequired">&nbsp;&nbsp;&nbsp;&nbsp;- isConnectionRequired</option>
<option value="//api/name/isEqual:">&nbsp;&nbsp;&nbsp;&nbsp;- isEqual:</option>
<option value="//api/name/isInterventionRequired">&nbsp;&nbsp;&nbsp;&nbsp;- isInterventionRequired</option>
<option value="//api/name/isReachable">&nbsp;&nbsp;&nbsp;&nbsp;- isReachable</option>
<option value="//api/name/isReachableViaWWAN">&nbsp;&nbsp;&nbsp;&nbsp;- isReachableViaWWAN</option>
<option value="//api/name/isReachableViaWiFi">&nbsp;&nbsp;&nbsp;&nbsp;- isReachableViaWiFi</option>
<option value="//api/name/reachabilityFlags">&nbsp;&nbsp;&nbsp;&nbsp;- reachabilityFlags</option>
<option value="//api/name/startNotifier">&nbsp;&nbsp;&nbsp;&nbsp;- startNotifier</option>
<option value="//api/name/stopNotifier">&nbsp;&nbsp;&nbsp;&nbsp;- stopNotifier</option>
</select>
</li>
</ul>
</header>
<nav id="tocContainer" class="isShowingTOC">
<ul id="toc" role="tree">
<li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
</ul></li>
<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#properties">Properties</a></span><ul>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/key">key</a></span></li>
</ul></li>
<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#class_methods">Class Methods</a></span><ul>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityForInternetConnection">reachabilityForInternetConnection</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityForLocalWiFi">reachabilityForLocalWiFi</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityWithAddress:">reachabilityWithAddress:</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityWithHostName:">reachabilityWithHostName:</a></span></li>
</ul></li>
<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectionRequired">connectionRequired</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/currentReachabilityStatus">currentReachabilityStatus</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithReachabilityRef:">initWithReachabilityRef:</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isConnectionOnDemand">isConnectionOnDemand</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isConnectionRequired">isConnectionRequired</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isEqual:">isEqual:</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isInterventionRequired">isInterventionRequired</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isReachable">isReachable</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isReachableViaWWAN">isReachableViaWWAN</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isReachableViaWiFi">isReachableViaWiFi</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityFlags">reachabilityFlags</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/startNotifier">startNotifier</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/stopNotifier">stopNotifier</a></span></li>
</ul></li>
</ul>
</nav>
<article>
<div id="contents" class="isShowingTOC" role="main">
<a title="Reachability Class Reference" name="top"></a>
<div class="main-navigation navigation-top">
<ul>
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
</div>
<div id="header">
<div class="section-header">
<h1 class="title title-header">Reachability Class Reference</h1>
</div>
</div>
<div id="container">
<div class="section section-specification"><table cellspacing="0"><tbody>
<tr>
<td class="specification-title">Inherits from</td>
<td class="specification-value">NSObject</td>
</tr><tr>
<td class="specification-title">Declared in</td>
<td class="specification-value">Reachability.h</td>
</tr>
</tbody></table></div>
<div class="section section-tasks">
<a title="Tasks" name="tasks"></a>
<h2 class="subtitle subtitle-tasks">Tasks</h2>
<ul class="task-list">
<li>
<span class="tooltip">
<code><a href="#//api/name/key">&nbsp;&nbsp;key</a></code>
</span>
<span class="task-item-suffix">property</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/initWithReachabilityRef:">&ndash;&nbsp;initWithReachabilityRef:</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityWithHostName:">+&nbsp;reachabilityWithHostName:</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityWithAddress:">+&nbsp;reachabilityWithAddress:</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityForInternetConnection">+&nbsp;reachabilityForInternetConnection</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityForLocalWiFi">+&nbsp;reachabilityForLocalWiFi</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/startNotifier">&ndash;&nbsp;startNotifier</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/stopNotifier">&ndash;&nbsp;stopNotifier</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isEqual:">&ndash;&nbsp;isEqual:</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/currentReachabilityStatus">&ndash;&nbsp;currentReachabilityStatus</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isReachable">&ndash;&nbsp;isReachable</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isConnectionRequired">&ndash;&nbsp;isConnectionRequired</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/connectionRequired">&ndash;&nbsp;connectionRequired</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isConnectionOnDemand">&ndash;&nbsp;isConnectionOnDemand</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isInterventionRequired">&ndash;&nbsp;isInterventionRequired</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isReachableViaWWAN">&ndash;&nbsp;isReachableViaWWAN</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isReachableViaWiFi">&ndash;&nbsp;isReachableViaWiFi</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityFlags">&ndash;&nbsp;reachabilityFlags</a></code>
</span>
</li>
</ul>
</div>
<div class="section section-methods">
<a title="Properties" name="properties"></a>
<h2 class="subtitle subtitle-methods">Properties</h2>
<div class="section-method">
<a name="//api/name/key" title="key"></a>
<h3 class="subsubtitle method-title">key</h3>
<div class="method-subsection method-declaration"><code>@property (copy) NSString *key</code></div>
</div>
</div>
<div class="section section-methods">
<a title="Class Methods" name="class_methods"></a>
<h2 class="subtitle subtitle-methods">Class Methods</h2>
<div class="section-method">
<a name="//api/name/reachabilityForInternetConnection" title="reachabilityForInternetConnection"></a>
<h3 class="subsubtitle method-title">reachabilityForInternetConnection</h3>
<div class="method-subsection method-declaration"><code>+ (Reachability *)reachabilityForInternetConnection</code></div>
</div>
<div class="section-method">
<a name="//api/name/reachabilityForLocalWiFi" title="reachabilityForLocalWiFi"></a>
<h3 class="subsubtitle method-title">reachabilityForLocalWiFi</h3>
<div class="method-subsection method-declaration"><code>+ (Reachability *)reachabilityForLocalWiFi</code></div>
</div>
<div class="section-method">
<a name="//api/name/reachabilityWithAddress:" title="reachabilityWithAddress:"></a>
<h3 class="subsubtitle method-title">reachabilityWithAddress:</h3>
<div class="method-subsection method-declaration"><code>+ (Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)<em>hostAddress</em></code></div>
</div>
<div class="section-method">
<a name="//api/name/reachabilityWithHostName:" title="reachabilityWithHostName:"></a>
<h3 class="subsubtitle method-title">reachabilityWithHostName:</h3>
<div class="method-subsection method-declaration"><code>+ (Reachability *)reachabilityWithHostName:(NSString *)<em>hostName</em></code></div>
</div>
</div>
<div class="section section-methods">
<a title="Instance Methods" name="instance_methods"></a>
<h2 class="subtitle subtitle-methods">Instance Methods</h2>
<div class="section-method">
<a name="//api/name/connectionRequired" title="connectionRequired"></a>
<h3 class="subsubtitle method-title">connectionRequired</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)connectionRequired</code></div>
</div>
<div class="section-method">
<a name="//api/name/currentReachabilityStatus" title="currentReachabilityStatus"></a>
<h3 class="subsubtitle method-title">currentReachabilityStatus</h3>
<div class="method-subsection method-declaration"><code>- (NetworkStatus)currentReachabilityStatus</code></div>
</div>
<div class="section-method">
<a name="//api/name/initWithReachabilityRef:" title="initWithReachabilityRef:"></a>
<h3 class="subsubtitle method-title">initWithReachabilityRef:</h3>
<div class="method-subsection method-declaration"><code>- (Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)<em>ref</em></code></div>
</div>
<div class="section-method">
<a name="//api/name/isConnectionOnDemand" title="isConnectionOnDemand"></a>
<h3 class="subsubtitle method-title">isConnectionOnDemand</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isConnectionOnDemand</code></div>
</div>
<div class="section-method">
<a name="//api/name/isConnectionRequired" title="isConnectionRequired"></a>
<h3 class="subsubtitle method-title">isConnectionRequired</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isConnectionRequired</code></div>
</div>
<div class="section-method">
<a name="//api/name/isEqual:" title="isEqual:"></a>
<h3 class="subsubtitle method-title">isEqual:</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isEqual:(Reachability *)<em>r</em></code></div>
</div>
<div class="section-method">
<a name="//api/name/isInterventionRequired" title="isInterventionRequired"></a>
<h3 class="subsubtitle method-title">isInterventionRequired</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isInterventionRequired</code></div>
</div>
<div class="section-method">
<a name="//api/name/isReachable" title="isReachable"></a>
<h3 class="subsubtitle method-title">isReachable</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isReachable</code></div>
</div>
<div class="section-method">
<a name="//api/name/isReachableViaWWAN" title="isReachableViaWWAN"></a>
<h3 class="subsubtitle method-title">isReachableViaWWAN</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isReachableViaWWAN</code></div>
</div>
<div class="section-method">
<a name="//api/name/isReachableViaWiFi" title="isReachableViaWiFi"></a>
<h3 class="subsubtitle method-title">isReachableViaWiFi</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isReachableViaWiFi</code></div>
</div>
<div class="section-method">
<a name="//api/name/reachabilityFlags" title="reachabilityFlags"></a>
<h3 class="subsubtitle method-title">reachabilityFlags</h3>
<div class="method-subsection method-declaration"><code>- (SCNetworkReachabilityFlags)reachabilityFlags</code></div>
</div>
<div class="section-method">
<a name="//api/name/startNotifier" title="startNotifier"></a>
<h3 class="subsubtitle method-title">startNotifier</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)startNotifier</code></div>
</div>
<div class="section-method">
<a name="//api/name/stopNotifier" title="stopNotifier"></a>
<h3 class="subsubtitle method-title">stopNotifier</h3>
<div class="method-subsection method-declaration"><code>- (void)stopNotifier</code></div>
</div>
</div>
</div>
<div class="main-navigation navigation-bottom">
<ul>
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
</div>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Apple and Donoho Design Group, LLC. All rights reserved. (Last updated: 2013-02-11)</span><br />
<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.0.5 (build 789)</a>.</span></p>
</div>
</div>
</div>
</article>
<script type="text/javascript">
function jumpToChange()
{
window.location.hash = this.options[this.selectedIndex].value;
}
function toggleTOC()
{
var contents = document.getElementById('contents');
var tocContainer = document.getElementById('tocContainer');
if (this.getAttribute('class') == 'open')
{
this.setAttribute('class', '');
contents.setAttribute('class', '');
tocContainer.setAttribute('class', '');
window.name = "hideTOC";
}
else
{
this.setAttribute('class', 'open');
contents.setAttribute('class', 'isShowingTOC');
tocContainer.setAttribute('class', 'isShowingTOC');
window.name = "";
}
return false;
}
function toggleTOCEntryChildren(e)
{
e.stopPropagation();
var currentClass = this.getAttribute('class');
if (currentClass == 'children') {
this.setAttribute('class', 'children open');
}
else if (currentClass == 'children open') {
this.setAttribute('class', 'children');
}
return false;
}
function tocEntryClick(e)
{
e.stopPropagation();
return true;
}
function init()
{
var selectElement = document.getElementById('jumpTo');
selectElement.addEventListener('change', jumpToChange, false);
var tocButton = document.getElementById('table_of_contents');
tocButton.addEventListener('click', toggleTOC, false);
var taskTreeItem = document.getElementById('task_treeitem');
if (taskTreeItem.getElementsByTagName('li').length > 0)
{
taskTreeItem.setAttribute('class', 'children');
taskTreeItem.firstChild.setAttribute('class', 'disclosure');
}
var tocList = document.getElementById('toc');
var tocEntries = tocList.getElementsByTagName('li');
for (var i = 0; i < tocEntries.length; i++) {
tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
}
var tocLinks = tocList.getElementsByTagName('a');
for (var i = 0; i < tocLinks.length; i++) {
tocLinks[i].addEventListener('click', tocEntryClick, false);
}
if (window.name == "hideTOC") {
toggleTOC.call(tocButton);
}
}
window.onload = init;
// If showing in Xcode, hide the TOC and Header
if (navigator.userAgent.match(/xcode/i)) {
document.getElementById("contents").className = "hideInXcode"
document.getElementById("tocContainer").className = "hideInXcode"
document.getElementById("top_header").className = "hideInXcode"
}
</script>
</body>
</html>
\ No newline at end of file
body {
font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
font-size: 13px;
}
code {
font-family: Courier, Consolas, monospace;
font-size: 13px;
color: #666;
}
pre {
font-family: Courier, Consolas, monospace;
font-size: 13px;
line-height: 18px;
tab-interval: 0.5em;
border: 1px solid #C7CFD5;
background-color: #F1F5F9;
color: #666;
padding: 0.3em 1em;
}
ul {
list-style-type: square;
}
li {
margin-bottom: 10px;
}
a, a code {
text-decoration: none;
color: #36C;
}
a:hover, a:hover code {
text-decoration: underline;
color: #36C;
}
h2 {
border-bottom: 1px solid #8391A8;
color: #3C4C6C;
font-size: 187%;
font-weight: normal;
margin-top: 1.75em;
padding-bottom: 2px;
}
table {
margin-bottom: 4em;
border-collapse:collapse;
vertical-align: middle;
}
td {
border: 1px solid #9BB3CD;
padding: .667em;
font-size: 100%;
}
th {
border: 1px solid #9BB3CD;
padding: .3em .667em .3em .667em;
background: #93A5BB;
font-size: 103%;
font-weight: bold;
color: white;
text-align: left;
}
/* @group Common page elements */
#top_header {
height: 91px;
left: 0;
min-width: 598px;
position: absolute;
right: 0;
top: 0;
z-index: 900;
}
#footer {
clear: both;
padding-top: 20px;
text-align: center;
}
#contents, #overview_contents {
-webkit-overflow-scrolling: touch;
border-top: 1px solid #2B334F;
position: absolute;
top: 91px;
left: 0;
right: 0;
bottom: 0;
overflow-x: hidden;
overflow-y: auto;
padding-left: 2em;
padding-right: 2em;
padding-top: 1em;
min-width: 550px;
}
#contents.isShowingTOC {
left: 230px;
min-width: 320px;
}
.copyright {
font-size: 12px;
}
.generator {
font-size: 11px;
}
.main-navigation ul li {
display: inline;
margin-left: 15px;
list-style: none;
}
.navigation-top {
clear: both;
float: right;
}
.navigation-bottom {
clear: both;
float: right;
margin-top: 20px;
margin-bottom: -10px;
}
.open > .disclosure {
background-image: url("../img/disclosure_open.png");
}
.disclosure {
background: url("../img/disclosure.png") no-repeat scroll 0 0;
}
.disclosure, .nodisclosure {
display: inline-block;
height: 8px;
margin-right: 5px;
position: relative;
width: 9px;
}
/* @end */
/* @group Header */
#top_header #library {
background: url("../img/library_background.png") repeat-x 0 0 #485E78;
background-color: #ccc;
height: 35px;
font-size: 115%;
}
#top_header #library #libraryTitle {
color: #FFFFFF;
margin-left: 15px;
text-shadow: 0 -1px 0 #485E78;
top: 8px;
position: absolute;
}
#top_header #library #developerHome {
color: #92979E;
right: 15px;
top: 8px;
position: absolute;
}
#top_header #library a:hover {
text-decoration: none;
}
#top_header #title {
background: url("../img/title_background.png") repeat-x 0 0 #8A98A9;
border-bottom: 1px solid #B6B6B6;
height: 25px;
overflow: hidden;
}
#top_header h1 {
font-size: 115%;
font-weight: normal;
margin: 0;
padding: 3px 0 2px;
text-align: center;
text-shadow: 0 1px 0 #D5D5D5;
white-space: nowrap;
}
#headerButtons {
background-color: #D8D8D8;
background-image: url("../img/button_bar_background.png");
border-bottom: 1px solid #EDEDED;
border-top: 1px solid #2B334F;
font-size: 8pt;
height: 28px;
left: 0;
list-style: none outside none;
margin: 0;
overflow: hidden;
padding: 0;
position: absolute;
right: 0;
top: 61px;
}
#headerButtons li {
background-repeat: no-repeat;
display: inline;
margin-top: 0;
margin-bottom: 0;
padding: 0;
}
#toc_button button {
border-color: #ACACAC;
border-style: none solid none none;
border-width: 0 1px 0 0;
height: 28px;
margin: 0;
padding-left: 30px;
text-align: left;
width: 230px;
}
li#jumpto_button {
left: 230px;
margin-left: 0;
position: absolute;
}
li#jumpto_button select {
height: 22px;
margin: 5px 2px 0 10px;
max-width: 300px;
}
/* @end */
/* @group Table of contents */
#tocContainer.isShowingTOC {
border-right: 1px solid #ACACAC;
display: block;
overflow-x: hidden;
overflow-y: auto;
padding: 0;
}
#tocContainer {
background-color: #E4EBF7;
border-top: 1px solid #2B334F;
bottom: 0;
display: none;
left: 0;
overflow: hidden;
position: absolute;
top: 91px;
width: 229px;
}
#tocContainer > ul#toc {
font-size: 11px;
margin: 0;
padding: 12px 0 18px;
width: 209px;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
#tocContainer > ul#toc > li {
margin: 0;
padding: 0 0 7px 30px;
text-indent: -15px;
}
#tocContainer > ul#toc > li > .sectionName a {
color: #000000;
font-weight: bold;
}
#tocContainer > ul#toc > li > .sectionName a:hover {
text-decoration: none;
}
#tocContainer > ul#toc li.children > ul {
display: none;
height: 0;
}
#tocContainer > ul#toc > li > ul {
margin: 0;
padding: 0;
}
#tocContainer > ul#toc > li > ul, ul#toc > li > ul > li {
margin-left: 0;
margin-bottom: 0;
padding-left: 15px;
}
#tocContainer > ul#toc > li ul {
list-style: none;
margin-right: 0;
padding-right: 0;
}
#tocContainer > ul#toc li.children.open > ul {
display: block;
height: auto;
margin-left: -15px;
padding-left: 0;
}
#tocContainer > ul#toc > li > ul, ul#toc > li > ul > li {
margin-left: 0;
padding-left: 15px;
}
#tocContainer li ul li {
margin-top: 0.583em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#tocContainer li ul li span.sectionName {
white-space: normal;
}
#tocContainer > ul#toc > li > ul > li > .sectionName a {
font-weight: bold;
}
#tocContainer > ul#toc > li > ul a {
color: #4F4F4F;
}
/* @end */
/* @group Index formatting */
.index-title {
font-size: 13px;
font-weight: normal;
}
.index-column {
float: left;
width: 30%;
min-width: 200px;
font-size: 11px;
}
.index-column ul {
margin: 8px 0 0 0;
padding: 0;
list-style: none;
}
.index-column ul li {
margin: 0 0 3px 0;
padding: 0;
}
.hierarchy-column {
min-width: 400px;
}
.hierarchy-column ul {
margin: 3px 0 0 15px;
}
.hierarchy-column ul li {
list-style-type: square;
}
/* @end */
/* @group Common formatting elements */
.title {
font-weight: normal;
font-size: 215%;
margin-top:0;
}
.subtitle {
font-weight: normal;
font-size: 180%;
color: #3C4C6C;
border-bottom: 1px solid #5088C5;
}
.subsubtitle {
font-weight: normal;
font-size: 145%;
height: 0.7em;
}
.note {
border: 1px solid #5088C5;
background-color: white;
margin: 1.667em 0 1.75em 0;
padding: 0 .667em .083em .750em;
}
.warning {
border: 1px solid #5088C5;
background-color: #F0F3F7;
margin-bottom: 0.5em;
padding: 0.3em 0.8em;
}
.bug {
border: 1px solid #000;
background-color: #ffffcc;
margin-bottom: 0.5em;
padding: 0.3em 0.8em;
}
.deprecated {
color: #F60425;
}
/* @end */
/* @group Common layout */
.section {
margin-top: 3em;
}
/* @end */
/* @group Object specification section */
.section-specification {
margin-left: 2.5em;
margin-right: 2.5em;
font-size: 12px;
}
.section-specification table {
margin-bottom: 0em;
border-top: 1px solid #d6e0e5;
}
.section-specification td {
vertical-align: top;
border-bottom: 1px solid #d6e0e5;
border-left-width: 0px;
border-right-width: 0px;
border-top-width: 0px;
padding: .6em;
}
.section-specification .specification-title {
font-weight: bold;
}
/* @end */
/* @group Tasks section */
.task-list {
list-style-type: none;
padding-left: 0px;
}
.task-list li {
margin-bottom: 3px;
}
.task-item-suffix {
color: #996;
font-size: 12px;
font-style: italic;
margin-left: 0.5em;
}
span.tooltip span.tooltip {
font-size: 1.0em;
display: none;
padding: 0.3em;
border: 1px solid #aaa;
background-color: #fdfec8;
color: #000;
text-align: left;
}
span.tooltip:hover span.tooltip {
display: block;
position: absolute;
margin-left: 2em;
}
/* @end */
/* @group Method section */
.section-method {
margin-top: 2.3em;
}
.method-title {
margin-bottom: 1.5em;
}
.method-subtitle {
margin-top: 0.7em;
margin-bottom: 0.2em;
}
.method-subsection p {
margin-top: 0.4em;
margin-bottom: 0.8em;
}
.method-declaration {
margin-top:1.182em;
margin-bottom:.909em;
}
.method-declaration code {
font:14px Courier, Consolas, monospace;
color:#000;
}
.declaration {
color: #000;
}
.argument-def {
margin-top: 0.3em;
margin-bottom: 0.3em;
}
.argument-def dd {
margin-left: 1.25em;
}
.see-also-section ul {
list-style-type: none;
padding-left: 0px;
margin-top: 0;
}
.see-also-section li {
margin-bottom: 3px;
}
.declared-in-ref {
color: #666;
}
#tocContainer.hideInXcode {
display: none;
border: 0px solid black;
}
#top_header.hideInXcode {
display: none;
}
#contents.hideInXcode {
border: 0px solid black;
top: 0px;
left: 0px;
}
/* @end */
header {
display: none;
}
div.main-navigation, div.navigation-top {
display: none;
}
div#overview_contents, div#contents.isShowingTOC, div#contents {
overflow: visible;
position: relative;
top: 0px;
border: none;
left: 0;
}
#tocContainer.isShowingTOC {
display: none;
}
nav {
display: none;
}
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reachability 2.0.5 Hierarchy</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" media="print" href="css/stylesPrint.css" />
<meta name="generator" content="appledoc 2.0.5 (build 789)" />
</head>
<body>
<header id="top_header">
<div id="library" class="hideInXcode">
<h1><a id="libraryTitle" href="index.html">Reachability 2.0.5 </a></h1>
<a id="developerHome" href="index.html">Apple and Donoho Design Group, LLC</a>
</div>
<div id="title" role="banner">
<h1 class="hideInXcode">Reachability 2.0.5 Hierarchy</h1>
</div>
<ul id="headerButtons" role="toolbar"></ul>
</header>
<article>
<div id="overview_contents" role="main">
<div class="main-navigation navigation-top">
<a href="index.html">Previous</a>
</div>
<div id="header">
<div class="section-header">
<h1 class="title title-header">Reachability 2.0.5 Hierarchy</h1>
</div>
</div>
<div id="container">
<div class="index-column hierarchy-column">
<h2 class="index-title">Class Hierarchy</h2>
<ul>
<li>NSObject
<ul>
<li><a href="Classes/Reachability.html">Reachability</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-navigation navigation-bottom">
<a href="index.html">Previous</a>
</div>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Apple and Donoho Design Group, LLC. All rights reserved. (Last updated: 2013-02-11)</span><br />
<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.0.5 (build 789)</a>.</span></p>
</div>
</div>
</div>
</article>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reachability 2.0.5 Reference</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" media="print" href="css/stylesPrint.css" />
<meta name="generator" content="appledoc 2.0.5 (build 789)" />
</head>
<body>
<header id="top_header">
<div id="library" class="hideInXcode">
<h1><a id="libraryTitle" href="index.html">Reachability 2.0.5 </a></h1>
<a id="developerHome" href="index.html">Apple and Donoho Design Group, LLC</a>
</div>
<div id="title" role="banner">
<h1 class="hideInXcode">Reachability 2.0.5 Reference</h1>
</div>
<ul id="headerButtons" role="toolbar"></ul>
</header>
<article>
<div id="overview_contents" role="main">
<div class="main-navigation navigation-top">
<a href="hierarchy.html">Next</a>
</div>
<div id="header">
<div class="section-header">
<h1 class="title title-header">Reachability 2.0.5 Reference</h1>
</div>
</div>
<div id="container">
<div class="section section-overview index-overview">
<p>This is Apple’s <a href="[http://developer.apple.com/library/ios/](http://developer.apple.com/library/ios/)#samplecode/Reachability/Introduction/Intro.html">example code</a> of the SystemConfiguration Reachability
APIs, adapted by <a href="[http://blog.ddg.com/?p=24](http://blog.ddg.com/?p=24)">Andrew Donoho</a>, split-off from the
<a href="[https://github.com/pokeb/asi-http-request/tree/4282568eec0b487a98e312ce49b523350ffa4a6b/External/Reachability](https://github.com/pokeb/asi-http-request/tree/4282568eec0b487a98e312ce49b523350ffa4a6b/External/Reachability)">ASIHTTPRequest source</a>.</p>
<h3>This code needs an actual maintainer.</h3>
<p>It is currently only on the CocoaPods gihub account, because ASIHTTPRequest
(which has afaik the most up-to-date version) is no longer actively maintained.</p>
<p>If you use Reachability and/or would like to step-up as the maintainer, please
contact us and we’ll gladly hand over this repository to you.</p>
<p>Also see the <a href="https://github.com/CocoaPods/unmaintained-pod-Reachability/blob/master/TODO">TODO</a>.</p>
</div>
<div class="index-column">
<h2 class="index-title">Class References</h2>
<ul>
<li><a href="Classes/Reachability.html">Reachability</a></li>
</ul>
</div>
</div>
<div class="main-navigation navigation-bottom">
<a href="hierarchy.html">Next</a>
</div>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Apple and Donoho Design Group, LLC. All rights reserved. (Last updated: 2013-02-11)</span><br />
<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.0.5 (build 789)</a>.</span></p>
</div>
</div>
</div>
</article>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<DocSetNodes version="1.0">
<TOC>
<Node type="folder">
<Name>Reachability 2.0.5</Name>
<Path>index.html</Path>
<Subnodes>
<Node type="folder">
<Name>Classes</Name>
<Path>index.html</Path>
<Subnodes>
<NodeRef refid="1"/>
</Subnodes>
</Node>
</Subnodes>
</Node>
</TOC>
<Library>
<Node id="1">
<Name>Reachability</Name>
<Path>Classes/Reachability.html</Path>
</Node>
</Library>
</DocSetNodes>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<Tokens version="1.0">
<File path="Classes/Reachability.html">
<Token>
<TokenIdentifier>//apple_ref/occ/cl/Reachability</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<NodeRef refid="1"/>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/setKey:</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>@property (copy) NSString *key</Declaration>
<Anchor>//api/name/key</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instp/Reachability/key</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>@property (copy) NSString *key</Declaration>
<Anchor>//api/name/key</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/initWithReachabilityRef:</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref</Declaration>
<Anchor>//api/name/initWithReachabilityRef:</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/clm/Reachability/reachabilityWithHostName:</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>+ (Reachability *)reachabilityWithHostName:(NSString *)hostName</Declaration>
<Anchor>//api/name/reachabilityWithHostName:</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/clm/Reachability/reachabilityWithAddress:</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>+ (Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress</Declaration>
<Anchor>//api/name/reachabilityWithAddress:</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/clm/Reachability/reachabilityForInternetConnection</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>+ (Reachability *)reachabilityForInternetConnection</Declaration>
<Anchor>//api/name/reachabilityForInternetConnection</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/clm/Reachability/reachabilityForLocalWiFi</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>+ (Reachability *)reachabilityForLocalWiFi</Declaration>
<Anchor>//api/name/reachabilityForLocalWiFi</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/startNotifier</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)startNotifier</Declaration>
<Anchor>//api/name/startNotifier</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/stopNotifier</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (void)stopNotifier</Declaration>
<Anchor>//api/name/stopNotifier</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/isEqual:</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)isEqual:(Reachability *)r</Declaration>
<Anchor>//api/name/isEqual:</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/currentReachabilityStatus</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (NetworkStatus)currentReachabilityStatus</Declaration>
<Anchor>//api/name/currentReachabilityStatus</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/isReachable</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)isReachable</Declaration>
<Anchor>//api/name/isReachable</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/isConnectionRequired</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)isConnectionRequired</Declaration>
<Anchor>//api/name/isConnectionRequired</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/connectionRequired</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)connectionRequired</Declaration>
<Anchor>//api/name/connectionRequired</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/isConnectionOnDemand</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)isConnectionOnDemand</Declaration>
<Anchor>//api/name/isConnectionOnDemand</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/isInterventionRequired</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)isInterventionRequired</Declaration>
<Anchor>//api/name/isInterventionRequired</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/isReachableViaWWAN</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)isReachableViaWWAN</Declaration>
<Anchor>//api/name/isReachableViaWWAN</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/isReachableViaWiFi</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (BOOL)isReachableViaWiFi</Declaration>
<Anchor>//api/name/isReachableViaWiFi</Anchor>
</Token>
<Token>
<TokenIdentifier>//apple_ref/occ/instm/Reachability/reachabilityFlags</TokenIdentifier>
<Abstract type="html"></Abstract>
<DeclaredIn>Reachability.h</DeclaredIn>
<Declaration>- (SCNetworkReachabilityFlags)reachabilityFlags</Declaration>
<Anchor>//api/name/reachabilityFlags</Anchor>
</Token>
</File>
</Tokens>
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="html/html; charset=utf-8" />
<title>Reachability Class Reference</title>
<meta id="xcode-display" name="xcode-display" content="render"/>
<meta name="viewport" content="width=550" />
<link rel="stylesheet" type="text/css" href="../css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" media="print" href="../css/stylesPrint.css" />
<meta name="generator" content="appledoc 2.0.5 (build 789)" />
</head>
<body>
<header id="top_header">
<div id="library" class="hideInXcode">
<h1><a id="libraryTitle" href="../index.html">Reachability 2.0.5 </a></h1>
<a id="developerHome" href="../index.html">Apple and Donoho Design Group, LLC</a>
</div>
<div id="title" role="banner">
<h1 class="hideInXcode">Reachability Class Reference</h1>
</div>
<ul id="headerButtons" role="toolbar">
<li id="toc_button">
<button aria-label="Show Table of Contents" role="checkbox" class="open" id="table_of_contents"><span class="disclosure"></span>Table of Contents</button>
</li>
<li id="jumpto_button" role="navigation">
<select id="jumpTo">
<option value="top">Jump To&#133;</option>
<option value="tasks">Tasks</option>
<option value="properties">Properties</option>
<option value="//api/name/key">&nbsp;&nbsp;&nbsp;&nbsp;key</option>
<option value="class_methods">Class Methods</option>
<option value="//api/name/reachabilityForInternetConnection">&nbsp;&nbsp;&nbsp;&nbsp;+ reachabilityForInternetConnection</option>
<option value="//api/name/reachabilityForLocalWiFi">&nbsp;&nbsp;&nbsp;&nbsp;+ reachabilityForLocalWiFi</option>
<option value="//api/name/reachabilityWithAddress:">&nbsp;&nbsp;&nbsp;&nbsp;+ reachabilityWithAddress:</option>
<option value="//api/name/reachabilityWithHostName:">&nbsp;&nbsp;&nbsp;&nbsp;+ reachabilityWithHostName:</option>
<option value="instance_methods">Instance Methods</option>
<option value="//api/name/connectionRequired">&nbsp;&nbsp;&nbsp;&nbsp;- connectionRequired</option>
<option value="//api/name/currentReachabilityStatus">&nbsp;&nbsp;&nbsp;&nbsp;- currentReachabilityStatus</option>
<option value="//api/name/initWithReachabilityRef:">&nbsp;&nbsp;&nbsp;&nbsp;- initWithReachabilityRef:</option>
<option value="//api/name/isConnectionOnDemand">&nbsp;&nbsp;&nbsp;&nbsp;- isConnectionOnDemand</option>
<option value="//api/name/isConnectionRequired">&nbsp;&nbsp;&nbsp;&nbsp;- isConnectionRequired</option>
<option value="//api/name/isEqual:">&nbsp;&nbsp;&nbsp;&nbsp;- isEqual:</option>
<option value="//api/name/isInterventionRequired">&nbsp;&nbsp;&nbsp;&nbsp;- isInterventionRequired</option>
<option value="//api/name/isReachable">&nbsp;&nbsp;&nbsp;&nbsp;- isReachable</option>
<option value="//api/name/isReachableViaWWAN">&nbsp;&nbsp;&nbsp;&nbsp;- isReachableViaWWAN</option>
<option value="//api/name/isReachableViaWiFi">&nbsp;&nbsp;&nbsp;&nbsp;- isReachableViaWiFi</option>
<option value="//api/name/reachabilityFlags">&nbsp;&nbsp;&nbsp;&nbsp;- reachabilityFlags</option>
<option value="//api/name/startNotifier">&nbsp;&nbsp;&nbsp;&nbsp;- startNotifier</option>
<option value="//api/name/stopNotifier">&nbsp;&nbsp;&nbsp;&nbsp;- stopNotifier</option>
</select>
</li>
</ul>
</header>
<nav id="tocContainer" class="isShowingTOC">
<ul id="toc" role="tree">
<li role="treeitem" id="task_treeitem"><span class="nodisclosure"></span><span class="sectionName"><a href="#tasks">Tasks</a></span><ul>
</ul></li>
<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#properties">Properties</a></span><ul>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/key">key</a></span></li>
</ul></li>
<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#class_methods">Class Methods</a></span><ul>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityForInternetConnection">reachabilityForInternetConnection</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityForLocalWiFi">reachabilityForLocalWiFi</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityWithAddress:">reachabilityWithAddress:</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityWithHostName:">reachabilityWithHostName:</a></span></li>
</ul></li>
<li role="treeitem" class="children"><span class="disclosure"></span><span class="sectionName"><a href="#instance_methods">Instance Methods</a></span><ul>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/connectionRequired">connectionRequired</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/currentReachabilityStatus">currentReachabilityStatus</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/initWithReachabilityRef:">initWithReachabilityRef:</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isConnectionOnDemand">isConnectionOnDemand</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isConnectionRequired">isConnectionRequired</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isEqual:">isEqual:</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isInterventionRequired">isInterventionRequired</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isReachable">isReachable</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isReachableViaWWAN">isReachableViaWWAN</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/isReachableViaWiFi">isReachableViaWiFi</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/reachabilityFlags">reachabilityFlags</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/startNotifier">startNotifier</a></span></li>
<li><span class="nodisclosure"></span><span class="sectionName"><a href="#//api/name/stopNotifier">stopNotifier</a></span></li>
</ul></li>
</ul>
</nav>
<article>
<div id="contents" class="isShowingTOC" role="main">
<a title="Reachability Class Reference" name="top"></a>
<div class="main-navigation navigation-top">
<ul>
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
</div>
<div id="header">
<div class="section-header">
<h1 class="title title-header">Reachability Class Reference</h1>
</div>
</div>
<div id="container">
<div class="section section-specification"><table cellspacing="0"><tbody>
<tr>
<td class="specification-title">Inherits from</td>
<td class="specification-value">NSObject</td>
</tr><tr>
<td class="specification-title">Declared in</td>
<td class="specification-value">Reachability.h</td>
</tr>
</tbody></table></div>
<div class="section section-tasks">
<a title="Tasks" name="tasks"></a>
<h2 class="subtitle subtitle-tasks">Tasks</h2>
<ul class="task-list">
<li>
<span class="tooltip">
<code><a href="#//api/name/key">&nbsp;&nbsp;key</a></code>
</span>
<span class="task-item-suffix">property</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/initWithReachabilityRef:">&ndash;&nbsp;initWithReachabilityRef:</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityWithHostName:">+&nbsp;reachabilityWithHostName:</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityWithAddress:">+&nbsp;reachabilityWithAddress:</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityForInternetConnection">+&nbsp;reachabilityForInternetConnection</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityForLocalWiFi">+&nbsp;reachabilityForLocalWiFi</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/startNotifier">&ndash;&nbsp;startNotifier</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/stopNotifier">&ndash;&nbsp;stopNotifier</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isEqual:">&ndash;&nbsp;isEqual:</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/currentReachabilityStatus">&ndash;&nbsp;currentReachabilityStatus</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isReachable">&ndash;&nbsp;isReachable</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isConnectionRequired">&ndash;&nbsp;isConnectionRequired</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/connectionRequired">&ndash;&nbsp;connectionRequired</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isConnectionOnDemand">&ndash;&nbsp;isConnectionOnDemand</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isInterventionRequired">&ndash;&nbsp;isInterventionRequired</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isReachableViaWWAN">&ndash;&nbsp;isReachableViaWWAN</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/isReachableViaWiFi">&ndash;&nbsp;isReachableViaWiFi</a></code>
</span>
</li><li>
<span class="tooltip">
<code><a href="#//api/name/reachabilityFlags">&ndash;&nbsp;reachabilityFlags</a></code>
</span>
</li>
</ul>
</div>
<div class="section section-methods">
<a title="Properties" name="properties"></a>
<h2 class="subtitle subtitle-methods">Properties</h2>
<div class="section-method">
<a name="//api/name/key" title="key"></a>
<h3 class="subsubtitle method-title">key</h3>
<div class="method-subsection method-declaration"><code>@property (copy) NSString *key</code></div>
</div>
</div>
<div class="section section-methods">
<a title="Class Methods" name="class_methods"></a>
<h2 class="subtitle subtitle-methods">Class Methods</h2>
<div class="section-method">
<a name="//api/name/reachabilityForInternetConnection" title="reachabilityForInternetConnection"></a>
<h3 class="subsubtitle method-title">reachabilityForInternetConnection</h3>
<div class="method-subsection method-declaration"><code>+ (Reachability *)reachabilityForInternetConnection</code></div>
</div>
<div class="section-method">
<a name="//api/name/reachabilityForLocalWiFi" title="reachabilityForLocalWiFi"></a>
<h3 class="subsubtitle method-title">reachabilityForLocalWiFi</h3>
<div class="method-subsection method-declaration"><code>+ (Reachability *)reachabilityForLocalWiFi</code></div>
</div>
<div class="section-method">
<a name="//api/name/reachabilityWithAddress:" title="reachabilityWithAddress:"></a>
<h3 class="subsubtitle method-title">reachabilityWithAddress:</h3>
<div class="method-subsection method-declaration"><code>+ (Reachability *)reachabilityWithAddress:(const struct sockaddr_in *)<em>hostAddress</em></code></div>
</div>
<div class="section-method">
<a name="//api/name/reachabilityWithHostName:" title="reachabilityWithHostName:"></a>
<h3 class="subsubtitle method-title">reachabilityWithHostName:</h3>
<div class="method-subsection method-declaration"><code>+ (Reachability *)reachabilityWithHostName:(NSString *)<em>hostName</em></code></div>
</div>
</div>
<div class="section section-methods">
<a title="Instance Methods" name="instance_methods"></a>
<h2 class="subtitle subtitle-methods">Instance Methods</h2>
<div class="section-method">
<a name="//api/name/connectionRequired" title="connectionRequired"></a>
<h3 class="subsubtitle method-title">connectionRequired</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)connectionRequired</code></div>
</div>
<div class="section-method">
<a name="//api/name/currentReachabilityStatus" title="currentReachabilityStatus"></a>
<h3 class="subsubtitle method-title">currentReachabilityStatus</h3>
<div class="method-subsection method-declaration"><code>- (NetworkStatus)currentReachabilityStatus</code></div>
</div>
<div class="section-method">
<a name="//api/name/initWithReachabilityRef:" title="initWithReachabilityRef:"></a>
<h3 class="subsubtitle method-title">initWithReachabilityRef:</h3>
<div class="method-subsection method-declaration"><code>- (Reachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)<em>ref</em></code></div>
</div>
<div class="section-method">
<a name="//api/name/isConnectionOnDemand" title="isConnectionOnDemand"></a>
<h3 class="subsubtitle method-title">isConnectionOnDemand</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isConnectionOnDemand</code></div>
</div>
<div class="section-method">
<a name="//api/name/isConnectionRequired" title="isConnectionRequired"></a>
<h3 class="subsubtitle method-title">isConnectionRequired</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isConnectionRequired</code></div>
</div>
<div class="section-method">
<a name="//api/name/isEqual:" title="isEqual:"></a>
<h3 class="subsubtitle method-title">isEqual:</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isEqual:(Reachability *)<em>r</em></code></div>
</div>
<div class="section-method">
<a name="//api/name/isInterventionRequired" title="isInterventionRequired"></a>
<h3 class="subsubtitle method-title">isInterventionRequired</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isInterventionRequired</code></div>
</div>
<div class="section-method">
<a name="//api/name/isReachable" title="isReachable"></a>
<h3 class="subsubtitle method-title">isReachable</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isReachable</code></div>
</div>
<div class="section-method">
<a name="//api/name/isReachableViaWWAN" title="isReachableViaWWAN"></a>
<h3 class="subsubtitle method-title">isReachableViaWWAN</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isReachableViaWWAN</code></div>
</div>
<div class="section-method">
<a name="//api/name/isReachableViaWiFi" title="isReachableViaWiFi"></a>
<h3 class="subsubtitle method-title">isReachableViaWiFi</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)isReachableViaWiFi</code></div>
</div>
<div class="section-method">
<a name="//api/name/reachabilityFlags" title="reachabilityFlags"></a>
<h3 class="subsubtitle method-title">reachabilityFlags</h3>
<div class="method-subsection method-declaration"><code>- (SCNetworkReachabilityFlags)reachabilityFlags</code></div>
</div>
<div class="section-method">
<a name="//api/name/startNotifier" title="startNotifier"></a>
<h3 class="subsubtitle method-title">startNotifier</h3>
<div class="method-subsection method-declaration"><code>- (BOOL)startNotifier</code></div>
</div>
<div class="section-method">
<a name="//api/name/stopNotifier" title="stopNotifier"></a>
<h3 class="subsubtitle method-title">stopNotifier</h3>
<div class="method-subsection method-declaration"><code>- (void)stopNotifier</code></div>
</div>
</div>
</div>
<div class="main-navigation navigation-bottom">
<ul>
<li><a href="../index.html">Index</a></li>
<li><a href="../hierarchy.html">Hierarchy</a></li>
</ul>
</div>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Apple and Donoho Design Group, LLC. All rights reserved. (Last updated: 2013-02-11)</span><br />
<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.0.5 (build 789)</a>.</span></p>
</div>
</div>
</div>
</article>
<script type="text/javascript">
function jumpToChange()
{
window.location.hash = this.options[this.selectedIndex].value;
}
function toggleTOC()
{
var contents = document.getElementById('contents');
var tocContainer = document.getElementById('tocContainer');
if (this.getAttribute('class') == 'open')
{
this.setAttribute('class', '');
contents.setAttribute('class', '');
tocContainer.setAttribute('class', '');
window.name = "hideTOC";
}
else
{
this.setAttribute('class', 'open');
contents.setAttribute('class', 'isShowingTOC');
tocContainer.setAttribute('class', 'isShowingTOC');
window.name = "";
}
return false;
}
function toggleTOCEntryChildren(e)
{
e.stopPropagation();
var currentClass = this.getAttribute('class');
if (currentClass == 'children') {
this.setAttribute('class', 'children open');
}
else if (currentClass == 'children open') {
this.setAttribute('class', 'children');
}
return false;
}
function tocEntryClick(e)
{
e.stopPropagation();
return true;
}
function init()
{
var selectElement = document.getElementById('jumpTo');
selectElement.addEventListener('change', jumpToChange, false);
var tocButton = document.getElementById('table_of_contents');
tocButton.addEventListener('click', toggleTOC, false);
var taskTreeItem = document.getElementById('task_treeitem');
if (taskTreeItem.getElementsByTagName('li').length > 0)
{
taskTreeItem.setAttribute('class', 'children');
taskTreeItem.firstChild.setAttribute('class', 'disclosure');
}
var tocList = document.getElementById('toc');
var tocEntries = tocList.getElementsByTagName('li');
for (var i = 0; i < tocEntries.length; i++) {
tocEntries[i].addEventListener('click', toggleTOCEntryChildren, false);
}
var tocLinks = tocList.getElementsByTagName('a');
for (var i = 0; i < tocLinks.length; i++) {
tocLinks[i].addEventListener('click', tocEntryClick, false);
}
if (window.name == "hideTOC") {
toggleTOC.call(tocButton);
}
}
window.onload = init;
// If showing in Xcode, hide the TOC and Header
if (navigator.userAgent.match(/xcode/i)) {
document.getElementById("contents").className = "hideInXcode"
document.getElementById("tocContainer").className = "hideInXcode"
document.getElementById("top_header").className = "hideInXcode"
}
</script>
</body>
</html>
\ No newline at end of file
body {
font-family: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif;
font-size: 13px;
}
code {
font-family: Courier, Consolas, monospace;
font-size: 13px;
color: #666;
}
pre {
font-family: Courier, Consolas, monospace;
font-size: 13px;
line-height: 18px;
tab-interval: 0.5em;
border: 1px solid #C7CFD5;
background-color: #F1F5F9;
color: #666;
padding: 0.3em 1em;
}
ul {
list-style-type: square;
}
li {
margin-bottom: 10px;
}
a, a code {
text-decoration: none;
color: #36C;
}
a:hover, a:hover code {
text-decoration: underline;
color: #36C;
}
h2 {
border-bottom: 1px solid #8391A8;
color: #3C4C6C;
font-size: 187%;
font-weight: normal;
margin-top: 1.75em;
padding-bottom: 2px;
}
table {
margin-bottom: 4em;
border-collapse:collapse;
vertical-align: middle;
}
td {
border: 1px solid #9BB3CD;
padding: .667em;
font-size: 100%;
}
th {
border: 1px solid #9BB3CD;
padding: .3em .667em .3em .667em;
background: #93A5BB;
font-size: 103%;
font-weight: bold;
color: white;
text-align: left;
}
/* @group Common page elements */
#top_header {
height: 91px;
left: 0;
min-width: 598px;
position: absolute;
right: 0;
top: 0;
z-index: 900;
}
#footer {
clear: both;
padding-top: 20px;
text-align: center;
}
#contents, #overview_contents {
-webkit-overflow-scrolling: touch;
border-top: 1px solid #2B334F;
position: absolute;
top: 91px;
left: 0;
right: 0;
bottom: 0;
overflow-x: hidden;
overflow-y: auto;
padding-left: 2em;
padding-right: 2em;
padding-top: 1em;
min-width: 550px;
}
#contents.isShowingTOC {
left: 230px;
min-width: 320px;
}
.copyright {
font-size: 12px;
}
.generator {
font-size: 11px;
}
.main-navigation ul li {
display: inline;
margin-left: 15px;
list-style: none;
}
.navigation-top {
clear: both;
float: right;
}
.navigation-bottom {
clear: both;
float: right;
margin-top: 20px;
margin-bottom: -10px;
}
.open > .disclosure {
background-image: url("../img/disclosure_open.png");
}
.disclosure {
background: url("../img/disclosure.png") no-repeat scroll 0 0;
}
.disclosure, .nodisclosure {
display: inline-block;
height: 8px;
margin-right: 5px;
position: relative;
width: 9px;
}
/* @end */
/* @group Header */
#top_header #library {
background: url("../img/library_background.png") repeat-x 0 0 #485E78;
background-color: #ccc;
height: 35px;
font-size: 115%;
}
#top_header #library #libraryTitle {
color: #FFFFFF;
margin-left: 15px;
text-shadow: 0 -1px 0 #485E78;
top: 8px;
position: absolute;
}
#top_header #library #developerHome {
color: #92979E;
right: 15px;
top: 8px;
position: absolute;
}
#top_header #library a:hover {
text-decoration: none;
}
#top_header #title {
background: url("../img/title_background.png") repeat-x 0 0 #8A98A9;
border-bottom: 1px solid #B6B6B6;
height: 25px;
overflow: hidden;
}
#top_header h1 {
font-size: 115%;
font-weight: normal;
margin: 0;
padding: 3px 0 2px;
text-align: center;
text-shadow: 0 1px 0 #D5D5D5;
white-space: nowrap;
}
#headerButtons {
background-color: #D8D8D8;
background-image: url("../img/button_bar_background.png");
border-bottom: 1px solid #EDEDED;
border-top: 1px solid #2B334F;
font-size: 8pt;
height: 28px;
left: 0;
list-style: none outside none;
margin: 0;
overflow: hidden;
padding: 0;
position: absolute;
right: 0;
top: 61px;
}
#headerButtons li {
background-repeat: no-repeat;
display: inline;
margin-top: 0;
margin-bottom: 0;
padding: 0;
}
#toc_button button {
border-color: #ACACAC;
border-style: none solid none none;
border-width: 0 1px 0 0;
height: 28px;
margin: 0;
padding-left: 30px;
text-align: left;
width: 230px;
}
li#jumpto_button {
left: 230px;
margin-left: 0;
position: absolute;
}
li#jumpto_button select {
height: 22px;
margin: 5px 2px 0 10px;
max-width: 300px;
}
/* @end */
/* @group Table of contents */
#tocContainer.isShowingTOC {
border-right: 1px solid #ACACAC;
display: block;
overflow-x: hidden;
overflow-y: auto;
padding: 0;
}
#tocContainer {
background-color: #E4EBF7;
border-top: 1px solid #2B334F;
bottom: 0;
display: none;
left: 0;
overflow: hidden;
position: absolute;
top: 91px;
width: 229px;
}
#tocContainer > ul#toc {
font-size: 11px;
margin: 0;
padding: 12px 0 18px;
width: 209px;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
#tocContainer > ul#toc > li {
margin: 0;
padding: 0 0 7px 30px;
text-indent: -15px;
}
#tocContainer > ul#toc > li > .sectionName a {
color: #000000;
font-weight: bold;
}
#tocContainer > ul#toc > li > .sectionName a:hover {
text-decoration: none;
}
#tocContainer > ul#toc li.children > ul {
display: none;
height: 0;
}
#tocContainer > ul#toc > li > ul {
margin: 0;
padding: 0;
}
#tocContainer > ul#toc > li > ul, ul#toc > li > ul > li {
margin-left: 0;
margin-bottom: 0;
padding-left: 15px;
}
#tocContainer > ul#toc > li ul {
list-style: none;
margin-right: 0;
padding-right: 0;
}
#tocContainer > ul#toc li.children.open > ul {
display: block;
height: auto;
margin-left: -15px;
padding-left: 0;
}
#tocContainer > ul#toc > li > ul, ul#toc > li > ul > li {
margin-left: 0;
padding-left: 15px;
}
#tocContainer li ul li {
margin-top: 0.583em;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#tocContainer li ul li span.sectionName {
white-space: normal;
}
#tocContainer > ul#toc > li > ul > li > .sectionName a {
font-weight: bold;
}
#tocContainer > ul#toc > li > ul a {
color: #4F4F4F;
}
/* @end */
/* @group Index formatting */
.index-title {
font-size: 13px;
font-weight: normal;
}
.index-column {
float: left;
width: 30%;
min-width: 200px;
font-size: 11px;
}
.index-column ul {
margin: 8px 0 0 0;
padding: 0;
list-style: none;
}
.index-column ul li {
margin: 0 0 3px 0;
padding: 0;
}
.hierarchy-column {
min-width: 400px;
}
.hierarchy-column ul {
margin: 3px 0 0 15px;
}
.hierarchy-column ul li {
list-style-type: square;
}
/* @end */
/* @group Common formatting elements */
.title {
font-weight: normal;
font-size: 215%;
margin-top:0;
}
.subtitle {
font-weight: normal;
font-size: 180%;
color: #3C4C6C;
border-bottom: 1px solid #5088C5;
}
.subsubtitle {
font-weight: normal;
font-size: 145%;
height: 0.7em;
}
.note {
border: 1px solid #5088C5;
background-color: white;
margin: 1.667em 0 1.75em 0;
padding: 0 .667em .083em .750em;
}
.warning {
border: 1px solid #5088C5;
background-color: #F0F3F7;
margin-bottom: 0.5em;
padding: 0.3em 0.8em;
}
.bug {
border: 1px solid #000;
background-color: #ffffcc;
margin-bottom: 0.5em;
padding: 0.3em 0.8em;
}
.deprecated {
color: #F60425;
}
/* @end */
/* @group Common layout */
.section {
margin-top: 3em;
}
/* @end */
/* @group Object specification section */
.section-specification {
margin-left: 2.5em;
margin-right: 2.5em;
font-size: 12px;
}
.section-specification table {
margin-bottom: 0em;
border-top: 1px solid #d6e0e5;
}
.section-specification td {
vertical-align: top;
border-bottom: 1px solid #d6e0e5;
border-left-width: 0px;
border-right-width: 0px;
border-top-width: 0px;
padding: .6em;
}
.section-specification .specification-title {
font-weight: bold;
}
/* @end */
/* @group Tasks section */
.task-list {
list-style-type: none;
padding-left: 0px;
}
.task-list li {
margin-bottom: 3px;
}
.task-item-suffix {
color: #996;
font-size: 12px;
font-style: italic;
margin-left: 0.5em;
}
span.tooltip span.tooltip {
font-size: 1.0em;
display: none;
padding: 0.3em;
border: 1px solid #aaa;
background-color: #fdfec8;
color: #000;
text-align: left;
}
span.tooltip:hover span.tooltip {
display: block;
position: absolute;
margin-left: 2em;
}
/* @end */
/* @group Method section */
.section-method {
margin-top: 2.3em;
}
.method-title {
margin-bottom: 1.5em;
}
.method-subtitle {
margin-top: 0.7em;
margin-bottom: 0.2em;
}
.method-subsection p {
margin-top: 0.4em;
margin-bottom: 0.8em;
}
.method-declaration {
margin-top:1.182em;
margin-bottom:.909em;
}
.method-declaration code {
font:14px Courier, Consolas, monospace;
color:#000;
}
.declaration {
color: #000;
}
.argument-def {
margin-top: 0.3em;
margin-bottom: 0.3em;
}
.argument-def dd {
margin-left: 1.25em;
}
.see-also-section ul {
list-style-type: none;
padding-left: 0px;
margin-top: 0;
}
.see-also-section li {
margin-bottom: 3px;
}
.declared-in-ref {
color: #666;
}
#tocContainer.hideInXcode {
display: none;
border: 0px solid black;
}
#top_header.hideInXcode {
display: none;
}
#contents.hideInXcode {
border: 0px solid black;
top: 0px;
left: 0px;
}
/* @end */
header {
display: none;
}
div.main-navigation, div.navigation-top {
display: none;
}
div#overview_contents, div#contents.isShowingTOC, div#contents {
overflow: visible;
position: relative;
top: 0px;
border: none;
left: 0;
}
#tocContainer.isShowingTOC {
display: none;
}
nav {
display: none;
}
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reachability 2.0.5 Hierarchy</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" media="print" href="css/stylesPrint.css" />
<meta name="generator" content="appledoc 2.0.5 (build 789)" />
</head>
<body>
<header id="top_header">
<div id="library" class="hideInXcode">
<h1><a id="libraryTitle" href="index.html">Reachability 2.0.5 </a></h1>
<a id="developerHome" href="index.html">Apple and Donoho Design Group, LLC</a>
</div>
<div id="title" role="banner">
<h1 class="hideInXcode">Reachability 2.0.5 Hierarchy</h1>
</div>
<ul id="headerButtons" role="toolbar"></ul>
</header>
<article>
<div id="overview_contents" role="main">
<div class="main-navigation navigation-top">
<a href="index.html">Previous</a>
</div>
<div id="header">
<div class="section-header">
<h1 class="title title-header">Reachability 2.0.5 Hierarchy</h1>
</div>
</div>
<div id="container">
<div class="index-column hierarchy-column">
<h2 class="index-title">Class Hierarchy</h2>
<ul>
<li>NSObject
<ul>
<li><a href="Classes/Reachability.html">Reachability</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="main-navigation navigation-bottom">
<a href="index.html">Previous</a>
</div>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Apple and Donoho Design Group, LLC. All rights reserved. (Last updated: 2013-02-11)</span><br />
<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.0.5 (build 789)</a>.</span></p>
</div>
</div>
</div>
</article>
</body>
</html>
\ No newline at end of file
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Reachability 2.0.5 Reference</title>
<link rel="stylesheet" type="text/css" href="css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" media="print" href="css/stylesPrint.css" />
<meta name="generator" content="appledoc 2.0.5 (build 789)" />
</head>
<body>
<header id="top_header">
<div id="library" class="hideInXcode">
<h1><a id="libraryTitle" href="index.html">Reachability 2.0.5 </a></h1>
<a id="developerHome" href="index.html">Apple and Donoho Design Group, LLC</a>
</div>
<div id="title" role="banner">
<h1 class="hideInXcode">Reachability 2.0.5 Reference</h1>
</div>
<ul id="headerButtons" role="toolbar"></ul>
</header>
<article>
<div id="overview_contents" role="main">
<div class="main-navigation navigation-top">
<a href="hierarchy.html">Next</a>
</div>
<div id="header">
<div class="section-header">
<h1 class="title title-header">Reachability 2.0.5 Reference</h1>
</div>
</div>
<div id="container">
<div class="section section-overview index-overview">
<p>This is Apple’s <a href="[http://developer.apple.com/library/ios/](http://developer.apple.com/library/ios/)#samplecode/Reachability/Introduction/Intro.html">example code</a> of the SystemConfiguration Reachability
APIs, adapted by <a href="[http://blog.ddg.com/?p=24](http://blog.ddg.com/?p=24)">Andrew Donoho</a>, split-off from the
<a href="[https://github.com/pokeb/asi-http-request/tree/4282568eec0b487a98e312ce49b523350ffa4a6b/External/Reachability](https://github.com/pokeb/asi-http-request/tree/4282568eec0b487a98e312ce49b523350ffa4a6b/External/Reachability)">ASIHTTPRequest source</a>.</p>
<h3>This code needs an actual maintainer.</h3>
<p>It is currently only on the CocoaPods gihub account, because ASIHTTPRequest
(which has afaik the most up-to-date version) is no longer actively maintained.</p>
<p>If you use Reachability and/or would like to step-up as the maintainer, please
contact us and we’ll gladly hand over this repository to you.</p>
<p>Also see the <a href="https://github.com/CocoaPods/unmaintained-pod-Reachability/blob/master/TODO">TODO</a>.</p>
</div>
<div class="index-column">
<h2 class="index-title">Class References</h2>
<ul>
<li><a href="Classes/Reachability.html">Reachability</a></li>
</ul>
</div>
</div>
<div class="main-navigation navigation-bottom">
<a href="hierarchy.html">Next</a>
</div>
<div id="footer">
<hr />
<div class="footer-copyright">
<p><span class="copyright">&copy; 2013 Apple and Donoho Design Group, LLC. All rights reserved. (Last updated: 2013-02-11)</span><br />
<span class="generator">Generated by <a href="http://appledoc.gentlebytes.com">appledoc 2.0.5 (build 789)</a>.</span></p>
</div>
</div>
</div>
</article>
</body>
</html>
\ No newline at end of file
../../Reachability/Reachability.h
\ No newline at end of file
# Acknowledgements
This application makes use of the following third party libraries:
Generated by CocoaPods - http://cocoapods.org
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PreferenceSpecifiers</key>
<array>
<dict>
<key>FooterText</key>
<string>This application makes use of the following third party libraries:</string>
<key>Title</key>
<string>Acknowledgements</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Generated by CocoaPods - http://cocoapods.org</string>
<key>Title</key>
<string></string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
</array>
<key>StringsTable</key>
<string>Acknowledgements</string>
<key>Title</key>
<string>Acknowledgements</string>
</dict>
</plist>
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#!/bin/sh
install_resource()
{
case $1 in
*.storyboard)
echo "ibtool --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 --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 --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 --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 "rsync -rp ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -rp "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*)
echo "cp -R ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
cp -R "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}"
;;
esac
}
ALWAYS_SEARCH_USER_PATHS = YES
HEADER_SEARCH_PATHS = ${PODS_HEADERS_SEARCH_PATHS}
OTHER_LDFLAGS = -ObjC -framework SystemConfiguration
PODS_BUILD_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/Reachability"
PODS_HEADERS_SEARCH_PATHS = ${PODS_PUBLIC_HEADERS_SEARCH_PATHS}
PODS_PUBLIC_HEADERS_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/Reachability"
PODS_ROOT = ${SRCROOT}/Pods
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>0DB7FE2F90774FE1A721E057</key>
<dict>
<key>baseConfigurationReference</key>
<string>510CF508737F481D9E34EC60</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
<key>VALIDATE_PRODUCT</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>161E6F264E1C4D71828793D7</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-resources.sh</string>
<key>path</key>
<string>Pods-resources.sh</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>1B3BBD6B27FD4484ADDEB6AC</key>
<dict>
<key>fileRef</key>
<string>7A922719DB30471383F70B85</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>2243B1F816614C1CAAE01CCC</key>
<dict>
<key>fileRef</key>
<string>C8B64548224948BC9EF421CC</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>3D6099F98F21449AB5A41838</key>
<dict>
<key>children</key>
<array>
<string>FE3CD4F3B8844F078CBE6A1D</string>
<string>C8B64548224948BC9EF421CC</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Targets Support Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>46F9B726B3564054A16FD43E</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>845568CBA89741D8AC0C990F</string>
<string>2243B1F816614C1CAAE01CCC</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>510CF508737F481D9E34EC60</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>56B955128913433EB30FF59D</key>
<dict>
<key>children</key>
<array>
<string>7A49D0D449E24CFCA682AECB</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>573619771D3346BE9BB202DB</key>
<dict>
<key>fileRef</key>
<string>D9ADA01AFC7A4E66AEC383EA</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>5E3D6B02DB1548A29ACC4BC3</key>
<dict>
<key>baseConfigurationReference</key>
<string>510CF508737F481D9E34EC60</string>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_32_BIT)</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>DSTROOT</key>
<string>/tmp/xcodeproj.dst</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>Pods-prefix.pch</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_VERSION</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>GCC_WARN_INHIBIT_ALL_WARNINGS</key>
<string>NO</string>
<key>INSTALL_PATH</key>
<string>$(BUILT_PRODUCTS_DIR)</string>
<key>IPHONEOS_DEPLOYMENT_TARGET</key>
<string>6.0</string>
<key>OTHER_LDFLAGS</key>
<string></string>
<key>PODS_HEADERS_SEARCH_PATHS</key>
<string>${PODS_BUILD_HEADERS_SEARCH_PATHS}</string>
<key>PODS_ROOT</key>
<string>${SRCROOT}</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>PUBLIC_HEADERS_FOLDER_PATH</key>
<string>$(TARGET_NAME)</string>
<key>SDKROOT</key>
<string>iphoneos</string>
<key>SKIP_INSTALL</key>
<string>YES</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>5F860B58FC10407AA5DB1194</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>B17F5B3F88454A55A84F3385</string>
<string>F200DF5F30EB4A7487C68754</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>6BA63AFF39D047B8B5254618</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>Pods-prefix.pch</string>
<key>path</key>
<string>Pods-prefix.pch</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>6C0CEEDFDDA34F09A2B4E8FC</key>
<dict>
<key>attributes</key>
<dict>
<key>LastUpgradeCheck</key>
<string>0450</string>
</dict>
<key>buildConfigurationList</key>
<string>5F860B58FC10407AA5DB1194</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>82303EEEE6924D678EF42B24</string>
<key>productRefGroup</key>
<string>56B955128913433EB30FF59D</string>
<key>projectReferences</key>
<array/>
<key>targets</key>
<array>
<string>BA5142E6A393471498D1219D</string>
</array>
</dict>
<key>7A49D0D449E24CFCA682AECB</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>7A922719DB30471383F70B85</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>name</key>
<string>Reachability.h</string>
<key>path</key>
<string>Reachability/Reachability.h</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>82303EEEE6924D678EF42B24</key>
<dict>
<key>children</key>
<array>
<string>56B955128913433EB30FF59D</string>
<string>C009AC14C4B4465CBF55A8C8</string>
<string>FA427F25A42D4882B8F86CFB</string>
<string>3D6099F98F21449AB5A41838</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>845568CBA89741D8AC0C990F</key>
<dict>
<key>fileRef</key>
<string>B5A39C40107B4B558690E8B6</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>9807550C75F14EEEA2856CC9</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>1B3BBD6B27FD4484ADDEB6AC</string>
</array>
<key>isa</key>
<string>PBXHeadersBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>B17F5B3F88454A55A84F3385</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>B1BED304CAE749ACA9C6517E</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>0DB7FE2F90774FE1A721E057</string>
<string>5E3D6B02DB1548A29ACC4BC3</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>B2C08614B4E64400953C2DF3</key>
<dict>
<key>children</key>
<array>
<string>7A922719DB30471383F70B85</string>
<string>B5A39C40107B4B558690E8B6</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Reachability</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>B310BAF02C2E4F7691E25C5F</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>573619771D3346BE9BB202DB</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>B5A39C40107B4B558690E8B6</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>Reachability.m</string>
<key>path</key>
<string>Reachability/Reachability.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>BA5142E6A393471498D1219D</key>
<dict>
<key>buildConfigurationList</key>
<string>B1BED304CAE749ACA9C6517E</string>
<key>buildPhases</key>
<array>
<string>46F9B726B3564054A16FD43E</string>
<string>B310BAF02C2E4F7691E25C5F</string>
<string>9807550C75F14EEEA2856CC9</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>Pods</string>
<key>productName</key>
<string>Pods</string>
<key>productReference</key>
<string>7A49D0D449E24CFCA682AECB</string>
<key>productType</key>
<string>com.apple.product-type.library.static</string>
</dict>
<key>C009AC14C4B4465CBF55A8C8</key>
<dict>
<key>children</key>
<array>
<string>D9ADA01AFC7A4E66AEC383EA</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>C8B64548224948BC9EF421CC</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>name</key>
<string>PodsDummy_Pods.m</string>
<key>path</key>
<string>PodsDummy_Pods.m</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
<key>D9ADA01AFC7A4E66AEC383EA</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>DEVELOPER_DIR</string>
</dict>
<key>F200DF5F30EB4A7487C68754</key>
<dict>
<key>buildSettings</key>
<dict/>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>FA427F25A42D4882B8F86CFB</key>
<dict>
<key>children</key>
<array>
<string>B2C08614B4E64400953C2DF3</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>FE3CD4F3B8844F078CBE6A1D</key>
<dict>
<key>children</key>
<array>
<string>161E6F264E1C4D71828793D7</string>
<string>6BA63AFF39D047B8B5254618</string>
<string>510CF508737F481D9E34EC60</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Pods</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
</dict>
<key>rootObject</key>
<string>6C0CEEDFDDA34F09A2B4E8FC</string>
</dict>
</plist>
@interface PodsDummy_Pods : NSObject
@end
@implementation PodsDummy_Pods
@end
This is Apple’s [example code][apple] of the SystemConfiguration Reachability
APIs, adapted by [Andrew Donoho][donoho], split-off from the
[ASIHTTPRequest source][asi].
### This code needs an actual maintainer.
It is currently only on the CocoaPods gihub account, because ASIHTTPRequest
(which has afaik the most up-to-date version) is no longer actively maintained.
If you use Reachability and/or would like to step-up as the maintainer, please
contact us and we’ll gladly hand over this repository to you.
Also see the [TODO][todo].
[apple]: http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html
[donoho]: http://blog.ddg.com/?p=24
[asi]: https://github.com/pokeb/asi-http-request/tree/4282568eec0b487a98e312ce49b523350ffa4a6b/External/Reachability
[todo]: https://github.com/CocoaPods/unmaintained-pod-Reachability/blob/master/TODO
/*
File: Reachability.h
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.0.4ddg
*/
/*
Significant additions made by Andrew W. Donoho, August 11, 2009.
This is a derived work of Apple's Reachability v2.0 class.
The below license is the new BSD license with the OSI recommended personalizations.
<http://www.opensource.org/licenses/bsd-license.php>
Extensions Copyright (C) 2009 Donoho Design Group, LLC. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Andrew W. Donoho nor Donoho Design Group, L.L.C.
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY DONOHO DESIGN GROUP, L.L.C. "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Apple's Original License on Reachability v2.0
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
constitutes acceptance of these terms. If you do not agree with these terms,
please do not use, install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and subject
to these terms, Apple grants you a personal, non-exclusive license, under
Apple's copyrights in this original Apple software (the "Apple Software"), to
use, reproduce, modify and redistribute the Apple Software, with or without
modifications, in source and/or binary forms; provided that if you redistribute
the Apple Software in its entirety and without modifications, you must retain
this notice and the following text and disclaimers in all such redistributions
of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may be used
to endorse or promote products derived from the Apple Software without specific
prior written permission from Apple. Except as expressly stated in this notice,
no other rights or licenses, express or implied, are granted by Apple herein,
including but not limited to any patent rights that may be infringed by your
derivative works or by other works in which the Apple Software may be
incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2009 Apple Inc. All Rights Reserved.
*/
/*
DDG extensions include:
Each reachability object now has a copy of the key used to store it in a
dictionary. This allows each observer to quickly determine if the event is
important to them.
-currentReachabilityStatus also has a significantly different decision criteria than
Apple's code.
A multiple convenience test methods have been added.
*/
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <netinet/in.h>
#define USE_DDG_EXTENSIONS 1 // Use DDG's Extensions to test network criteria.
// Since NSAssert and NSCAssert are used in this code,
// I recommend you set NS_BLOCK_ASSERTIONS=1 in the release versions of your projects.
enum {
// DDG NetworkStatus Constant Names.
kNotReachable = 0, // Apple's code depends upon 'NotReachable' being the same value as 'NO'.
kReachableViaWWAN, // Switched order from Apple's enum. WWAN is active before WiFi.
kReachableViaWiFi
};
typedef uint32_t NetworkStatus;
enum {
// Apple NetworkStatus Constant Names.
NotReachable = kNotReachable,
ReachableViaWiFi = kReachableViaWiFi,
ReachableViaWWAN = kReachableViaWWAN
};
extern NSString *const kInternetConnection;
extern NSString *const kLocalWiFiConnection;
extern NSString *const kReachabilityChangedNotification;
@interface Reachability: NSObject {
@private
NSString *key_;
SCNetworkReachabilityRef reachabilityRef;
}
@property (copy) NSString *key; // Atomic because network operations are asynchronous.
// Designated Initializer.
- (Reachability *) initWithReachabilityRef: (SCNetworkReachabilityRef) ref;
// Use to check the reachability of a particular host name.
+ (Reachability *) reachabilityWithHostName: (NSString*) hostName;
// Use to check the reachability of a particular IP address.
+ (Reachability *) reachabilityWithAddress: (const struct sockaddr_in*) hostAddress;
// Use to check whether the default route is available.
// Should be used to, at minimum, establish network connectivity.
+ (Reachability *) reachabilityForInternetConnection;
// Use to check whether a local wifi connection is available.
+ (Reachability *) reachabilityForLocalWiFi;
//Start listening for reachability notifications on the current run loop.
- (BOOL) startNotifier;
- (void) stopNotifier;
// Comparison routines to enable choosing actions in a notification.
- (BOOL) isEqual: (Reachability *) r;
// These are the status tests.
- (NetworkStatus) currentReachabilityStatus;
// The main direct test of reachability.
- (BOOL) isReachable;
// WWAN may be available, but not active until a connection has been established.
// WiFi may require a connection for VPN on Demand.
- (BOOL) isConnectionRequired; // Identical DDG variant.
- (BOOL) connectionRequired; // Apple's routine.
// Dynamic, on demand connection?
- (BOOL) isConnectionOnDemand;
// Is user intervention required?
- (BOOL) isInterventionRequired;
// Routines for specific connection testing by your app.
- (BOOL) isReachableViaWWAN;
- (BOOL) isReachableViaWiFi;
- (SCNetworkReachabilityFlags) reachabilityFlags;
@end
\ No newline at end of file
/*
File: Reachability.m
Abstract: Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
Version: 2.0.4ddg
*/
/*
Significant additions made by Andrew W. Donoho, August 11, 2009.
This is a derived work of Apple's Reachability v2.0 class.
The below license is the new BSD license with the OSI recommended personalizations.
<http://www.opensource.org/licenses/bsd-license.php>
Extensions Copyright (C) 2009 Donoho Design Group, LLC. All Rights Reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of Andrew W. Donoho nor Donoho Design Group, L.L.C.
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY DONOHO DESIGN GROUP, L.L.C. "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
Apple's Original License on Reachability v2.0
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
("Apple") in consideration of your agreement to the following terms, and your
use, installation, modification or redistribution of this Apple software
constitutes acceptance of these terms. If you do not agree with these terms,
please do not use, install, modify or redistribute this Apple software.
In consideration of your agreement to abide by the following terms, and subject
to these terms, Apple grants you a personal, non-exclusive license, under
Apple's copyrights in this original Apple software (the "Apple Software"), to
use, reproduce, modify and redistribute the Apple Software, with or without
modifications, in source and/or binary forms; provided that if you redistribute
the Apple Software in its entirety and without modifications, you must retain
this notice and the following text and disclaimers in all such redistributions
of the Apple Software.
Neither the name, trademarks, service marks or logos of Apple Inc. may be used
to endorse or promote products derived from the Apple Software without specific
prior written permission from Apple. Except as expressly stated in this notice,
no other rights or licenses, express or implied, are granted by Apple herein,
including but not limited to any patent rights that may be infringed by your
derivative works or by other works in which the Apple Software may be
incorporated.
The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
COMBINATION WITH YOUR PRODUCTS.
IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Copyright (C) 2009 Apple Inc. All Rights Reserved.
*/
/*
Each reachability object now has a copy of the key used to store it in a dictionary.
This allows each observer to quickly determine if the event is important to them.
*/
#import <sys/socket.h>
#import <netinet/in.h>
#import <netinet6/in6.h>
#import <arpa/inet.h>
#import <ifaddrs.h>
#import <netdb.h>
#import <CoreFoundation/CoreFoundation.h>
#import "Reachability.h"
NSString *const kInternetConnection = @"InternetConnection";
NSString *const kLocalWiFiConnection = @"LocalWiFiConnection";
NSString *const kReachabilityChangedNotification = @"NetworkReachabilityChangedNotification";
#define CLASS_DEBUG 1 // Turn on logReachabilityFlags. Must also have a project wide defined DEBUG.
#if (defined DEBUG && defined CLASS_DEBUG)
#define logReachabilityFlags(flags) (logReachabilityFlags_(__PRETTY_FUNCTION__, __LINE__, flags))
static NSString *reachabilityFlags_(SCNetworkReachabilityFlags flags) {
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) // Apple advises you to use the magic number instead of a symbol.
return [NSString stringWithFormat:@"Reachability Flags: %c%c %c%c%c%c%c%c%c",
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
#else
// Compile out the v3.0 features for v2.2.1 deployment.
return [NSString stringWithFormat:@"Reachability Flags: %c%c %c%c%c%c%c%c",
(flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
(flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
(flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
(flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
(flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
// v3 kSCNetworkReachabilityFlagsConnectionOnTraffic == v2 kSCNetworkReachabilityFlagsConnectionAutomatic
(flags & kSCNetworkReachabilityFlagsConnectionAutomatic) ? 'C' : '-',
// (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-', // No v2 equivalent.
(flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
(flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-'];
#endif
} // reachabilityFlags_()
static void logReachabilityFlags_(const char *name, int line, SCNetworkReachabilityFlags flags) {
NSLog(@"%s (%d) \n\t%@", name, line, reachabilityFlags_(flags));
} // logReachabilityFlags_()
#define logNetworkStatus(status) (logNetworkStatus_(__PRETTY_FUNCTION__, __LINE__, status))
static void logNetworkStatus_(const char *name, int line, NetworkStatus status) {
NSString *statusString = nil;
switch (status) {
case kNotReachable:
statusString = [NSString stringWithString: @"Not Reachable"];
break;
case kReachableViaWWAN:
statusString = [NSString stringWithString: @"Reachable via WWAN"];
break;
case kReachableViaWiFi:
statusString = [NSString stringWithString: @"Reachable via WiFi"];
break;
}
NSLog(@"%s (%d) \n\tNetwork Status: %@", name, line, statusString);
} // logNetworkStatus_()
#else
#define logReachabilityFlags(flags)
#define logNetworkStatus(status)
#endif
@interface Reachability (private)
- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags;
@end
@implementation Reachability
@synthesize key = key_;
// Preclude direct access to ivars.
+ (BOOL) accessInstanceVariablesDirectly {
return NO;
} // accessInstanceVariablesDirectly
- (void) dealloc {
[self stopNotifier];
if(reachabilityRef) {
CFRelease(reachabilityRef); reachabilityRef = NULL;
}
self.key = nil;
[super dealloc];
} // dealloc
- (Reachability *) initWithReachabilityRef: (SCNetworkReachabilityRef) ref
{
self = [super init];
if (self != nil)
{
reachabilityRef = ref;
}
return self;
} // initWithReachabilityRef:
#if (defined DEBUG && defined CLASS_DEBUG)
- (NSString *) description {
NSAssert(reachabilityRef, @"-description called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags = 0;
SCNetworkReachabilityGetFlags(reachabilityRef, &flags);
return [NSString stringWithFormat: @"%@\n\t%@", self.key, reachabilityFlags_(flags)];
} // description
#endif
#pragma mark -
#pragma mark Notification Management Methods
//Start listening for reachability notifications on the current run loop
static void ReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info) {
#pragma unused (target, flags)
NSCAssert(info, @"info was NULL in ReachabilityCallback");
NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was the wrong class in ReachabilityCallback");
//We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
// in case someone uses the Reachablity object in a different thread.
NSAutoreleasePool* pool = [NSAutoreleasePool new];
// Post a notification to notify the client that the network reachability changed.
[[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification
object: (Reachability *) info];
[pool release];
} // ReachabilityCallback()
- (BOOL) startNotifier {
SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL};
if(SCNetworkReachabilitySetCallback(reachabilityRef, ReachabilityCallback, &context)) {
if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
return YES;
}
}
return NO;
} // startNotifier
- (void) stopNotifier {
if(reachabilityRef) {
SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
}
} // stopNotifier
- (BOOL) isEqual: (Reachability *) r {
return [r.key isEqualToString: self.key];
} // isEqual:
#pragma mark -
#pragma mark Reachability Allocation Methods
+ (Reachability *) reachabilityWithHostName: (NSString *) hostName {
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
if (ref) {
Reachability *r = [[[self alloc] initWithReachabilityRef: ref] autorelease];
r.key = hostName;
return r;
}
return nil;
} // reachabilityWithHostName
+ (NSString *) makeAddressKey: (in_addr_t) addr {
// addr is assumed to be in network byte order.
static const int highShift = 24;
static const int highMidShift = 16;
static const int lowMidShift = 8;
static const in_addr_t mask = 0x000000ff;
addr = ntohl(addr);
return [NSString stringWithFormat: @"%d.%d.%d.%d",
(addr >> highShift) & mask,
(addr >> highMidShift) & mask,
(addr >> lowMidShift) & mask,
addr & mask];
} // makeAddressKey:
+ (Reachability *) reachabilityWithAddress: (const struct sockaddr_in *) hostAddress {
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
if (ref) {
Reachability *r = [[[self alloc] initWithReachabilityRef: ref] autorelease];
r.key = [self makeAddressKey: hostAddress->sin_addr.s_addr];
return r;
}
return nil;
} // reachabilityWithAddress
+ (Reachability *) reachabilityForInternetConnection {
struct sockaddr_in zeroAddress;
bzero(&zeroAddress, sizeof(zeroAddress));
zeroAddress.sin_len = sizeof(zeroAddress);
zeroAddress.sin_family = AF_INET;
Reachability *r = [self reachabilityWithAddress: &zeroAddress];
r.key = kInternetConnection;
return r;
} // reachabilityForInternetConnection
+ (Reachability *) reachabilityForLocalWiFi {
struct sockaddr_in localWifiAddress;
bzero(&localWifiAddress, sizeof(localWifiAddress));
localWifiAddress.sin_len = sizeof(localWifiAddress);
localWifiAddress.sin_family = AF_INET;
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
Reachability *r = [self reachabilityWithAddress: &localWifiAddress];
r.key = kLocalWiFiConnection;
return r;
} // reachabilityForLocalWiFi
#pragma mark -
#pragma mark Network Flag Handling Methods
#if USE_DDG_EXTENSIONS
//
// iPhone condition codes as reported by a 3GS running iPhone OS v3.0.
// Airplane Mode turned on: Reachability Flag Status: -- -------
// WWAN Active: Reachability Flag Status: WR -t-----
// WWAN Connection required: Reachability Flag Status: WR ct-----
// WiFi turned on: Reachability Flag Status: -R ------- Reachable.
// Local WiFi turned on: Reachability Flag Status: -R xxxxxxd Reachable.
// WiFi turned on: Reachability Flag Status: -R ct----- Connection down. (Non-intuitive, empirically determined answer.)
const SCNetworkReachabilityFlags kConnectionDown = kSCNetworkReachabilityFlagsConnectionRequired |
kSCNetworkReachabilityFlagsTransientConnection;
// WiFi turned on: Reachability Flag Status: -R ct-i--- Reachable but it will require user intervention (e.g. enter a WiFi password).
// WiFi turned on: Reachability Flag Status: -R -t----- Reachable via VPN.
//
// In the below method, an 'x' in the flag status means I don't care about its value.
//
// This method differs from Apple's by testing explicitly for empirically observed values.
// This gives me more confidence in it's correct behavior. Apple's code covers more cases
// than mine. My code covers the cases that occur.
//
- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags {
if (flags & kSCNetworkReachabilityFlagsReachable) {
// Local WiFi -- Test derived from Apple's code: -localWiFiStatusForFlags:.
if (self.key == kLocalWiFiConnection) {
// Reachability Flag Status: xR xxxxxxd Reachable.
return (flags & kSCNetworkReachabilityFlagsIsDirect) ? kReachableViaWiFi : kNotReachable;
}
// Observed WWAN Values:
// WWAN Active: Reachability Flag Status: WR -t-----
// WWAN Connection required: Reachability Flag Status: WR ct-----
//
// Test Value: Reachability Flag Status: WR xxxxxxx
if (flags & kSCNetworkReachabilityFlagsIsWWAN) { return kReachableViaWWAN; }
// Clear moot bits.
flags &= ~kSCNetworkReachabilityFlagsReachable;
flags &= ~kSCNetworkReachabilityFlagsIsDirect;
flags &= ~kSCNetworkReachabilityFlagsIsLocalAddress; // kInternetConnection is local.
// Reachability Flag Status: -R ct---xx Connection down.
if (flags == kConnectionDown) { return kNotReachable; }
// Reachability Flag Status: -R -t---xx Reachable. WiFi + VPN(is up) (Thank you Ling Wang)
if (flags & kSCNetworkReachabilityFlagsTransientConnection) { return kReachableViaWiFi; }
// Reachability Flag Status: -R -----xx Reachable.
if (flags == 0) { return kReachableViaWiFi; }
// Apple's code tests for dynamic connection types here. I don't.
// If a connection is required, regardless of whether it is on demand or not, it is a WiFi connection.
// If you care whether a connection needs to be brought up, use -isConnectionRequired.
// If you care about whether user intervention is necessary, use -isInterventionRequired.
// If you care about dynamically establishing the connection, use -isConnectionIsOnDemand.
// Reachability Flag Status: -R cxxxxxx Reachable.
if (flags & kSCNetworkReachabilityFlagsConnectionRequired) { return kReachableViaWiFi; }
// Required by the compiler. Should never get here. Default to not connected.
#if (defined DEBUG && defined CLASS_DEBUG)
NSAssert1(NO, @"Uncaught reachability test. Flags: %@", reachabilityFlags_(flags));
#endif
return kNotReachable;
}
// Reachability Flag Status: x- xxxxxxx
return kNotReachable;
} // networkStatusForFlags:
- (NetworkStatus) currentReachabilityStatus {
NSAssert(reachabilityRef, @"currentReachabilityStatus called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags = 0;
NetworkStatus status = kNotReachable;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
// logReachabilityFlags(flags);
status = [self networkStatusForFlags: flags];
return status;
}
return kNotReachable;
} // currentReachabilityStatus
- (BOOL) isReachable {
NSAssert(reachabilityRef, @"isReachable called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags = 0;
NetworkStatus status = kNotReachable;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
// logReachabilityFlags(flags);
status = [self networkStatusForFlags: flags];
// logNetworkStatus(status);
return (kNotReachable != status);
}
return NO;
} // isReachable
- (BOOL) isConnectionRequired {
NSAssert(reachabilityRef, @"isConnectionRequired called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
logReachabilityFlags(flags);
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
} // isConnectionRequired
- (BOOL) connectionRequired {
return [self isConnectionRequired];
} // connectionRequired
#endif
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000)
static const SCNetworkReachabilityFlags kOnDemandConnection = kSCNetworkReachabilityFlagsConnectionOnTraffic |
kSCNetworkReachabilityFlagsConnectionOnDemand;
#else
static const SCNetworkReachabilityFlags kOnDemandConnection = kSCNetworkReachabilityFlagsConnectionAutomatic;
#endif
- (BOOL) isConnectionOnDemand {
NSAssert(reachabilityRef, @"isConnectionIsOnDemand called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
logReachabilityFlags(flags);
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & kOnDemandConnection));
}
return NO;
} // isConnectionOnDemand
- (BOOL) isInterventionRequired {
NSAssert(reachabilityRef, @"isInterventionRequired called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
logReachabilityFlags(flags);
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
}
return NO;
} // isInterventionRequired
- (BOOL) isReachableViaWWAN {
NSAssert(reachabilityRef, @"isReachableViaWWAN called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags = 0;
NetworkStatus status = kNotReachable;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
logReachabilityFlags(flags);
status = [self networkStatusForFlags: flags];
return (kReachableViaWWAN == status);
}
return NO;
} // isReachableViaWWAN
- (BOOL) isReachableViaWiFi {
NSAssert(reachabilityRef, @"isReachableViaWiFi called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags = 0;
NetworkStatus status = kNotReachable;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
logReachabilityFlags(flags);
status = [self networkStatusForFlags: flags];
return (kReachableViaWiFi == status);
}
return NO;
} // isReachableViaWiFi
- (SCNetworkReachabilityFlags) reachabilityFlags {
NSAssert(reachabilityRef, @"reachabilityFlags called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags = 0;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
logReachabilityFlags(flags);
return flags;
}
return 0;
} // reachabilityFlags
#pragma mark -
#pragma mark Apple's Network Flag Handling Methods
#if !USE_DDG_EXTENSIONS
/*
*
* Apple's Network Status testing code.
* The only changes that have been made are to use the new logReachabilityFlags macro and
* test for local WiFi via the key instead of Apple's boolean. Also, Apple's code was for v3.0 only
* iPhone OS. v2.2.1 and earlier conditional compiling is turned on. Hence, to mirror Apple's behavior,
* set your Base SDK to v3.0 or higher.
*
*/
- (NetworkStatus) localWiFiStatusForFlags: (SCNetworkReachabilityFlags) flags
{
logReachabilityFlags(flags);
BOOL retVal = NotReachable;
if((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect))
{
retVal = ReachableViaWiFi;
}
return retVal;
}
- (NetworkStatus) networkStatusForFlags: (SCNetworkReachabilityFlags) flags
{
logReachabilityFlags(flags);
if (!(flags & kSCNetworkReachabilityFlagsReachable))
{
// if target host is not reachable
return NotReachable;
}
BOOL retVal = NotReachable;
if (!(flags & kSCNetworkReachabilityFlagsConnectionRequired))
{
// if target host is reachable and no connection is required
// then we'll assume (for now) that your on Wi-Fi
retVal = ReachableViaWiFi;
}
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 30000) // Apple advises you to use the magic number instead of a symbol.
if ((flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ||
(flags & kSCNetworkReachabilityFlagsConnectionOnTraffic))
#else
if (flags & kSCNetworkReachabilityFlagsConnectionAutomatic)
#endif
{
// ... and the connection is on-demand (or on-traffic) if the
// calling application is using the CFSocketStream or higher APIs
if (!(flags & kSCNetworkReachabilityFlagsInterventionRequired))
{
// ... and no [user] intervention is needed
retVal = ReachableViaWiFi;
}
}
if (flags & kSCNetworkReachabilityFlagsIsWWAN)
{
// ... but WWAN connections are OK if the calling application
// is using the CFNetwork (CFSocketStream?) APIs.
retVal = ReachableViaWWAN;
}
return retVal;
}
- (NetworkStatus) currentReachabilityStatus
{
NSAssert(reachabilityRef, @"currentReachabilityStatus called with NULL reachabilityRef");
NetworkStatus retVal = NotReachable;
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
{
if(self.key == kLocalWiFiConnection)
{
retVal = [self localWiFiStatusForFlags: flags];
}
else
{
retVal = [self networkStatusForFlags: flags];
}
}
return retVal;
}
- (BOOL) isReachable {
NSAssert(reachabilityRef, @"isReachable called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags = 0;
NetworkStatus status = kNotReachable;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
logReachabilityFlags(flags);
if(self.key == kLocalWiFiConnection) {
status = [self localWiFiStatusForFlags: flags];
} else {
status = [self networkStatusForFlags: flags];
}
return (kNotReachable != status);
}
return NO;
} // isReachable
- (BOOL) isConnectionRequired {
return [self connectionRequired];
} // isConnectionRequired
- (BOOL) connectionRequired {
NSAssert(reachabilityRef, @"connectionRequired called with NULL reachabilityRef");
SCNetworkReachabilityFlags flags;
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
logReachabilityFlags(flags);
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
}
return NO;
} // connectionRequired
#endif
@end
\ No newline at end of file
Pod::Spec.new do |s|
s.name = 'Reachability'
s.version = '2.0.5'
s.platform = :ios
s.homepage = 'http://blog.ddg.com/?p=24'
s.authors = 'Apple', 'Donoho Design Group, LLC'
s.summary = 'A wrapper for the SystemConfiguration Reachability APIs.'
s.description = 'This is Apple’s example code of the SystemConfiguration Reachability APIs, ' \
'adapted by Andrew Donoho, split-off from the ASIHTTPRequest source. ' \
'(This code needs an actual maintainer.)'
s.source = { :git => 'git://github.com/CocoaPods/unmaintained-pod-Reachability.git', :tag => '2.0.5' }
s.source_files = 'Reachability.{h,m}'
s.framework = 'SystemConfiguration'
end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>archiveVersion</key>
<string>1</string>
<key>classes</key>
<dict/>
<key>objectVersion</key>
<string>46</string>
<key>objects</key>
<dict>
<key>061523DA9D2646ACA1EF295C</key>
<dict>
<key>explicitFileType</key>
<string>archive.ar</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>name</key>
<string>libPods.a</string>
<key>path</key>
<string>libPods.a</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>0AEC166B36EA4BBAB35AEB94</key>
<dict>
<key>fileRef</key>
<string>061523DA9D2646ACA1EF295C</string>
<key>isa</key>
<string>PBXBuildFile</string>
<key>settings</key>
<dict/>
</dict>
<key>26E99B1E26B641169EE1B5F6</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array/>
<key>inputPaths</key>
<array/>
<key>isa</key>
<string>PBXShellScriptBuildPhase</string>
<key>name</key>
<string>Copy Pods Resources</string>
<key>outputPaths</key>
<array/>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
<key>shellPath</key>
<string>/bin/sh</string>
<key>shellScript</key>
<string>"${SRCROOT}/Pods/Pods-resources.sh"
</string>
<key>showEnvVarsInLog</key>
<string>1</string>
</dict>
<key>E575589216C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A416C5943000DC1500</string>
<string>E575589D16C5943000DC1500</string>
<string>E575589C16C5943000DC1500</string>
<string>EFF75FAF8D54497F8417E948</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589316C5943000DC1500</key>
<dict>
<key>attributes</key>
<dict>
<key>CLASSPREFIX</key>
<string>CP</string>
<key>LastUpgradeCheck</key>
<string>0460</string>
<key>ORGANIZATIONNAME</key>
<string>CocoaPods</string>
</dict>
<key>buildConfigurationList</key>
<string>E575589616C5943000DC1500</string>
<key>compatibilityVersion</key>
<string>Xcode 3.2</string>
<key>developmentRegion</key>
<string>English</string>
<key>hasScannedForEncodings</key>
<string>0</string>
<key>isa</key>
<string>PBXProject</string>
<key>knownRegions</key>
<array>
<string>en</string>
</array>
<key>mainGroup</key>
<string>E575589216C5943000DC1500</string>
<key>productRefGroup</key>
<string>E575589C16C5943000DC1500</string>
<key>projectDirPath</key>
<string></string>
<key>projectReferences</key>
<array/>
<key>projectRoot</key>
<string></string>
<key>targets</key>
<array>
<string>E575589A16C5943000DC1500</string>
</array>
</dict>
<key>E575589616C5943000DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B616C5943100DC1500</string>
<string>E57558B716C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>defaultConfigurationName</key>
<string>Release</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E575589716C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558AB16C5943000DC1500</string>
<string>E57558B216C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXSourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589816C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E575589F16C5943000DC1500</string>
<string>0AEC166B36EA4BBAB35AEB94</string>
</array>
<key>isa</key>
<string>PBXFrameworksBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589916C5943000DC1500</key>
<dict>
<key>buildActionMask</key>
<string>2147483647</string>
<key>files</key>
<array>
<string>E57558A916C5943000DC1500</string>
<string>E57558AF16C5943000DC1500</string>
<string>E57558B516C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXResourcesBuildPhase</string>
<key>runOnlyForDeploymentPostprocessing</key>
<string>0</string>
</dict>
<key>E575589A16C5943000DC1500</key>
<dict>
<key>buildConfigurationList</key>
<string>E57558B816C5943100DC1500</string>
<key>buildPhases</key>
<array>
<string>E575589716C5943000DC1500</string>
<string>E575589816C5943000DC1500</string>
<string>E575589916C5943000DC1500</string>
<string>26E99B1E26B641169EE1B5F6</string>
</array>
<key>buildRules</key>
<array/>
<key>dependencies</key>
<array/>
<key>isa</key>
<string>PBXNativeTarget</string>
<key>name</key>
<string>SampleApp</string>
<key>productName</key>
<string>SampleApp</string>
<key>productReference</key>
<string>E575589B16C5943000DC1500</string>
<key>productType</key>
<string>com.apple.product-type.application</string>
</dict>
<key>E575589B16C5943000DC1500</key>
<dict>
<key>explicitFileType</key>
<string>wrapper.application</string>
<key>includeInIndex</key>
<string>0</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>path</key>
<string>SampleApp.app</string>
<key>sourceTree</key>
<string>BUILT_PRODUCTS_DIR</string>
</dict>
<key>E575589C16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589B16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Products</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589D16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E575589E16C5943000DC1500</string>
<string>E57558A016C5943000DC1500</string>
<string>061523DA9D2646ACA1EF295C</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E575589E16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Cocoa.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Cocoa.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E575589F16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E575589E16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558A016C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A116C5943000DC1500</string>
<string>E57558A216C5943000DC1500</string>
<string>E57558A316C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Other Frameworks</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>AppKit.framework</string>
<key>path</key>
<string>System/Library/Frameworks/AppKit.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A216C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>CoreData.framework</string>
<key>path</key>
<string>System/Library/Frameworks/CoreData.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A316C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>wrapper.framework</string>
<key>name</key>
<string>Foundation.framework</string>
<key>path</key>
<string>System/Library/Frameworks/Foundation.framework</string>
<key>sourceTree</key>
<string>SDKROOT</string>
</dict>
<key>E57558A416C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B016C5943000DC1500</string>
<string>E57558B116C5943000DC1500</string>
<string>E57558B316C5943100DC1500</string>
<string>E57558A516C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>path</key>
<string>SampleApp</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A516C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A616C5943000DC1500</string>
<string>E57558A716C5943000DC1500</string>
<string>E57558AA16C5943000DC1500</string>
<string>E57558AC16C5943000DC1500</string>
<string>E57558AD16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXGroup</string>
<key>name</key>
<string>Supporting Files</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A616C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.xml</string>
<key>path</key>
<string>SampleApp-Info.plist</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A716C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558A816C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A816C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.plist.strings</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/InfoPlist.strings</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558A916C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558A716C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AA16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>main.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AB16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AA16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558AC16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>SampleApp-Prefix.pch</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AD16C5943000DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558AE16C5943000DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AE16C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.rtf</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/Credits.rtf</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558AF16C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558AD16C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B016C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.h</string>
<key>path</key>
<string>CPAppDelegate.h</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B116C5943000DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>sourcecode.c.objc</string>
<key>path</key>
<string>CPAppDelegate.m</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B216C5943000DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B116C5943000DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B316C5943100DC1500</key>
<dict>
<key>children</key>
<array>
<string>E57558B416C5943100DC1500</string>
</array>
<key>isa</key>
<string>PBXVariantGroup</string>
<key>name</key>
<string>MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B416C5943100DC1500</key>
<dict>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>file.xib</string>
<key>name</key>
<string>en</string>
<key>path</key>
<string>en.lproj/MainMenu.xib</string>
<key>sourceTree</key>
<string>&lt;group&gt;</string>
</dict>
<key>E57558B516C5943100DC1500</key>
<dict>
<key>fileRef</key>
<string>E57558B316C5943100DC1500</string>
<key>isa</key>
<string>PBXBuildFile</string>
</dict>
<key>E57558B616C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>NO</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_DYNAMIC_NO_PIC</key>
<string>NO</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_OPTIMIZATION_LEVEL</key>
<string>0</string>
<key>GCC_PREPROCESSOR_DEFINITIONS</key>
<array>
<string>DEBUG=1</string>
<string>$(inherited)</string>
</array>
<key>GCC_SYMBOLS_PRIVATE_EXTERN</key>
<string>NO</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>ONLY_ACTIVE_ARCH</key>
<string>YES</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558B716C5943100DC1500</key>
<dict>
<key>buildSettings</key>
<dict>
<key>ALWAYS_SEARCH_USER_PATHS</key>
<string>NO</string>
<key>ARCHS</key>
<string>$(ARCHS_STANDARD_64_BIT)</string>
<key>CLANG_CXX_LANGUAGE_STANDARD</key>
<string>gnu++0x</string>
<key>CLANG_CXX_LIBRARY</key>
<string>libc++</string>
<key>CLANG_WARN_CONSTANT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_EMPTY_BODY</key>
<string>YES</string>
<key>CLANG_WARN_ENUM_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN_INT_CONVERSION</key>
<string>YES</string>
<key>CLANG_WARN__DUPLICATE_METHOD_MATCH</key>
<string>YES</string>
<key>COPY_PHASE_STRIP</key>
<string>YES</string>
<key>DEBUG_INFORMATION_FORMAT</key>
<string>dwarf-with-dsym</string>
<key>GCC_C_LANGUAGE_STANDARD</key>
<string>gnu99</string>
<key>GCC_ENABLE_OBJC_EXCEPTIONS</key>
<string>YES</string>
<key>GCC_WARN_64_TO_32_BIT_CONVERSION</key>
<string>YES</string>
<key>GCC_WARN_ABOUT_RETURN_TYPE</key>
<string>YES</string>
<key>GCC_WARN_UNINITIALIZED_AUTOS</key>
<string>YES</string>
<key>GCC_WARN_UNUSED_VARIABLE</key>
<string>YES</string>
<key>MACOSX_DEPLOYMENT_TARGET</key>
<string>10.8</string>
<key>SDKROOT</key>
<string>macosx</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>E57558B816C5943100DC1500</key>
<dict>
<key>buildConfigurations</key>
<array>
<string>E57558B916C5943100DC1500</string>
<string>E57558BA16C5943100DC1500</string>
</array>
<key>defaultConfigurationIsVisible</key>
<string>0</string>
<key>isa</key>
<string>XCConfigurationList</string>
</dict>
<key>E57558B916C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Debug</string>
</dict>
<key>E57558BA16C5943100DC1500</key>
<dict>
<key>baseConfigurationReference</key>
<string>EFF75FAF8D54497F8417E948</string>
<key>buildSettings</key>
<dict>
<key>COMBINE_HIDPI_IMAGES</key>
<string>YES</string>
<key>GCC_PRECOMPILE_PREFIX_HEADER</key>
<string>YES</string>
<key>GCC_PREFIX_HEADER</key>
<string>SampleApp/SampleApp-Prefix.pch</string>
<key>INFOPLIST_FILE</key>
<string>SampleApp/SampleApp-Info.plist</string>
<key>PRODUCT_NAME</key>
<string>$(TARGET_NAME)</string>
<key>WRAPPER_EXTENSION</key>
<string>app</string>
</dict>
<key>isa</key>
<string>XCBuildConfiguration</string>
<key>name</key>
<string>Release</string>
</dict>
<key>EFF75FAF8D54497F8417E948</key>
<dict>
<key>includeInIndex</key>
<string>1</string>
<key>isa</key>
<string>PBXFileReference</string>
<key>lastKnownFileType</key>
<string>text.xcconfig</string>
<key>name</key>
<string>Pods.xcconfig</string>
<key>path</key>
<string>Pods/Pods.xcconfig</string>
<key>sourceTree</key>
<string>SOURCE_ROOT</string>
</dict>
</dict>
<key>rootObject</key>
<string>E575589316C5943000DC1500</string>
</dict>
</plist>
<?xml version='1.0' encoding='UTF-8'?><Workspace version='1.0'><FileRef location='group:Pods/Pods.xcodeproj'/><FileRef location='group:SampleApp.xcodeproj'/></Workspace>
\ No newline at end of file
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# Notes: # Notes:
# #
# - The output of the pod command is saved in the `execution_output.txt` file # - The output of the pod command is saved in the `execution_output.txt` file
# which should be added to the Pods folders to test the CocoaPods UI. # which should be added to the `after` folder to test the CocoaPods UI.
# - To create a new test, just create a before folder with the environment to # - To create a new test, just create a before folder with the environment to
# test, copy it to the after folder and run the tested pod command inside. # test, copy it to the after folder and run the tested pod command inside.
# Then just add the tests below this files with the name of the folder and # Then just add the tests below this files with the name of the folder and
...@@ -58,10 +58,10 @@ require 'Xcodeproj' ...@@ -58,10 +58,10 @@ require 'Xcodeproj'
# @!group Description implementation # @!group Description implementation
def pod_check(command, folder) def check(arguments, folder)
copy_files("installation") copy_files(folder)
pod "install" launch_binary(arguments)
check_with_folder("installation") check_with_folder(folder)
end end
#--------------------------------------# #--------------------------------------#
...@@ -93,14 +93,20 @@ end ...@@ -93,14 +93,20 @@ end
# bundler ensuring that the execution is performed in the correct # bundler ensuring that the execution is performed in the correct
# environment. # environment.
# #
def pod(arguments) def launch_binary(arguments)
# TODO CP 0.16 doesn't offer the possibility to skip just the installation
# of the docs.
command = "#{POD_BINARY} #{arguments} --verbose --no-color"
Dir.chdir(TMP_DIR) do Dir.chdir(TMP_DIR) do
# TODO CP 0.16 doesn't offer the possibility to skip just the installation
# of the docs.
command = "#{POD_BINARY} #{arguments} --no-update --no-doc --verbose --no-color"
output = `#{command}` output = `#{command}`
it "$ pod #{arguments}" do
$?.should.satisfy("Pod binary failed\n\n#{output}") do
$?.success?
end
end
File.open('execution_output.txt', 'w') do |file| File.open('execution_output.txt', 'w') do |file|
file.write(command.gsub(ROOT.to_s, 'ROOT')) file.write(command.gsub(POD_BINARY, '$ pod'))
file.write(output.gsub(ROOT.to_s, 'ROOT').gsub(%r[/Users/.*/Library/Caches/CocoaPods/],"CACHES_DIR/")) file.write(output.gsub(ROOT.to_s, 'ROOT').gsub(%r[/Users/.*/Library/Caches/CocoaPods/],"CACHES_DIR/"))
end end
end end
...@@ -182,7 +188,7 @@ def compare_generic(expected, produced, relative_path) ...@@ -182,7 +188,7 @@ def compare_generic(expected, produced, relative_path)
description << expected description << expected
description << "" description << ""
description << ("--- DIFF " << "-" * 70) description << ("--- DIFF " << "-" * 70)
Diffy::Diff.new(produced.to_s, expected.to_s, :source => 'files', :context => 3).each do |line| Diffy::Diff.new(expected.to_s, produced.to_s, :source => 'files', :context => 3).each do |line|
case line case line
when /^\+/ then description << line.gsub("\n",'').green when /^\+/ then description << line.gsub("\n",'').green
when /^-/ then description << line.gsub("\n",'').red when /^-/ then description << line.gsub("\n",'').red
...@@ -200,24 +206,79 @@ end ...@@ -200,24 +206,79 @@ end
#-----------------------------------------------------------------------------# #-----------------------------------------------------------------------------#
describe "Integration with examples" do describe "Integration take 2" do
describe "Integrates a project with CocoaPods" do describe "Pod install" do
pod_check "install", "installation"
end describe "Integrates a project with CocoaPods" do
check "install --no-update --no-doc", "install_new"
end
describe "Adds a Pod to an existing installation" do
check "install --no-update --no-doc", "install_add_pod"
end
describe "Removes a Pod from an existing installation" do
check "install --no-update --no-doc", "install_add_pod"
end
# describe "Creates an installation with multiple target definitions" do
# check "install", "multiple_targets"
# end
# describe "Runs the Podfile callbacks" do
# check "update", "podfile_callbacks"
# end
# describe "Runs the specification callbacks" do
# check "update", "specification_callbacks"
# end
# describe "Generates the documentation of Pod during installation" do
# # TODO: requires CocoaPods 0.17
# check "update", "installation_update"
# end
# describe "Installs a Pod with different subspecs activated across different targets" do
# check "update", "subspecs"
# end
# describe "Installs a Pod with a local source" do
# check "update", "podfile_local_pod"
# end
# describe "Installs a Pod with an external source" do
# check "update", "podfile_external_source"
# end
# describe "Installs a Pod given the podspec" do
# check "update", "podfile_podspec"
# end
describe "Adds a Pod to an existing installation" do
# pod_check "install", "add_pod"
end end
describe "Removes a Pod from an existing installation" do #--------------------------------------#
# pod_check "install", "remove_pod"
describe "Pod update" do
describe "Updates an existing installation" do
check "update --no-update", "update"
end
end end
describe "Creates an installation with multiple target definitions" do #--------------------------------------#
# pod_check "install", "multiple_targets"
describe "Pod lint" do
describe "Lints a Pod" do
check "spec lint --quick", "spec_lint"
end
end end
#--------------------------------------#
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment