Skip to content

Commit

Permalink
manage autorelease for ARC
Browse files Browse the repository at this point in the history
  • Loading branch information
ypelud committed Jul 18, 2012
1 parent f2a3c33 commit a27d099
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Appirater.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ - (BOOL)connectedToNetwork {

NSURL *testURL = [NSURL URLWithString:@"http://www.apple.com/"];
NSURLRequest *testRequest = [NSURLRequest requestWithURL:testURL cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:20.0];
NSURLConnection *testConnection = [[[NSURLConnection alloc] initWithRequest:testRequest delegate:self] autorelease];

NSURLConnection *testConnection = [[NSURLConnection alloc] initWithRequest:testRequest delegate:self];
#if !__has_feature(objc_arc)
[testConnection autorelease];
#endif
return ((isReachable && !needsConnection) || nonWiFi) ? (testConnection ? YES : NO) : NO;
}

Expand All @@ -115,11 +117,14 @@ + (Appirater*)sharedInstance {
}

- (void)showRatingAlert {
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:APPIRATER_MESSAGE_TITLE
message:APPIRATER_MESSAGE
delegate:self
cancelButtonTitle:APPIRATER_CANCEL_BUTTON
otherButtonTitles:APPIRATER_RATE_BUTTON, APPIRATER_RATE_LATER, nil] autorelease];
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:APPIRATER_MESSAGE_TITLE
message:APPIRATER_MESSAGE
delegate:self
cancelButtonTitle:APPIRATER_CANCEL_BUTTON
otherButtonTitles:APPIRATER_RATE_BUTTON, APPIRATER_RATE_LATER, nil];
#if !__has_feature(objc_arc)
[alertView autorelease];
#endif
self.ratingAlert = alertView;
[alertView show];
}
Expand Down

0 comments on commit a27d099

Please sign in to comment.