내지도 위에이 UI를 추가하여 운전자가 운전하는 현재 속도를 보여주고 싶습니다. main.m에서 이러한 오류가 발생합니다. 왜, 어떻게 고칠 수 있습니까? 'viewSpeed'
인스턴스 메소드 선언되지 않은 식별자의iOS 앱에서 이러한 모든 컴파일 오류가 발생하는 이유는 무엇입니까?
사용 '-setViewSpeed'
이 예상
locationmanager.m ('ID'로 반환 형식 기본값)를 찾을 수 없습니다 ':'
예상 메서드 본문
예상 식별자 또는 '('
누락 '@end'
#import "locationManager.h"
@implementation locationManager
@synthesize locationManager;
@synthesize fastView;
- (id) init {
self = [super init];
if (self != nil) {
self.locationManager = [[[CLLocationManager alloc] init] autorelease];
self.locationManager.delegate = self; // send loc updates to myself
}
return self;
}
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
NSLog(@"Location: %@", newLocation description);
{
self.currentLocation = newLocation;
BOOL newLocationIsValid = [self isValidLocation:newLocation witholdLocation:oldLocation];
if(newLocationIsValid && oldLocation)
{
int distance = [newLocation distanceFromLocation:oldLocation];
if(distance >2 && distance<10)
{
[self.fastView setText:[NSString stringWithFormat:@"%i meters ", distance]];
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)errort
{
NSLog(@"Error: %@", [error description]);
}
@end
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
NSLog (@"%s", __func__);
}
,
main.m
-(void)userDidLoagin
{
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)dealloc
{
[userMap release];
[_Speed release];
[viewSpeed release];
[_fastView release];
[super dealloc];
}
- (void)viewDidUnload
{
[userMap release];
userMap = nil;
[self setSpeed:nil];
[self setViewSpeed:nil];
[self setFastView:nil];
[super viewDidUnload];
}
@Abhi Beckert는 다음과 같이 말했습니다. 또한'locationManager : didUpdateToLocation : fromLocation :'의 끝에 몇 개의 괄호가 빠져 있습니다. – QED
-1 오류가 발생한 행을 표시하지 않고 막대한 코드 블록을 던지기위한 것입니다. – borrrden
@borrrden 때때로 컴파일러는 오류를 쉽게 찾지 않습니다. 코드를 Xcode에 붙여 넣었고 디버거가 없었으므로 문제를 찾기 위해 한번에 한 줄씩 읽어야했습니다. -1을 보상하려면 +1하십시오. –