From 6a0b05265915ff863f162a4c9815258d4053eb46 Mon Sep 17 00:00:00 2001 From: Steven Fisher Date: Wed, 26 Sep 2012 16:47:56 -0700 Subject: [PATCH 1/3] Add error when building without ARC to a central file. --- AFNetworking/AFURLConnectionOperation.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/AFNetworking/AFURLConnectionOperation.m b/AFNetworking/AFURLConnectionOperation.m index 49a6730..a743e29 100644 --- a/AFNetworking/AFURLConnectionOperation.m +++ b/AFNetworking/AFURLConnectionOperation.m @@ -25,6 +25,11 @@ #import #endif +#if !__has_feature(objc_arc) +#error AFNetworking must be built with ARC. +// You can turn on ARC for only AFNetworking files by adding -fobjc-arc to the build phase for each of its files. +#endif + typedef enum { AFOperationPausedState = -1, AFOperationReadyState = 1, From 5704f0ae8dfeceb09df8321df2e0cde7dcd035ba Mon Sep 17 00:00:00 2001 From: Blake Watters Date: Wed, 26 Sep 2012 20:56:33 -0400 Subject: [PATCH 2/3] Import UIKit to avoid build errors from UIDevice references in "User-Agent" default header. closes AFNetworking/AFNetworking#542 --- AFNetworking/AFHTTPClient.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/AFNetworking/AFHTTPClient.m b/AFNetworking/AFHTTPClient.m index 972911b..2d0a748 100755 --- a/AFNetworking/AFHTTPClient.m +++ b/AFNetworking/AFHTTPClient.m @@ -36,6 +36,10 @@ #import #endif +#if __IPHONE_OS_VERSION_MIN_REQUIRED +#import +#endif + // Workaround for management of dispatch_retain() / dispatch_release() by ARC with iOS 6 / Mac OS X 10.8 #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) From d21ae7cbbad589d1722bee9c5c660158dae7fbcd Mon Sep 17 00:00:00 2001 From: Mattt Thompson Date: Thu, 27 Sep 2012 09:28:26 -0700 Subject: [PATCH 3/3] Updating notes about ARC and requirements --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed5fe68..3d1a111 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,17 @@ operation.outputStream = [NSOutputStream outputStreamToMemory]; ## Requirements -AFNetworking requires either [iOS 5.0](http://developer.apple.com/library/ios/#releasenotes/General/WhatsNewIniPhoneOS/Articles/iPhoneOS4.html) and above, or [Mac OS 10.7](http://developer.apple.com/library/mac/#releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_6.html#//apple_ref/doc/uid/TP40008898-SW7) ([64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)) and above. +AFNetworking 1.0 and higher requires either [iOS 5.0](http://developer.apple.com/library/ios/#releasenotes/General/WhatsNewIniPhoneOS/Articles/iPhoneOS4.html) and above, or [Mac OS 10.7](http://developer.apple.com/library/mac/#releasenotes/MacOSX/WhatsNewInOSX/Articles/MacOSX10_6.html#//apple_ref/doc/uid/TP40008898-SW7) ([64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)) and above. + +For compatibility with iOS 4.3, use the latest 0.10.x release. + +### ARC + +AFNetworking uses ARC as of its 1.0 release. + +If you are using AFNetworking 1.0 in your non-arc project, you will need to set a `-fobjc-arc` compiler flag on all of the AFNetworking source files. Conversely, if you are adding a pre-1.0 version of AFNetworking, you will need to set a `-fno-objc-arc` compiler flag. + +To set a compiler flag in Xcode, go to your active target and select the "Build Phases" tab. Now select all AFNetworking source files, press Enter, insert `-fobjc-arc` or `-fno-objc-arc` and then "Done" to enable or disable ARC for AFNetworking. ## Credits