From 7c8242f10796e77e6618aba87e9c36488b9e649c Mon Sep 17 00:00:00 2001 From: Luke Redpath Date: Thu, 30 Jun 2011 23:26:47 +0100 Subject: [PATCH 1/4] Added README note about ARC --- README.markdown | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.markdown b/README.markdown index 42d7b16..31c5dbd 100644 --- a/README.markdown +++ b/README.markdown @@ -15,3 +15,7 @@ Resty is distributed as a static framework for iOS and a regular framework Mac; To download Resty, you can either [clone this project and build from scratch](http://projects.lukeredpath.co.uk/resty/getting-started.html), grab one of the latest releases from the [Github downloads tab](http://github.com/lukeredpath/LRResty/downloads) or grab one of the [nightly builds](http://projects.lukeredpath.co.uk/resty/downloads). For detailed information, [check out the Resty website](http://projects.lukeredpath.co.uk/documentation.html). + +## Using LRResty with ARC projects + +A version of LRResty that uses [Objective-C Automatic Reference Counting](http://clang.llvm.org/docs/AutomaticReferenceCounting.html) (ARC) is available in the [arcified branch](https://github.com/lukeredpath/LRResty/tree/arcified). This, like ARC, should be considered experimental. I aim to move over to ARC fully when it is production ready (but without the use of __weak to maintain iOS4 compatibility). I will aim to keep both branches in sync, feature-wise. From 76589a10c2cde2dcd885f1fd7aa292399760d3d3 Mon Sep 17 00:00:00 2001 From: Luke Redpath Date: Thu, 30 Jun 2011 23:48:55 +0100 Subject: [PATCH 2/4] Set deployment targets to 10.6/iOS4 --- LRResty.xcodeproj/project.pbxproj | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/LRResty.xcodeproj/project.pbxproj b/LRResty.xcodeproj/project.pbxproj index a73092b..6632263 100644 --- a/LRResty.xcodeproj/project.pbxproj +++ b/LRResty.xcodeproj/project.pbxproj @@ -1455,6 +1455,8 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "LRResty/LRResty-Prefix.pch"; INSTALL_PATH = /usr/local/lib; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + MACOSX_DEPLOYMENT_TARGET = 10.6; PRODUCT_NAME = LRResty; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; @@ -1472,6 +1474,8 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "LRResty/LRResty-Prefix.pch"; INSTALL_PATH = /usr/local/lib; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; + MACOSX_DEPLOYMENT_TARGET = 10.6; PRODUCT_NAME = LRResty; RUN_CLANG_STATIC_ANALYZER = YES; SDKROOT = iphoneos; @@ -1576,6 +1580,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = Tests/Support; INFOPLIST_FILE = "Resources/Acceptance Tests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -1607,6 +1612,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = Tests/Support; INFOPLIST_FILE = "Resources/Acceptance Tests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -1690,6 +1696,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = Tests/Support; INFOPLIST_FILE = "Resources/Acceptance Tests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -1722,6 +1729,7 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0; HEADER_SEARCH_PATHS = Tests/Support; INFOPLIST_FILE = "Resources/Acceptance Tests-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.0; OTHER_LDFLAGS = ( "-framework", Foundation, From 143845b1964b92d6a0cdc15a4a34abd931a6015c Mon Sep 17 00:00:00 2001 From: Luke Redpath Date: Fri, 1 Jul 2011 00:02:42 +0100 Subject: [PATCH 3/4] This was crashing with iOS4, it seems sensible to check for nil headers before calling an API that is expecting an NSDictionary. --- Classes/LRRestyResponse.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Classes/LRRestyResponse.m b/Classes/LRRestyResponse.m index f5c6f1b..d62c07a 100644 --- a/Classes/LRRestyResponse.m +++ b/Classes/LRRestyResponse.m @@ -13,6 +13,8 @@ NSDictionary *extractCookiesFromHeaders(NSDictionary *headers, NSURL *url) { + if (headers == nil) return [NSDictionary dictionary]; + NSMutableDictionary *cookies = [NSMutableDictionary dictionary]; for (NSHTTPCookie *cookie in [NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:url]) { [cookies setObject:cookie forKey:cookie.name]; From 5378a5014b1b6b82822299cf5ecab44e5c6ce54c Mon Sep 17 00:00:00 2001 From: Luke Redpath Date: Fri, 1 Jul 2011 00:07:53 +0100 Subject: [PATCH 4/4] This was failing in iOS 4.3 --- Tests/Acceptance/StreamingTests.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/Acceptance/StreamingTests.m b/Tests/Acceptance/StreamingTests.m index 2ceb8e7..f3e1627 100644 --- a/Tests/Acceptance/StreamingTests.m +++ b/Tests/Acceptance/StreamingTests.m @@ -32,12 +32,12 @@ - (void)testCanPerformGetRequestAndStreamResponse - (void)testCancellationUsingTwitterStream; { - NSMutableArray *chunks = [NSMutableArray array]; + __block NSMutableArray *chunks = [NSMutableArray array]; [client setUsername:TwitterUsername password:TwitterPassword]; [client get:@"http://stream.twitter.com/1/statuses/sample.json" - onData:^(NSData *chunk, BOOL *cancel) { + onData:^(NSData *chunk, BOOL *cancel) { if (chunk) { [chunks addObject:chunk]; }