diff --git a/ARKitDemo/ARKitDemo.xcodeproj/project.pbxproj b/ARKitDemo/ARKitDemo.xcodeproj/project.pbxproj index 2454d52..ebe7b02 100755 --- a/ARKitDemo/ARKitDemo.xcodeproj/project.pbxproj +++ b/ARKitDemo/ARKitDemo.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 45; + objectVersion = 46; objects = { /* Begin PBXBuildFile section */ @@ -31,6 +31,7 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; + 6E0A53FE199DD3F400E2013C /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6E0A53FD199DD3F400E2013C /* CoreMotion.framework */; }; CE169F581025704E00556F8F /* ARGeoCoordinate.m in Sources */ = {isa = PBXBuildFile; fileRef = CE169F571025704E00556F8F /* ARGeoCoordinate.m */; }; /* End PBXBuildFile section */ @@ -58,6 +59,7 @@ 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* ARKitDemo_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARKitDemo_Prefix.pch; sourceTree = ""; }; + 6E0A53FD199DD3F400E2013C /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; 8D1107310486CEB800E47090 /* ARKitDemo-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "ARKitDemo-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; CE169F561025704E00556F8F /* ARGeoCoordinate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ARGeoCoordinate.h; sourceTree = ""; }; CE169F571025704E00556F8F /* ARGeoCoordinate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ARGeoCoordinate.m; sourceTree = ""; }; @@ -81,6 +83,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6E0A53FE199DD3F400E2013C /* CoreMotion.framework in Frameworks */, 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, @@ -172,6 +175,7 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + 6E0A53FD199DD3F400E2013C /* CoreMotion.framework */, 1109BC301082F1B2006FFB4B /* QuartzCore.framework */, 116DC886102933A200EB5A0A /* MapKit.framework */, 111A141B1024C875002D39A1 /* CoreLocation.framework */, @@ -226,11 +230,16 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { + LastUpgradeCheck = 0510; ORGANIZATIONNAME = "Zac White"; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ARKitDemo" */; - compatibilityVersion = "Xcode 3.1"; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; hasScannedForEncodings = 1; + knownRegions = ( + en, + ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; projectRoot = ""; @@ -390,26 +399,29 @@ C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; + ONLY_ACTIVE_ARCH = YES; PREBINDING = NO; - SDKROOT = iphoneos3.1; + SDKROOT = iphoneos; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; GCC_C_LANGUAGE_STANDARD = c99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 7.1; PREBINDING = NO; - SDKROOT = iphoneos3.1; + SDKROOT = iphoneos; }; name = Release; }; diff --git a/ARKitDemo/Classes/ARCoordinate.m b/ARKitDemo/Classes/ARCoordinate.m old mode 100644 new mode 100755 index e8a9caa..e708fe6 --- a/ARKitDemo/Classes/ARCoordinate.m +++ b/ARKitDemo/Classes/ARCoordinate.m @@ -23,7 +23,7 @@ + (ARCoordinate *)coordinateWithRadialDistance:(double)newRadialDistance inclina newCoordinate.title = @""; - return [newCoordinate autorelease]; + return newCoordinate; } - (NSUInteger)hash{ @@ -45,21 +45,13 @@ - (BOOL)isEqualToCoordinate:(ARCoordinate *)otherCoordinate { equal = equal && self.inclination == otherCoordinate.inclination; equal = equal && self.azimuth == otherCoordinate.azimuth; - if (self.title && otherCoordinate.title || self.title && !otherCoordinate.title || !self.title && otherCoordinate.title) { + if ((self.title && otherCoordinate.title) || (self.title && !otherCoordinate.title) || (!self.title && otherCoordinate.title)) { equal = equal && [self.title isEqualToString:otherCoordinate.title]; } return equal; } -- (void)dealloc { - - self.title = nil; - self.subtitle = nil; - - [super dealloc]; -} - - (NSString *)description { return [NSString stringWithFormat:@"%@ r: %.3fm φ: %.3f° θ: %.3f°", self.title, self.radialDistance, radiansToDegrees(self.azimuth), radiansToDegrees(self.inclination)]; } diff --git a/ARKitDemo/Classes/ARGeoCoordinate.m b/ARKitDemo/Classes/ARGeoCoordinate.m old mode 100644 new mode 100755 index 4c3c748..9479d83 --- a/ARKitDemo/Classes/ARGeoCoordinate.m +++ b/ARKitDemo/Classes/ARGeoCoordinate.m @@ -28,7 +28,7 @@ - (void)calibrateUsingOrigin:(CLLocation *)origin { if (!self.geoLocation) return; - double baseDistance = [origin getDistanceFrom:self.geoLocation]; + double baseDistance = [origin distanceFromLocation:self.geoLocation]; self.radialDistance = sqrt(pow(origin.altitude - self.geoLocation.altitude, 2) + pow(baseDistance, 2)); @@ -46,7 +46,7 @@ + (ARGeoCoordinate *)coordinateWithLocation:(CLLocation *)location { newCoordinate.title = @""; - return [newCoordinate autorelease]; + return newCoordinate; } + (ARGeoCoordinate *)coordinateWithLocation:(CLLocation *)location fromOrigin:(CLLocation *)origin { diff --git a/ARKitDemo/Classes/ARGeoViewController.m b/ARKitDemo/Classes/ARGeoViewController.m old mode 100644 new mode 100755 index 78ff9b7..062a091 --- a/ARKitDemo/Classes/ARGeoViewController.m +++ b/ARKitDemo/Classes/ARGeoViewController.m @@ -15,8 +15,7 @@ @implementation ARGeoViewController @synthesize centerLocation; - (void)setCenterLocation:(CLLocation *)newLocation { - [centerLocation release]; - centerLocation = [newLocation retain]; + centerLocation = newLocation; for (ARGeoCoordinate *geoLocation in self.coordinates) { if ([geoLocation isKindOfClass:[ARGeoCoordinate class]]) { diff --git a/ARKitDemo/Classes/ARKitDemoAppDelegate.m b/ARKitDemo/Classes/ARKitDemoAppDelegate.m old mode 100644 new mode 100755 index 40bbf1a..01675f1 --- a/ARKitDemo/Classes/ARKitDemoAppDelegate.m +++ b/ARKitDemo/Classes/ARKitDemoAppDelegate.m @@ -42,8 +42,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Denver"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:45.523875 longitude:-122.670399]; @@ -51,8 +49,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Portland"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:41.879535 longitude:-87.624333]; @@ -60,8 +56,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Chicago"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:30.268735 longitude:-97.745209]; @@ -69,8 +63,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Austin"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:51.500152 longitude:-0.126236]; @@ -79,8 +71,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"London"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:48.856667 longitude:2.350987]; @@ -89,8 +79,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Paris"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:47.620973 longitude:-122.347276]; @@ -98,8 +86,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Seattle"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:20.593684 longitude:78.96288]; @@ -108,8 +94,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"India"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:55.676294 longitude:12.568116]; @@ -118,8 +102,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Copenhagen"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:52.373801 longitude:4.890935]; @@ -128,8 +110,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Amsterdam"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:19.611544 longitude:-155.665283]; @@ -138,8 +118,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Hawaii"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:-40.900557 longitude:174.885971]; @@ -148,8 +126,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"New Zealand"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:40.756054 longitude:-73.986951]; @@ -157,8 +133,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"New York City"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:42.35892 longitude:-71.05781]; @@ -166,8 +140,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Boston"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:49.817492 longitude:15.472962]; @@ -176,8 +148,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Czech Republic"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:53.41291 longitude:-8.24389]; @@ -186,8 +156,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Ireland"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:45.545447 longitude:-73.639076]; @@ -195,8 +163,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Montreal"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:38.892091 longitude:-77.024055]; @@ -204,8 +170,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Washington, DC"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - tempLocation = [[CLLocation alloc] initWithLatitude:-40.900557 longitude:174.885971]; @@ -213,7 +177,6 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Munich"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; tempLocation = [[CLLocation alloc] initWithLatitude:32.781078 longitude:-96.797111]; @@ -221,16 +184,12 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application { tempCoordinate.title = @"Dallas"; [tempLocationArray addObject:tempCoordinate]; - [tempLocation release]; - [viewController addCoordinates:tempLocationArray]; - [tempLocationArray release]; CLLocation *newCenter = [[CLLocation alloc] initWithLatitude:37.41711 longitude:-122.02528]; viewController.centerLocation = newCenter; - [newCenter release]; [viewController startListening]; @@ -253,7 +212,7 @@ - (UIView *)viewForCoordinate:(ARCoordinate *)coordinate { UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, BOX_WIDTH, 20.0)]; titleLabel.backgroundColor = [UIColor colorWithWhite:.3 alpha:.8]; titleLabel.textColor = [UIColor whiteColor]; - titleLabel.textAlignment = UITextAlignmentCenter; + titleLabel.textAlignment = NSTextAlignmentCenter; titleLabel.text = coordinate.title; [titleLabel sizeToFit]; @@ -266,19 +225,7 @@ - (UIView *)viewForCoordinate:(ARCoordinate *)coordinate { [tempView addSubview:titleLabel]; [tempView addSubview:pointView]; - [titleLabel release]; - [pointView release]; - - return [tempView autorelease]; -} - - -- (void)dealloc { - - //NEW COMMENT! - [window release]; - [super dealloc]; + return tempView; } - @end diff --git a/ARKitDemo/Classes/ARViewController.h b/ARKitDemo/Classes/ARViewController.h old mode 100644 new mode 100755 index fe94981..e61cf37 --- a/ARKitDemo/Classes/ARViewController.h +++ b/ARKitDemo/Classes/ARViewController.h @@ -9,6 +9,7 @@ #import #import +#import #import "ARCoordinate.h" @@ -19,18 +20,14 @@ @end -@interface ARViewController : UIViewController { +@interface ARViewController : UIViewController { CLLocationManager *locationManager; - UIAccelerometer *accelerometerManager; + CMMotionManager *coremotionManager; ARCoordinate *centerCoordinate; UIImagePickerController *cameraController; - NSObject *delegate; - NSObject *locationDelegate; - NSObject *accelerometerDelegate; - BOOL scaleViewsBasedOnDistance; double maximumScaleDistance; double minimumScaleFactor; @@ -56,7 +53,7 @@ @property (readonly) NSArray *coordinates; -@property BOOL debugMode; +@property (assign, nonatomic) BOOL debugMode; @property BOOL scaleViewsBasedOnDistance; @property double maximumScaleDistance; @@ -65,7 +62,7 @@ @property BOOL rotateViewsBasedOnPerspective; @property double maximumRotationAngle; -@property double updateFrequency; +@property (assign, nonatomic) double updateFrequency; //adding coordinates to the underlying data model. - (void)addCoordinate:(ARCoordinate *)coordinate; @@ -97,7 +94,7 @@ @property (retain) ARCoordinate *centerCoordinate; -@property (nonatomic, retain) UIAccelerometer *accelerometerManager; +@property (nonatomic, retain) CMMotionManager * coremotionManager; @property (nonatomic, retain) CLLocationManager *locationManager; @end diff --git a/ARKitDemo/Classes/ARViewController.m b/ARKitDemo/Classes/ARViewController.m old mode 100644 new mode 100755 index 954fbf8..8f3120b --- a/ARKitDemo/Classes/ARViewController.m +++ b/ARKitDemo/Classes/ARViewController.m @@ -15,7 +15,7 @@ @implementation ARViewController -@synthesize locationManager, accelerometerManager; +@synthesize locationManager, coremotionManager; @synthesize centerCoordinate; @synthesize scaleViewsBasedOnDistance, rotateViewsBasedOnPerspective; @@ -48,7 +48,7 @@ - (id)init { #if !TARGET_IPHONE_SIMULATOR - self.cameraController = [[[UIImagePickerController alloc] init] autorelease]; + self.cameraController = [[UIImagePickerController alloc] init]; self.cameraController.sourceType = UIImagePickerControllerSourceTypeCamera; self.cameraController.cameraViewTransform = CGAffineTransformScale(self.cameraController.cameraViewTransform, @@ -65,8 +65,6 @@ - (id)init { self.rotateViewsBasedOnPerspective = NO; self.maximumRotationAngle = M_PI / 6.0; - self.wantsFullScreenLayout = YES; - return self; } @@ -85,14 +83,11 @@ - (id)initWithLocationManager:(CLLocationManager *)manager { // Implement loadView to create a view hierarchy programmatically, without using a nib. - (void)loadView { - [ar_overlayView release]; ar_overlayView = [[UIView alloc] initWithFrame:CGRectZero]; - [ar_debugView release]; - if (self.debugMode) { ar_debugView = [[UILabel alloc] initWithFrame:CGRectZero]; - ar_debugView.textAlignment = UITextAlignmentCenter; + ar_debugView.textAlignment = NSTextAlignmentCenter; ar_debugView.text = @"Waiting..."; [ar_overlayView addSubview:ar_debugView]; @@ -108,13 +103,12 @@ - (void)setUpdateFrequency:(double)newUpdateFrequency { if (!_updateTimer) return; [_updateTimer invalidate]; - [_updateTimer release]; - _updateTimer = [[NSTimer scheduledTimerWithTimeInterval:self.updateFrequency + _updateTimer = [NSTimer scheduledTimerWithTimeInterval:self.updateFrequency target:self selector:@selector(updateLocations:) userInfo:nil - repeats:YES] retain]; + repeats:YES]; } - (void)setDebugMode:(BOOL)flag { @@ -170,7 +164,7 @@ - (void)startListening { //start our heading readings and our accelerometer readings. if (!self.locationManager) { - self.locationManager = [[[CLLocationManager alloc] init] autorelease]; + self.locationManager = [[CLLocationManager alloc] init]; //we want every move. self.locationManager.headingFilter = kCLHeadingFilterNone; @@ -181,12 +175,16 @@ - (void)startListening { //steal back the delegate. self.locationManager.delegate = self; - - if (!self.accelerometerManager) { - self.accelerometerManager = [UIAccelerometer sharedAccelerometer]; - self.accelerometerManager.updateInterval = 0.01; - self.accelerometerManager.delegate = self; - } + + if (!self.coremotionManager) { + self.coremotionManager = [[CMMotionManager alloc]init]; + self.coremotionManager.accelerometerUpdateInterval = 0.01; + __weak __typeof(self) weakSelf = self; + [self.coremotionManager startAccelerometerUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMAccelerometerData *accelerometerData, NSError *error) { + [weakSelf coreMontiondidAccelerate:accelerometerData]; + }]; + } + if (!self.centerCoordinate) { self.centerCoordinate = [ARCoordinate coordinateWithRadialDistance:0 inclination:0 azimuth:0]; @@ -229,18 +227,10 @@ - (CGPoint)pointInView:(UIView *)realityView forCoordinate:(ARCoordinate *)coord #define kFilteringFactor 0.05 UIAccelerationValue rollingX, rollingZ; -- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { - // -1 face down. - // 1 face up. - - //update the center coordinate. - - //NSLog(@"x: %f y: %f z: %f", acceleration.x, acceleration.y, acceleration.z); - - //this should be different based on orientation. - - rollingZ = (acceleration.z * kFilteringFactor) + (rollingZ * (1.0 - kFilteringFactor)); - rollingX = (acceleration.y * kFilteringFactor) + (rollingX * (1.0 - kFilteringFactor)); +- (void)coreMontiondidAccelerate:(CMAccelerometerData *)acceleration { + + rollingZ = (acceleration.acceleration.z * kFilteringFactor) + (rollingZ * (1.0 - kFilteringFactor)); + rollingX = (acceleration.acceleration.y * kFilteringFactor) + (rollingX * (1.0 - kFilteringFactor)); if (rollingZ > 0.0) { self.centerCoordinate.inclination = atan(rollingX / rollingZ) + M_PI / 2.0; @@ -251,11 +241,7 @@ - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAccelera } else if (rollingX >= 0) { self.centerCoordinate.inclination = 3 * M_PI/2.0; } - - if (self.accelerometerDelegate && [self.accelerometerDelegate respondsToSelector:@selector(accelerometer:didAccelerate:)]) { - //forward the acceleromter. - [self.accelerometerDelegate accelerometer:accelerometer didAccelerate:acceleration]; - } + } NSComparisonResult LocationSortClosestFirst(ARCoordinate *s1, ARCoordinate *s2, void *ignore) { @@ -413,17 +399,19 @@ - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError * - (void)viewDidAppear:(BOOL)animated { #if !TARGET_IPHONE_SIMULATOR [self.cameraController setCameraOverlayView:ar_overlayView]; - [self presentModalViewController:self.cameraController animated:NO]; + [self presentViewController:self.cameraController animated:NO completion:^{ + + }]; [ar_overlayView setFrame:self.cameraController.view.bounds]; #endif if (!_updateTimer) { - _updateTimer = [[NSTimer scheduledTimerWithTimeInterval:self.updateFrequency + _updateTimer = [NSTimer scheduledTimerWithTimeInterval:self.updateFrequency target:self selector:@selector(updateLocations:) userInfo:nil - repeats:YES] retain]; + repeats:YES]; } [super viewDidAppear:animated]; @@ -453,18 +441,7 @@ - (void)didReceiveMemoryWarning { - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; - [ar_overlayView release]; ar_overlayView = nil; } - -- (void)dealloc { - [ar_debugView release]; - - [ar_coordinateViews release]; - [ar_coordinates release]; - - [super dealloc]; -} - @end diff --git a/ARKitDemo/main.m b/ARKitDemo/main.m old mode 100644 new mode 100755 index dc35f72..eafee52 --- a/ARKitDemo/main.m +++ b/ARKitDemo/main.m @@ -8,10 +8,8 @@ #import -int main(int argc, char *argv[]) { - - NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - int retVal = UIApplicationMain(argc, argv, nil, nil); - [pool release]; - return retVal; +int main(int argc, char *argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, nil); + } }