in meiner Header-Datei deklariert ich immer bin, wenn ich diese Zeile hinzu:Objective C: seltsame Fehler, wenn init eine Variable
locMan = [[CLLocationManager alloc] init];
Zum viewDidLoad
Methode in meiner .m-Datei erhalte ich einige Fehler, die ich habe noch nie vorher gesehen. Hier sind die Fehler:
Ich kann nicht für das Leben von mir herauszufinden, warum fügte hinzu, dass Leitungsprobleme verursacht. Wenn jemand etwas Licht geben kann, wäre ich sehr dankbar.
Ich habe diese Header-Datei:
#import <UIKit/UIKit.h>
#import "CoreLocation/CoreLocation.h"
@interface RobotWarsViewController : UIViewController
<CLLocationManagerDelegate> {
CLLocationManager *locMan;
// Current Location View
IBOutlet UIView *currentLocationView;
IBOutlet UILabel *currentLocationLabel;
}
@property (assign, nonatomic) UIView *currentLocationView;
@property (assign, nonatomic) UILabel *currentLocationLabel;
@property (assign, nonatomic) CLLocationManager *locMan;
- (IBAction)dropEMP:(id)sender;
- (IBAction)armEMP:(id)sender;
@end
Und diese .m-Datei:
#import "RobotWarsViewController.h"
@implementation RobotWarsViewController
@synthesize locMan;
@synthesize currentLocationView;
@synthesize currentLocationLabel;
- (void)viewDidLoad {
[super viewDidLoad];
locMan = [[CLLocationManager alloc] init];
// locMan.delegate = self;
}
- (IBAction)dropEMP:(id)sender{
NSLog(@"Boo");
}
- (IBAction)armEMP:(id)sender{
NSLog(@"boo");
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
NSLog(@"location update");
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
[currentLocationView release];
[currentLocationLabel release];
}
@end
Danke danke danke! – sixtyfootersdude