0
沒有錯誤 - 編譯時或在運行時拋出的異常...建立良好。我在做內存管理錯了嗎? ARC已針對所有文件啓用。CLLocation Manager中斷
viewcontroller.h:
#import <UIKit/UIKit.h>
@interface workViewController : UIViewController
<CLLocationManagerDelegate>{
CLLocationManager *locationManager;
}
@property (strong, nonatomic) IBOutlet CLLocationManager *locationManager;
@end
viewcontroller.m:
#import "workViewController.h"
@interface workViewController()
@end
@implementation workViewController
@synthesize locationManager;
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
NSLog(@"i worked lol");
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the
//view, typically from a nib.
locationManager.delegate = self;
[locationManager startUpdatingLocation];
}
- (void)viewDidUnload
{
[locationManager stopUpdatingLocation];
[self setLocationManager:nil];
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end
prefix.pch:
#import <Availability.h>
#ifndef __IPHONE_5_0
#warning "This project uses features only available in iOS SDK 5.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreLocation/CoreLocation.h>
#endif
反正這個代碼工作,一旦我第一次建立的應用程序。我一直在努力掙扎,主要是它有時會工作,有時甚至根本不工作,直到我重新啓動計算機。我在做內存管理完全錯誤嗎?
這個困擾我,因爲我確信我接着在線教程線....
的應用程序中斷在調用委託方法,其中:
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
它只是說線程1斷點.. 。我不知道如何閱讀調試器(它只是提供了一些十六進制,我不知道該怎麼辦......)
無論如何,我很想知道我在做什麼錯了!