You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by be...@apache.org on 2012/08/02 14:20:01 UTC
[3/3] Changes for ARC
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVPlugin.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPlugin.m b/CordovaLib/Classes/CDVPlugin.m
index 34747da..c14f72c 100644
--- a/CordovaLib/Classes/CDVPlugin.m
+++ b/CordovaLib/Classes/CDVPlugin.m
@@ -96,8 +96,6 @@
- (void) dealloc
{
- self.settings = nil;
- self.webView = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillTerminateNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidReceiveMemoryWarningNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:CDVPluginHandleOpenURLNotification object:nil];
@@ -107,7 +105,6 @@
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
*/
- [super dealloc];
}
- (id) appDelegate
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVPluginResult.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPluginResult.h b/CordovaLib/Classes/CDVPluginResult.h
index 71df676..e6ed354 100644
--- a/CordovaLib/Classes/CDVPluginResult.h
+++ b/CordovaLib/Classes/CDVPluginResult.h
@@ -36,12 +36,11 @@ typedef enum {
}
-@property (nonatomic, retain, readonly) NSNumber* status;
-@property (nonatomic, retain, readonly) id message;
-@property (nonatomic, retain) NSNumber* keepCallback;
+@property (nonatomic, strong, readonly) NSNumber* status;
+@property (nonatomic, strong, readonly) id message;
+@property (nonatomic, strong) NSNumber* keepCallback;
-(CDVPluginResult*) init;
-+(void) releaseStatus;
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal;
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsString: (NSString*) theMessage;
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsArray: (NSArray*) theMessage;
@@ -59,5 +58,4 @@ typedef enum {
-(NSString*) toSuccessCallbackString: (NSString*) callbackId;
-(NSString*) toErrorCallbackString: (NSString*) callbackId;
--(void) dealloc;
@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVPluginResult.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVPluginResult.m b/CordovaLib/Classes/CDVPluginResult.m
index 0a5866d..cb786b7 100644
--- a/CordovaLib/Classes/CDVPluginResult.m
+++ b/CordovaLib/Classes/CDVPluginResult.m
@@ -47,14 +47,6 @@ static NSArray* org_apache_cordova_CommandStatusMsgs;
@"Error",
nil];
}
-
-+(void) releaseStatus
-{
- if (org_apache_cordova_CommandStatusMsgs != nil){
- [org_apache_cordova_CommandStatusMsgs release];
- org_apache_cordova_CommandStatusMsgs = nil;
- }
-}
-(CDVPluginResult*) init
{
@@ -73,38 +65,38 @@ static NSArray* org_apache_cordova_CommandStatusMsgs;
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal
{
- return [[[self alloc] initWithStatus: statusOrdinal message: [org_apache_cordova_CommandStatusMsgs objectAtIndex: statusOrdinal]] autorelease];
+ return [[self alloc] initWithStatus: statusOrdinal message: [org_apache_cordova_CommandStatusMsgs objectAtIndex: statusOrdinal]];
}
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsString: (NSString*) theMessage
{
- return [[[self alloc] initWithStatus: statusOrdinal message: theMessage] autorelease];
+ return [[self alloc] initWithStatus: statusOrdinal message: theMessage];
}
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsArray: (NSArray*) theMessage
{
- return [[[self alloc] initWithStatus: statusOrdinal message: theMessage] autorelease];
+ return [[self alloc] initWithStatus: statusOrdinal message: theMessage];
}
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsInt: (int) theMessage
{
- return [[[self alloc] initWithStatus: statusOrdinal message: [NSNumber numberWithInt: theMessage]] autorelease];
+ return [[self alloc] initWithStatus: statusOrdinal message: [NSNumber numberWithInt: theMessage]];
}
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsDouble: (double) theMessage
{
- return [[[self alloc] initWithStatus: statusOrdinal message: [NSNumber numberWithDouble: theMessage]] autorelease];
+ return [[self alloc] initWithStatus: statusOrdinal message: [NSNumber numberWithDouble: theMessage]];
}
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsDictionary: (NSDictionary*) theMessage
{
- return [[[self alloc] initWithStatus: statusOrdinal message: theMessage] autorelease];
+ return [[self alloc] initWithStatus: statusOrdinal message: theMessage];
}
+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageToErrorObject: (int) errorCode
{
NSDictionary* errDict = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:errorCode] forKey:@"code"];
- return [[[self alloc] initWithStatus: statusOrdinal message: errDict] autorelease];
+ return [[self alloc] initWithStatus: statusOrdinal message: errDict];
}
-(void) setKeepCallbackAsBool:(BOOL)bKeepCallback
@@ -139,13 +131,5 @@ static NSArray* org_apache_cordova_CommandStatusMsgs;
DLog(@"PluginResult toErrorCallbackString: %@", errorCB);
return errorCB;
}
-
--(void) dealloc
-{
- status = nil;
- message = nil;
- keepCallback = nil;
-
- [super dealloc];
-}
+
@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVReachability.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVReachability.m b/CordovaLib/Classes/CDVReachability.m
index 227264a..ccd6e23 100644
--- a/CordovaLib/Classes/CDVReachability.m
+++ b/CordovaLib/Classes/CDVReachability.m
@@ -93,26 +93,24 @@ static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRe
return;
}
- if (![(NSObject*) info isKindOfClass: [CDVReachability class]]) {
+ if (![(__bridge NSObject*) info isKindOfClass: [CDVReachability class]]) {
NSLog(@"info was wrong class in ReachabilityCallback");
return;
}
//We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
// in case someon uses the Reachablity object in a different thread.
- NSAutoreleasePool* myPool = [[NSAutoreleasePool alloc] init];
-
- CDVReachability* noteObject = (CDVReachability*) info;
- // Post a notification to notify the client that the network reachability changed.
- [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
-
- [myPool release];
+ @autoreleasepool {
+ CDVReachability* noteObject = (__bridge CDVReachability*) info;
+ // Post a notification to notify the client that the network reachability changed.
+ [[NSNotificationCenter defaultCenter] postNotificationName: kReachabilityChangedNotification object: noteObject];
+ }
}
- (BOOL) startNotifier
{
BOOL retVal = NO;
- SCNetworkReachabilityContext context = {0, self, NULL, NULL, NULL};
+ SCNetworkReachabilityContext context = {0, (__bridge void *)(self), NULL, NULL, NULL};
if(SCNetworkReachabilitySetCallback(reachabilityRef, CDVReachabilityCallback, &context))
{
if(SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode))
@@ -138,7 +136,6 @@ static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRe
{
CFRelease(reachabilityRef);
}
- [super dealloc];
}
+ (CDVReachability*) reachabilityWithHostName: (NSString*) hostName;
@@ -147,7 +144,7 @@ static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRe
SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
if(reachability!= NULL)
{
- retVal= [[[self alloc] init] autorelease];
+ retVal= [[self alloc] init];
if(retVal!= NULL)
{
retVal->reachabilityRef = reachability;
@@ -163,7 +160,7 @@ static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRe
CDVReachability* retVal = NULL;
if(reachability!= NULL)
{
- retVal= [[[self alloc] init] autorelease];
+ retVal= [[self alloc] init];
if(retVal!= NULL)
{
retVal->reachabilityRef = reachability;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVSound.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVSound.h b/CordovaLib/Classes/CDVSound.h
index 9fc4fbf..868cdd2 100755
--- a/CordovaLib/Classes/CDVSound.h
+++ b/CordovaLib/Classes/CDVSound.h
@@ -75,12 +75,12 @@ typedef NSUInteger CDVMediaMsg;
NSNumber* volume;
}
-@property (nonatomic, retain) NSString* resourcePath;
-@property (nonatomic, retain) NSURL* resourceURL;
-@property (nonatomic, retain) CDVAudioPlayer* player;
-@property (nonatomic, retain) NSNumber* volume;
+@property (nonatomic, strong) NSString* resourcePath;
+@property (nonatomic, strong) NSURL* resourceURL;
+@property (nonatomic, strong) CDVAudioPlayer* player;
+@property (nonatomic, strong) NSNumber* volume;
-@property (nonatomic, retain) CDVAudioRecorder* recorder;
+@property (nonatomic, strong) CDVAudioRecorder* recorder;
@end
@@ -89,8 +89,8 @@ typedef NSUInteger CDVMediaMsg;
NSMutableDictionary* soundCache;
AVAudioSession* avSession;
}
-@property (nonatomic, retain) NSMutableDictionary* soundCache;
-@property (nonatomic, retain) AVAudioSession* avSession;
+@property (nonatomic, strong) NSMutableDictionary* soundCache;
+@property (nonatomic, strong) AVAudioSession* avSession;
//DEPRECATED
- (void) play:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options __attribute__((deprecated));
- (void) pause:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options __attribute__((deprecated));
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVSound.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVSound.m b/CordovaLib/Classes/CDVSound.m
index 7631069..e931757 100644
--- a/CordovaLib/Classes/CDVSound.m
+++ b/CordovaLib/Classes/CDVSound.m
@@ -69,7 +69,6 @@
// it's a valid file url, use it
resourceURL = [NSURL fileURLWithPath:filePath];
}
- [fMgr release];
}
return resourceURL;
}
@@ -110,7 +109,7 @@
jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%@);", @"cordova.require('cordova/plugin/Media').onStatus", mediaId, MEDIA_ERROR,[self createMediaErrorWithCode: errcode message: errMsg]];
[super writeJavascript:jsString];
} else {
- audioFile = [[[CDVAudioFile alloc] init] autorelease];
+ audioFile = [[CDVAudioFile alloc] init];
audioFile.resourcePath = resourcePath;
audioFile.resourceURL = resourceURL;
[[self soundCache] setObject:audioFile forKey: mediaId];
@@ -209,7 +208,7 @@
// audioFile.player != nil or player was sucessfully created
// get the audioSession and set the category to allow Playing when device is locked or ring/silent switch engaged
if ([self hasAudioSession]) {
- NSError* err = nil;
+ NSError* __autoreleasing err = nil;
NSNumber* playAudioWhenScreenIsLocked = [options objectForKey:@"playAudioWhenScreenIsLocked"];
BOOL bPlayAudioWhenScreenIsLocked = YES;
if (playAudioWhenScreenIsLocked != nil) {
@@ -272,15 +271,15 @@
- (BOOL) prepareToPlay: (CDVAudioFile*) audioFile withId: (NSString*) mediaId
{
BOOL bError = NO;
- NSError* playerError = nil;
+ NSError* __autoreleasing playerError = nil;
// create the player
NSURL* resourceURL = audioFile.resourceURL;
if ([resourceURL isFileURL]) {
- audioFile.player = [[[ CDVAudioPlayer alloc ] initWithContentsOfURL:resourceURL error:&playerError] autorelease];
+ audioFile.player = [[ CDVAudioPlayer alloc ] initWithContentsOfURL:resourceURL error:&playerError];
} else {
NSURLRequest *request = [NSURLRequest requestWithURL:resourceURL];
- NSURLResponse *response = nil;
+ NSURLResponse * __autoreleasing response = nil;
NSData* data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&playerError];
if (playerError) {
NSLog(@"Unable to download audio from: %@", [resourceURL absoluteString]);
@@ -295,7 +294,7 @@
[data writeToFile:filePath atomically:YES];
NSURL* fileURL = [NSURL fileURLWithPath:filePath];
- audioFile.player = [[[ CDVAudioPlayer alloc ] initWithContentsOfURL:fileURL error:&playerError] autorelease];
+ audioFile.player = [[ CDVAudioPlayer alloc ] initWithContentsOfURL:fileURL error:&playerError];
}
}
@@ -515,7 +514,7 @@
if (audioFile != nil) {
- NSError* error = nil;
+ NSError* __autoreleasing error = nil;
if (audioFile.recorder != nil) {
[audioFile.recorder stop];
@@ -535,7 +534,7 @@
}
// create a new recorder for each start record
- audioFile.recorder = [[[CDVAudioRecorder alloc] initWithURL:audioFile.resourceURL settings:nil error:&error] autorelease];
+ audioFile.recorder = [[CDVAudioRecorder alloc] initWithURL:audioFile.resourceURL settings:nil error:&error];
if (error != nil) {
errorMsg = [NSString stringWithFormat: @"Failed to initialize AVAudioRecorder: %@\n", [error localizedFailureReason]];
@@ -650,10 +649,7 @@
- (void) dealloc
{
[[self soundCache] removeAllObjects];
- [self setSoundCache: nil];
- [self setAvSession: nil];
- [super dealloc];
}
@end
@@ -664,37 +660,15 @@
@synthesize player, volume;
@synthesize recorder;
-- (void) dealloc
-{
- self.resourcePath = nil;
- self.resourceURL = nil;
- self.player = nil;
- self.recorder = nil;
- self.volume = nil;
-
- [super dealloc];
-}
@end
@implementation CDVAudioPlayer
@synthesize mediaId;
-- (void) dealloc
-{
- self.mediaId = nil;
-
- [super dealloc];
-}
@end
@implementation CDVAudioRecorder
@synthesize mediaId;
-- (void) dealloc
-{
- self.mediaId = nil;
-
- [super dealloc];
-}
@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVURLProtocol.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVURLProtocol.m b/CordovaLib/Classes/CDVURLProtocol.m
index 62d1f7f..94b242a 100644
--- a/CordovaLib/Classes/CDVURLProtocol.m
+++ b/CordovaLib/Classes/CDVURLProtocol.m
@@ -49,7 +49,7 @@ static CDVWhitelist* gWhitelist = nil;
if ([delegate respondsToSelector:@selector(viewController)]) {
id vc = [delegate performSelector:@selector(viewController)];
if ([vc isKindOfClass:[CDVViewController class]]) {
- gWhitelist = [((CDVViewController*)vc).whitelist retain];
+ gWhitelist = ((CDVViewController*)vc).whitelist;
}
}
}
@@ -83,8 +83,7 @@ static CDVWhitelist* gWhitelist = nil;
[[self client] URLProtocol:self didLoadData:[body dataUsingEncoding:NSASCIIStringEncoding]];
[[self client] URLProtocolDidFinishLoading:self];
-
- [response release];
+
}
- (void) stopLoading
@@ -103,10 +102,10 @@ static CDVWhitelist* gWhitelist = nil;
@implementation CDVHTTPURLResponse
-- (id) initWithUnauthorizedURL:(NSURL*)url
+- (id) initWithUnauthorizedURL:(__unsafe_unretained NSURL*)url
{
NSInteger statusCode = 401;
- NSDictionary* headerFields = [NSDictionary dictionaryWithObject:@"Digest realm = \"Cordova.plist/ExternalHosts\"" forKey:@"WWW-Authenticate"];
+ NSDictionary* __unsafe_unretained headerFields = [NSDictionary dictionaryWithObject:@"Digest realm = \"Cordova.plist/ExternalHosts\"" forKey:@"WWW-Authenticate"];
double requestTime = 1;
SEL selector = NSSelectorFromString(@"initWithURL:statusCode:headerFields:requestTime:");
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index a333a56..abf7e89 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -29,20 +29,20 @@
}
-@property (nonatomic, retain) IBOutlet CDVCordovaView* webView;
+@property (nonatomic, strong) IBOutlet CDVCordovaView* webView;
-@property (nonatomic, readonly, retain) NSMutableDictionary* pluginObjects;
-@property (nonatomic, readonly, retain) NSDictionary* pluginsMap;
-@property (nonatomic, readonly, retain) NSDictionary* settings;
-@property (nonatomic, readonly, retain) CDVWhitelist* whitelist; // readonly for public
-@property (nonatomic, readonly, retain) NSArray* supportedOrientations;
+@property (nonatomic, readonly, strong) NSMutableDictionary* pluginObjects;
+@property (nonatomic, readonly, strong) NSDictionary* pluginsMap;
+@property (nonatomic, readonly, strong) NSDictionary* settings;
+@property (nonatomic, readonly, strong) CDVWhitelist* whitelist; // readonly for public
+@property (nonatomic, readonly, strong) NSArray* supportedOrientations;
@property (nonatomic, readonly, assign) BOOL loadFromString;
@property (nonatomic, readwrite, copy) NSString* invokeString __attribute__ ((deprecated));
@property (nonatomic, readwrite, assign) BOOL useSplashScreen;
-@property (nonatomic, readonly, retain) IBOutlet UIActivityIndicatorView* activityView;
-@property (nonatomic, readonly, retain) UIImageView *imageView;
-@property (nonatomic, readwrite, retain) id<CDVCommandDelegate> commandDelegate;
+@property (nonatomic, readonly, strong) IBOutlet UIActivityIndicatorView* activityView;
+@property (nonatomic, readonly, strong) UIImageView *imageView;
+@property (nonatomic, readwrite, strong) id<CDVCommandDelegate> commandDelegate;
@property (nonatomic, readwrite, copy) NSString* wwwFolderName;
@property (nonatomic, readwrite, copy) NSString* startPage;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 7b9feaa..dc98cd7 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -18,20 +18,21 @@
*/
#import "CDV.h"
+#import <objc/message.h>
#define degreesToRadian(x) (M_PI * (x) / 180.0)
@interface CDVViewController ()
-@property (nonatomic, readwrite, retain) NSDictionary* settings;
-@property (nonatomic, readwrite, retain) CDVWhitelist* whitelist;
-@property (nonatomic, readwrite, retain) NSMutableDictionary* pluginObjects;
-@property (nonatomic, readwrite, retain) NSDictionary* pluginsMap;
-@property (nonatomic, readwrite, retain) NSArray* supportedOrientations;
+@property (nonatomic, readwrite, strong) NSDictionary* settings;
+@property (nonatomic, readwrite, strong) CDVWhitelist* whitelist;
+@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginObjects;
+@property (nonatomic, readwrite, strong) NSDictionary* pluginsMap;
+@property (nonatomic, readwrite, strong) NSArray* supportedOrientations;
@property (nonatomic, readwrite, assign) BOOL loadFromString;
-@property (nonatomic, readwrite, retain) IBOutlet UIActivityIndicatorView* activityView;
-@property (nonatomic, readwrite, retain) UIImageView* imageView;
+@property (nonatomic, readwrite, strong) IBOutlet UIActivityIndicatorView* activityView;
+@property (nonatomic, readwrite, strong) UIImageView* imageView;
@property (readwrite, assign) BOOL initialized;
@end
@@ -139,7 +140,7 @@
{
[super viewDidLoad];
- self.pluginObjects = [[[NSMutableDictionary alloc] initWithCapacity:4] autorelease];
+ self.pluginObjects = [[NSMutableDictionary alloc] initWithCapacity:4];
// read from UISupportedInterfaceOrientations (or UISupportedInterfaceOrientations~iPad, if its iPad) from -Info.plist
self.supportedOrientations = [self parseInterfaceOrientations:
@@ -152,7 +153,7 @@
NSLog(@"WARNING: %@.plist is missing.", appPlistName);
return;
}
- self.settings = [[[NSDictionary alloc] initWithDictionary:cordovaPlist] autorelease];
+ self.settings = [[NSDictionary alloc] initWithDictionary:cordovaPlist];
// read from Plugins dict in Cordova.plist in the app bundle
NSString* pluginsKey = @"Plugins";
@@ -163,7 +164,7 @@
}
// set the whitelist
- self.whitelist = [[[CDVWhitelist alloc] initWithArray:[self.settings objectForKey:@"ExternalHosts"]] autorelease];
+ self.whitelist = [[CDVWhitelist alloc] initWithArray:[self.settings objectForKey:@"ExternalHosts"]];
self.pluginsMap = [pluginsDict dictionaryWithLowercaseKeys];
@@ -220,8 +221,9 @@
/*
* Fire up CDVLocalStorage to work-around iOS 5.1 WebKit storage limitations
*/
+
if (backupWebStorage) {
- [self.commandDelegate registerPlugin:[[[CDVLocalStorage alloc] initWithWebView:self.webView] autorelease] withClassName:NSStringFromClass([CDVLocalStorage class])];
+ [self.commandDelegate registerPlugin:[[CDVLocalStorage alloc] initWithWebView:self.webView] withClassName:NSStringFromClass([CDVLocalStorage class])];
}
/*
@@ -263,7 +265,7 @@
- (NSArray*) parseInterfaceOrientations:(NSArray*)orientations
{
- NSMutableArray* result = [[[NSMutableArray alloc] init] autorelease];
+ NSMutableArray* result = [[NSMutableArray alloc] init];
if (orientations != nil)
{
@@ -389,7 +391,7 @@
if (!self.webView)
{
- self.webView = [[self newCordovaViewWithFrame:webViewBounds] autorelease];
+ self.webView = [self newCordovaViewWithFrame:webViewBounds];
self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
[self.view addSubview:self.webView];
@@ -694,7 +696,7 @@
NSLog(@"WARNING: Splash-screen image '%@' was not found. Orientation: %d, iPad: %d", orientedLaunchImageFile, deviceOrientation, isIPad);
}
- self.imageView = [[[UIImageView alloc] initWithImage:launchImage] autorelease];
+ self.imageView = [[UIImageView alloc] initWithImage:launchImage];
self.imageView.tag = 1;
self.imageView.center = center;
@@ -722,7 +724,7 @@
topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
}
- self.activityView = [[[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:topActivityIndicatorStyle] autorelease];
+ self.activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:topActivityIndicatorStyle];
self.activityView.tag = 2;
id showSplashScreenSpinnerValue = [self.settings objectForKey:@"ShowSplashScreenSpinner"];
@@ -822,6 +824,7 @@ BOOL gSplashScreenShown = NO;
}
BOOL retVal = YES;
+
// Find the proper selector to call.
NSString* methodName = [NSString stringWithFormat:@"%@:", command.methodName];
NSString* methodNameWithDict = [NSString stringWithFormat:@"%@:withDict:", command.methodName];
@@ -832,9 +835,12 @@ BOOL gSplashScreenShown = NO;
NSMutableArray* arguments = nil;
NSMutableDictionary* dict = nil;
[command legacyArguments:&arguments andDict:&dict];
- [obj performSelector:legacySelector withObject:arguments withObject:dict];
+ //[obj performSelector:legacySelector withObject:arguments withObject:dict];
+ objc_msgSend(obj,legacySelector,arguments,dict);
} else if ([obj respondsToSelector:normalSelector]) {
- [obj performSelector:normalSelector withObject:command];
+ //[obj performSelector:normalSelector withObject:command];
+ objc_msgSend(obj,normalSelector,command);
+
} else {
// There's no method to call, so throw an error.
NSLog(@"ERROR: Method '%@' not defined in Plugin '%@'", methodName, command.className);
@@ -879,9 +885,9 @@ BOOL gSplashScreenShown = NO;
NSDictionary* classSettings = [self.settings objectForKey:className];
if (classSettings) {
- obj = [[[NSClassFromString(className) alloc] initWithWebView:webView settings:classSettings] autorelease];
+ obj = [[NSClassFromString(className) alloc] initWithWebView:webView settings:classSettings];
} else {
- obj = [[[NSClassFromString(className) alloc] initWithWebView:webView] autorelease];
+ obj = [[NSClassFromString(className) alloc] initWithWebView:webView];
}
if (obj != nil && [obj isKindOfClass:[CDVPlugin class]]) {
@@ -919,7 +925,7 @@ BOOL gSplashScreenShown = NO;
*/
+ (NSDictionary*) getBundlePlist:(NSString*)plistName
{
- NSString *errorDesc = nil;
+ NSString * errorDesc = nil;
NSPropertyListFormat format;
NSString *plistPath = [[NSBundle mainBundle] pathForResource:plistName ofType:@"plist"];
NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath];
@@ -941,7 +947,7 @@ BOOL gSplashScreenShown = NO;
// empty the tmp directory
NSFileManager* fileMgr = [[NSFileManager alloc] init];
- NSError* err = nil;
+ NSError* __autoreleasing err = nil;
// clear contents of NSTemporaryDirectory
NSString* tempDirectoryPath = NSTemporaryDirectory();
@@ -956,7 +962,6 @@ BOOL gSplashScreenShown = NO;
NSLog(@"Failed to delete: %@ (error: %@)", filePath, err);
}
}
- [fileMgr release];
}
/*
@@ -1008,7 +1013,6 @@ BOOL gSplashScreenShown = NO;
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
- [super dealloc];
}
@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVWhitelist.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWhitelist.h b/CordovaLib/Classes/CDVWhitelist.h
index 37f7969..0505cbf 100644
--- a/CordovaLib/Classes/CDVWhitelist.h
+++ b/CordovaLib/Classes/CDVWhitelist.h
@@ -21,8 +21,8 @@
@interface CDVWhitelist : NSObject
-@property (nonatomic, readonly, retain) NSArray* whitelist;
-@property (nonatomic, readonly, retain) NSArray* expandedWhitelist;
+@property (nonatomic, readonly, strong) NSArray* whitelist;
+@property (nonatomic, readonly, strong) NSArray* expandedWhitelist;
@property (nonatomic, readonly, assign) BOOL allowAll;
- (id) initWithArray:(NSArray*)array;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/CDVWhitelist.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVWhitelist.m b/CordovaLib/Classes/CDVWhitelist.m
index 14a33a4..6176cee 100644
--- a/CordovaLib/Classes/CDVWhitelist.m
+++ b/CordovaLib/Classes/CDVWhitelist.m
@@ -21,8 +21,8 @@
@interface CDVWhitelist ()
-@property (nonatomic, readwrite, retain) NSArray* whitelist;
-@property (nonatomic, readwrite, retain) NSArray* expandedWhitelist;
+@property (nonatomic, readwrite, strong) NSArray* whitelist;
+@property (nonatomic, readwrite, strong) NSArray* expandedWhitelist;
@property (nonatomic, readwrite, assign) BOOL allowAll;
- (void) processWhitelist;
@@ -62,7 +62,7 @@
}
// restrict number parsing to 0-255
- NSNumberFormatter* numberFormatter = [[[NSNumberFormatter alloc] init] autorelease];
+ NSNumberFormatter* numberFormatter = [[NSNumberFormatter alloc] init];
[numberFormatter setMinimum:[NSNumber numberWithUnsignedInteger:0]];
[numberFormatter setMaximum:[NSNumber numberWithUnsignedInteger:255]];
@@ -100,7 +100,7 @@
while (externalHost = [enumerator nextObject])
{
- NSString* regex = [[externalHost copy] autorelease];
+ NSString* regex = [externalHost copy];
BOOL is_ip = [self isIPv4Address:regex];
// check for single wildcard '*', if found set allowAll to YES
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/NSData+Base64.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/NSData+Base64.m b/CordovaLib/Classes/NSData+Base64.m
index 49ddd52..39f0633 100644
--- a/CordovaLib/Classes/NSData+Base64.m
+++ b/CordovaLib/Classes/NSData+Base64.m
@@ -287,11 +287,10 @@ char *CDVNewBase64Encode(
CDVNewBase64Encode([self bytes], [self length], true, &outputLength);
NSString *result =
- [[[NSString alloc]
+ [[NSString alloc]
initWithBytes:outputBuffer
length:outputLength
- encoding:NSASCIIStringEncoding]
- autorelease];
+ encoding:NSASCIIStringEncoding];
free(outputBuffer);
return result;
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/NSMutableArray+QueueAdditions.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/NSMutableArray+QueueAdditions.m b/CordovaLib/Classes/NSMutableArray+QueueAdditions.m
index 69acdaf..73f1cf9 100755
--- a/CordovaLib/Classes/NSMutableArray+QueueAdditions.m
+++ b/CordovaLib/Classes/NSMutableArray+QueueAdditions.m
@@ -30,7 +30,7 @@
return [self objectAtIndex:0];
}
-- (id) dequeue
+- (__autoreleasing id) dequeue
{
if ([self count] == 0) {
return nil;
@@ -38,7 +38,7 @@
id head = [self objectAtIndex:0];
if (head != nil) {
- [[head retain] autorelease];
+ // [[head retain] autorelease]; ARC - the __autoreleasing on the return value should so the same thing
[self removeObjectAtIndex:0];
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/Classes/UIDevice+Extensions.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/UIDevice+Extensions.m b/CordovaLib/Classes/UIDevice+Extensions.m
index 91c714b..5ec5de8 100644
--- a/CordovaLib/Classes/UIDevice+Extensions.m
+++ b/CordovaLib/Classes/UIDevice+Extensions.m
@@ -33,7 +33,7 @@
CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef);
- app_uuid = [NSString stringWithString:(NSString*)uuidString];
+ app_uuid = [NSString stringWithString:(__bridge NSString*)uuidString];
[userDefaults setObject:app_uuid forKey:UUID_KEY];
[userDefaults synchronize];
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 96c86da..8aea9cf 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -54,7 +54,7 @@
30956FD2138F1F5600FC3563 /* CDVMotion.h in Headers */ = {isa = PBXBuildFile; fileRef = 30956FD0138F1F5600FC3563 /* CDVMotion.h */; settings = {ATTRIBUTES = (Public, ); }; };
30956FD3138F1F5600FC3563 /* CDVMotion.m in Sources */ = {isa = PBXBuildFile; fileRef = 30956FD1138F1F5600FC3563 /* CDVMotion.m */; };
30A90B9114588697006178D3 /* JSONKit.h in Headers */ = {isa = PBXBuildFile; fileRef = 30A90B8F14588697006178D3 /* JSONKit.h */; settings = {ATTRIBUTES = (Public, ); }; };
- 30A90B9314588697006178D3 /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 30A90B9014588697006178D3 /* JSONKit.m */; };
+ 30A90B9314588697006178D3 /* JSONKit.m in Sources */ = {isa = PBXBuildFile; fileRef = 30A90B9014588697006178D3 /* JSONKit.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
30AE4E8D1419532F005A9C9A /* CDVContactsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 30AE4E8C1419532F005A9C9A /* CDVContactsTests.m */; };
30B342F515224B360070E6A5 /* CDVWebViewTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 30B342F415224B360070E6A5 /* CDVWebViewTest.m */; };
30B39EBE13D0268B0009682A /* CDVSplashScreen.h in Headers */ = {isa = PBXBuildFile; fileRef = 30B39EBC13D0268B0009682A /* CDVSplashScreen.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -832,6 +832,7 @@
armv6,
armv7,
);
+ CLANG_ENABLE_OBJC_ARC = YES;
COPY_PHASE_STRIP = NO;
DSTROOT = "/tmp/$(PROJECT_NAME).dst";
GCC_DYNAMIC_NO_PIC = NO;
@@ -858,6 +859,7 @@
armv6,
armv7,
);
+ CLANG_ENABLE_OBJC_ARC = YES;
DSTROOT = "/tmp/$(PROJECT_NAME).dst";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/CordovaLibTests/CDVPluginResultJSONSerializationTests.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLibTests/CDVPluginResultJSONSerializationTests.m b/CordovaLib/CordovaLibTests/CDVPluginResultJSONSerializationTests.m
index f3e0c47..c9fc196 100644
--- a/CordovaLib/CordovaLibTests/CDVPluginResultJSONSerializationTests.m
+++ b/CordovaLib/CordovaLibTests/CDVPluginResultJSONSerializationTests.m
@@ -94,7 +94,7 @@
[NSNumber numberWithBool:true], @"boolItem",
nil];
- NSDictionary *nestedDict = [[testValues copy] autorelease];
+ NSDictionary *nestedDict = [testValues copy];
[testValues setValue:nestedDict forKey:@"nestedDict"];
CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:testValues];
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/CordovaLibTests/CDVWebViewTest.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLibTests/CDVWebViewTest.h b/CordovaLib/CordovaLibTests/CDVWebViewTest.h
index 99166e4..35cb28e 100644
--- a/CordovaLib/CordovaLibTests/CDVWebViewTest.h
+++ b/CordovaLib/CordovaLibTests/CDVWebViewTest.h
@@ -22,8 +22,12 @@
@class AppDelegate;
@class CDVViewController;
+
@interface CDVWebViewTest : SenTestCase
+@property (nonatomic, strong) UIWebView* webView;
+
+
- (AppDelegate *)appDelegate;
- (CDVViewController *)viewController;
- (UIWebView *)webView;
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/CordovaLib/CordovaLibTests/CDVWhitelistTests.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLibTests/CDVWhitelistTests.m b/CordovaLib/CordovaLibTests/CDVWhitelistTests.m
index d2c784e..8489e45 100644
--- a/CordovaLib/CordovaLibTests/CDVWhitelistTests.m
+++ b/CordovaLib/CordovaLibTests/CDVWhitelistTests.m
@@ -53,8 +53,6 @@
STAssertTrue([whitelist schemeIsAllowed:@"ftp"], nil);
STAssertTrue([whitelist schemeIsAllowed:@"ftps"], nil);
STAssertFalse([whitelist schemeIsAllowed:@"gopher"], nil);
-
- [whitelist release];
}
@@ -70,8 +68,6 @@
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apache.org"]], nil);
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://sub1.sub0.build.apache.org"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apache.org.ca"]], nil);
-
- [whitelist release];
}
- (void) testWildcardInTLD
@@ -87,8 +83,7 @@
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apache.ogg"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apache.foo"]], nil);
-
- [whitelist release];
+
}
- (void) testTLDWildcard
@@ -149,8 +144,7 @@
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://unknownhostname.faketld"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://unknownhostname.com"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://www.apache.org"]], nil);
-
- [whitelist release];
+
}
- (void) testCatchallWildcardOnly
@@ -165,8 +159,7 @@
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://build.apache.prg"]], nil);
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://MyDangerousSite.org"]], nil);
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apache.org.SuspiciousSite.com"]], nil);
-
- [whitelist release];
+
}
- (void) testWildcardInHostname
@@ -182,8 +175,7 @@
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://www.MACapache.org"]], nil);
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://www.MACapacMAChe.org"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apache.org"]], nil);
-
- [whitelist release];
+
}
- (void) testExactMatch
@@ -197,8 +189,7 @@
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://www.apache.org"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://build.apache.org"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apache.org"]], nil);
-
- [whitelist release];
+
}
- (void) testWildcardMix
@@ -214,8 +205,7 @@
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apacMAChe.ca"]], nil);
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://apacMAChe.museum"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://blahMAChe.museum"]], nil);
-
- [whitelist release];
+
}
- (void) testIpExactMatch
@@ -231,8 +221,7 @@
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.1.1"]], nil);
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.2.1"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.3.1"]], nil);
-
- [whitelist release];
+
}
- (void) testIpWildcardMatch
@@ -250,8 +239,7 @@
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.2.1"]], nil);
STAssertTrue([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.2.2"]], nil);
STAssertFalse([whitelist URLIsAllowed:[NSURL URLWithString:@"http://192.168.3.1"]], nil);
-
- [whitelist release];
+
}
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj b/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj
index 5ce7356..90fa142 100755
--- a/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj
+++ b/bin/templates/project/__TESTING__.xcodeproj/project.pbxproj
@@ -513,6 +513,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_OBJCPP_ARC_ABI = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -530,6 +532,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_OBJCPP_ARC_ABI = YES;
COPY_PHASE_STRIP = YES;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "__TESTING__/__TESTING__-Prefix.pch";
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/bin/templates/project/__TESTING__/Classes/AppDelegate.h
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/Classes/AppDelegate.h b/bin/templates/project/__TESTING__/Classes/AppDelegate.h
index c7b8c2f..d50a071 100644
--- a/bin/templates/project/__TESTING__/Classes/AppDelegate.h
+++ b/bin/templates/project/__TESTING__/Classes/AppDelegate.h
@@ -38,8 +38,8 @@
// a simple tutorial can be found here :
// http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
-@property (nonatomic, retain) IBOutlet UIWindow* window;
-@property (nonatomic, retain) IBOutlet CDVViewController* viewController;
+@property (nonatomic, strong) IBOutlet UIWindow* window;
+@property (nonatomic, strong) IBOutlet CDVViewController* viewController;
@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/bin/templates/project/__TESTING__/Classes/AppDelegate.m
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/Classes/AppDelegate.m b/bin/templates/project/__TESTING__/Classes/AppDelegate.m
index 43f85ca..86e2815 100644
--- a/bin/templates/project/__TESTING__/Classes/AppDelegate.m
+++ b/bin/templates/project/__TESTING__/Classes/AppDelegate.m
@@ -46,7 +46,8 @@
[CDVURLProtocol registerURLProtocol];
- return [super init];
+ self = [super init];
+ return self;
}
#pragma UIApplicationDelegate implementation
@@ -65,12 +66,12 @@
}
CGRect screenBounds = [[UIScreen mainScreen] bounds];
- self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease];
+ self.window = [[UIWindow alloc] initWithFrame:screenBounds];
self.window.autoresizesSubviews = YES;
CGRect viewBounds = [[UIScreen mainScreen] applicationFrame];
- self.viewController = [[[MainViewController alloc] init] autorelease];
+ self.viewController = [[MainViewController alloc] init];
self.viewController.useSplashScreen = YES;
self.viewController.wwwFolderName = @"www";
self.viewController.startPage = @"index.html";
@@ -127,9 +128,4 @@
return YES;
}
-- (void) dealloc
-{
- [super dealloc];
-}
-
@end
http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/a6b67bea/bin/templates/project/__TESTING__/main.m
----------------------------------------------------------------------
diff --git a/bin/templates/project/__TESTING__/main.m b/bin/templates/project/__TESTING__/main.m
index b8bb5e6..2dbcb26 100644
--- a/bin/templates/project/__TESTING__/main.m
+++ b/bin/templates/project/__TESTING__/main.m
@@ -28,8 +28,8 @@
int main(int argc, char *argv[]) {
- NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
- int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
- [pool release];
- return retVal;
+ @autoreleasepool {
+ int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
+ return retVal;
+ }
}