Permalink
Browse files

Convert to ARC.

  • Loading branch information...
1 parent e0cef1c commit ea80e95afd79c4382e6f32c99d514e33793a8e3e @lukeredpath committed Apr 1, 2012
@@ -13,8 +13,8 @@
NSDictionary *authResponseData;
NSDate *expiresAt;
}
-@property (nonatomic, readonly) NSString *accessToken;
-@property (nonatomic, readonly) NSString *refreshToken;
+@property (unsafe_unretained, nonatomic, readonly) NSString *accessToken;
+@property (unsafe_unretained, nonatomic, readonly) NSString *refreshToken;
@property (nonatomic, readonly) NSDate *expiresAt;
- (id)initWithAuthorizationResponse:(NSDictionary *)_data;
@@ -31,12 +31,6 @@ - (id)initWithAuthorizationResponse:(NSDictionary *)data;
return self;
}
-- (void)dealloc;
-{
- [expiresAt release];
- [authResponseData release];
- [super dealloc];
-}
- (NSString *)description;
{
@@ -56,7 +50,6 @@ - (void)refreshFromAuthorizationResponse:(NSDictionary *)data;
[tokenData setObject:[data objectForKey:@"expires_in"] forKey:@"expires_in"];
[self setAuthResponseData:tokenData];
- [tokenData release];
[self extractExpiresAtFromResponse];
}
@@ -92,7 +85,7 @@ - (id)initWithCoder:(NSCoder *)aDecoder
{
if (self = [super init]) {
authResponseData = [[aDecoder decodeObjectForKey:@"data"] copy];
- expiresAt = [[aDecoder decodeObjectForKey:@"expiresAt"] retain];
+ expiresAt = [aDecoder decodeObjectForKey:@"expiresAt"];
}
return self;
}
View
@@ -20,7 +20,7 @@
NSURL *tokenURL;
LROAuth2AccessToken *accessToken;
NSMutableArray *requests;
- id<LROAuth2ClientDelegate> delegate;
+ id<LROAuth2ClientDelegate> __unsafe_unretained delegate;
BOOL debug;
@private
@@ -33,7 +33,7 @@
@property (nonatomic, copy) NSURL *userURL;
@property (nonatomic, copy) NSURL *tokenURL;
@property (nonatomic, readonly) LROAuth2AccessToken *accessToken;
-@property (nonatomic, assign) id<LROAuth2ClientDelegate> delegate;
+@property (nonatomic, unsafe_unretained) id<LROAuth2ClientDelegate> delegate;
@property (nonatomic, assign) BOOL debug;
- (id)initWithClientID:(NSString *)_clientID
View
@@ -6,7 +6,6 @@
// Copyright 2010 LJR Software Limited. All rights reserved.
//
-#import <YAJLIOS/NSObject+YAJL.h>
#import "LROAuth2Client.h"
#import "NSURL+QueryInspector.h"
#import "LROAuth2AccessToken.h"
@@ -47,14 +46,6 @@ - (id)initWithClientID:(NSString *)_clientID
- (void)dealloc;
{
[_networkQueue cancelAllOperations];
- [accessToken release];
- [clientID release];
- [clientSecret release];
- [userURL release];
- [tokenURL release];
- [redirectURL release];
- [cancelURL release];
- [super dealloc];
}
#pragma mark -
@@ -76,7 +67,7 @@ - (NSURLRequest *)userAuthorizationRequestWithParameters:(NSDictionary *)additio
NSMutableURLRequest *authRequest = [NSMutableURLRequest requestWithURL:fullURL];
[authRequest setHTTPMethod:@"GET"];
- return [[authRequest copy] autorelease];
+ return [authRequest copy];
}
- (void)verifyAuthorizationWithAccessCode:(NSString *)accessCode;
@@ -98,10 +89,12 @@ - (void)verifyAuthorizationWithAccessCode:(NSString *)accessCode;
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:[[params stringWithFormEncodedComponents] dataUsingEncoding:NSUTF8StringEncoding]];
- __block LRURLRequestOperation *operation = [[LRURLRequestOperation alloc] initWithURLRequest:request];
+ LRURLRequestOperation *operation = [[LRURLRequestOperation alloc] initWithURLRequest:request];
+
+ __unsafe_unretained id blockOperation = operation;
[operation setCompletionBlock:^{
- [self handleCompletionForAuthorizationRequestOperation:operation];
+ [self handleCompletionForAuthorizationRequestOperation:blockOperation];
}];
[_networkQueue addOperation:operation];
@@ -110,7 +103,7 @@ - (void)verifyAuthorizationWithAccessCode:(NSString *)accessCode;
- (void)refreshAccessToken:(LROAuth2AccessToken *)_accessToken;
{
- accessToken = [_accessToken retain];
+ accessToken = _accessToken;
NSDictionary *params = [NSMutableDictionary dictionary];
[params setValue:@"refresh" forKey:@"type"];
@@ -124,10 +117,12 @@ - (void)refreshAccessToken:(LROAuth2AccessToken *)_accessToken;
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:[[params stringWithFormEncodedComponents] dataUsingEncoding:NSUTF8StringEncoding]];
- __block LRURLRequestOperation *operation = [[LRURLRequestOperation alloc] initWithURLRequest:request];
+ LRURLRequestOperation *operation = [[LRURLRequestOperation alloc] initWithURLRequest:request];
+
+ __unsafe_unretained id blockOperation = operation;
[operation setCompletionBlock:^{
- [self handleCompletionForAuthorizationRequestOperation:operation];
+ [self handleCompletionForAuthorizationRequestOperation:blockOperation];
}];
[_networkQueue addOperation:operation];
@@ -14,15 +14,13 @@
A3289DB1122D708700D89A88 /* NSURL+QueryInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = A3F8C130119DF00D0035081C /* NSURL+QueryInspector.m */; };
A3289DB2122D708700D89A88 /* LROAuth2Client.m in Sources */ = {isa = PBXBuildFile; fileRef = A3F8BFBB119DEE450035081C /* LROAuth2Client.m */; };
A3289DB3122D708700D89A88 /* LROAuth2AccessToken.m in Sources */ = {isa = PBXBuildFile; fileRef = A3F8BFBE119DEE450035081C /* LROAuth2AccessToken.m */; };
- A3289EA2122D755D00D89A88 /* YAJLIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3289EA1122D755D00D89A88 /* YAJLIOS.framework */; };
A3289EB6122D758F00D89A88 /* NSDictionary+QueryString.m in Sources */ = {isa = PBXBuildFile; fileRef = A3F8C24B119DF7420035081C /* NSDictionary+QueryString.m */; };
A3289EB7122D758F00D89A88 /* NSString+QueryString.m in Sources */ = {isa = PBXBuildFile; fileRef = A3F8C24C119DF7420035081C /* NSString+QueryString.m */; };
A3289EB8122D758F00D89A88 /* NSURL+QueryInspector.m in Sources */ = {isa = PBXBuildFile; fileRef = A3F8C130119DF00D0035081C /* NSURL+QueryInspector.m */; };
A3289EB9122D758F00D89A88 /* LROAuth2Client.m in Sources */ = {isa = PBXBuildFile; fileRef = A3F8BFBB119DEE450035081C /* LROAuth2Client.m */; };
A3289EBA122D758F00D89A88 /* LROAuth2AccessToken.m in Sources */ = {isa = PBXBuildFile; fileRef = A3F8BFBE119DEE450035081C /* LROAuth2AccessToken.m */; };
A3289EBC122D758F00D89A88 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3F8C124119DEFD50035081C /* SystemConfiguration.framework */; };
A3289EBD122D758F00D89A88 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3F8C126119DEFDE0035081C /* UIKit.framework */; };
- A3289EBF122D758F00D89A88 /* YAJLIOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A3289EA1122D755D00D89A88 /* YAJLIOS.framework */; };
A3289FD6122D819500D89A88 /* LROAuth2Client.h in Headers */ = {isa = PBXBuildFile; fileRef = A3F8BFBA119DEE450035081C /* LROAuth2Client.h */; settings = {ATTRIBUTES = (Public, ); }; };
A3289FD7122D819500D89A88 /* LROAuth2ClientDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = A3F8BFBC119DEE450035081C /* LROAuth2ClientDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
A3289FD8122D819500D89A88 /* LROAuth2AccessToken.h in Headers */ = {isa = PBXBuildFile; fileRef = A3F8BFBD119DEE450035081C /* LROAuth2AccessToken.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -37,7 +35,6 @@
/* Begin PBXFileReference section */
A3289D4B122D705500D89A88 /* libLROAuth2Client-Device.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libLROAuth2Client-Device.a"; sourceTree = BUILT_PRODUCTS_DIR; };
- A3289EA1122D755D00D89A88 /* YAJLIOS.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = YAJLIOS.framework; path = Vendor/YAJLIOS.framework; sourceTree = "<group>"; };
A3289EC3122D758F00D89A88 /* libLROAuth2Client-Simulator.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libLROAuth2Client-Simulator.a"; sourceTree = BUILT_PRODUCTS_DIR; };
A3ABE4D41528797B006E9AC0 /* LRURLRequestOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LRURLRequestOperation.h; sourceTree = "<group>"; };
A3ABE4D51528797B006E9AC0 /* LRURLRequestOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LRURLRequestOperation.m; sourceTree = "<group>"; };
@@ -68,7 +65,6 @@
files = (
A3289DAD122D707B00D89A88 /* SystemConfiguration.framework in Frameworks */,
A3289DAE122D707B00D89A88 /* UIKit.framework in Frameworks */,
- A3289EA2122D755D00D89A88 /* YAJLIOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -78,7 +74,6 @@
files = (
A3289EBC122D758F00D89A88 /* SystemConfiguration.framework in Frameworks */,
A3289EBD122D758F00D89A88 /* UIKit.framework in Frameworks */,
- A3289EBF122D758F00D89A88 /* YAJLIOS.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -111,7 +106,6 @@
children = (
B25E609B11CFB581001DA5CD /* MobileCoreServices.framework */,
B25E609711CFB581001DA5CD /* CFNetwork.framework */,
- A3289EA1122D755D00D89A88 /* YAJLIOS.framework */,
AACBBE490F95108600F1A2B1 /* Foundation.framework */,
A3F8C124119DEFD50035081C /* SystemConfiguration.framework */,
A3F8C126119DEFDE0035081C /* UIKit.framework */,
@@ -364,6 +358,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -374,6 +369,7 @@
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREFIX_HEADER = LROAuth2Client_Prefix.pch;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
OTHER_LDFLAGS = (
"-ObjC",
"-all_load",
@@ -388,6 +384,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = (
@@ -398,6 +395,7 @@
);
GCC_ENABLE_FIX_AND_CONTINUE = NO;
GCC_PREFIX_HEADER = LROAuth2Client_Prefix.pch;
+ GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
OTHER_LDFLAGS = (
"-ObjC",
"-all_load",
View
@@ -14,15 +14,15 @@ - (NSString*)stringByEscapingForURLQuery
{
NSString *result = self;
- CFStringRef originalAsCFString = (CFStringRef) self;
+ CFStringRef originalAsCFString = (__bridge CFStringRef) self;
CFStringRef leaveAlone = CFSTR(" ");
CFStringRef toEscape = CFSTR("\n\r?[]()$,!'*;:@&=#%+/");
CFStringRef escapedStr;
escapedStr = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, originalAsCFString, leaveAlone, toEscape, kCFStringEncodingUTF8);
if (escapedStr) {
- NSMutableString *mutable = [NSMutableString stringWithString:(NSString *)escapedStr];
+ NSMutableString *mutable = [NSMutableString stringWithString:(__bridge NSString *)escapedStr];
CFRelease(escapedStr);
[mutable replaceOccurrencesOfString:@" " withString:@"+" options:0 range:NSMakeRange(0, [mutable length])];

0 comments on commit ea80e95

Please sign in to comment.