Permalink
Browse files

Memory related bug fix

  • Loading branch information...
1 parent 88068fb commit ff2e7e35719f527c950fabb870267319264708d0 @MugunthKumar committed May 12, 2012
Showing with 9 additions and 6 deletions.
  1. +9 −6 Twitter/RSTwitterEngine.m
View
@@ -49,7 +49,8 @@ - (void)cancelAuthentication;
@property (strong, nonatomic) RSWebViewController *webController;
@property (strong, nonatomic) ACAccount *iOS5TwitterAccount;
-
+@property (strong, nonatomic) ACAccountStore *accountStore;
+@property (strong, nonatomic) ACAccountType *accountType;
@end
@implementation RSTwitterEngine
@@ -58,6 +59,8 @@ @implementation RSTwitterEngine
@synthesize statusChangeHandler = _statusChangeHandler;
@synthesize presentingViewController = _presentingViewController;
@synthesize iOS5TwitterAccount = _iOS5TwitterChosenAccount;
+@synthesize accountStore = _accountStore;
+@synthesize accountType = _accountType;
#pragma mark - Read-only Properties
@@ -184,18 +187,18 @@ -(void) tryiOS5TwitterAccountAuthOnCompletion:(void (^)(void)) completionBlock {
if(![ACAccountStore class]) completionBlock();
- ACAccountStore *account = [[ACAccountStore alloc] init];
- ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
+ self.accountStore = [[ACAccountStore alloc] init];
+ self.accountType = [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
self.statusChangeHandler(@"Authenticating...");
- [account requestAccessToAccountsWithType:accountType withCompletionHandler:^(BOOL granted, NSError *error)
+ [self.accountStore requestAccessToAccountsWithType:self.accountType withCompletionHandler:^(BOOL granted, NSError *error)
{
if (!granted) {
completionBlock();
return;
}
- NSArray *arrayOfAccounts = [account accountsWithAccountType:accountType];
+ NSArray *arrayOfAccounts = [self.accountStore accountsWithAccountType:self.accountType];
if([arrayOfAccounts count] <= 0) {
completionBlock();
return;
@@ -222,7 +225,7 @@ -(void) tryiOS5TwitterAccountAuthOnCompletion:(void (^)(void)) completionBlock {
showInView:self.presentingViewController.view
onDismiss:^(int buttonIndex) {
- self.iOS5TwitterAccount = [[account accountsWithAccountType:accountType] objectAtIndex:buttonIndex];
+ self.iOS5TwitterAccount = [[self.accountStore accountsWithAccountType:accountType] objectAtIndex:buttonIndex];
_screenName = self.iOS5TwitterAccount.username;
completionBlock();

0 comments on commit ff2e7e3

Please sign in to comment.