0

我的一个 Objective-C 课程有问题。

Xcode 说第 20 行有一个 Parse Issue。

+ (Boolean)hasOverlay:(KnownPoints*)points byPoint:(CGPoint)p;

KnownPoints 是一个自写的类。Xcode 显示错误出现在 '(KnownPoints*)points 部分。

添加此代码行的其他类似主题的答案:

@class KnownPoints

不起作用。

该类在计算类中调用,它使 x 和 y 坐标的纬度和经度形成一个视图。

这里的代码:(CalcMakerPos.h)

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import "Journey.h"
#import "CoordRect.h"
#import "KnownPoints.h"


@interface CalcMakerPos : NSObject


+ (CGPoint)calcPosFor: (CLLocationCoordinate2D)coord WithDataFrom: (CoordRect*)rect     AtView: (UIView*)view;
+ (Boolean)hasOverlay:(KnownPoints*)points byPoint:(CGPoint)p;
@end

CalcMakerPos.m

#import "CalcMakerPos.h"
#import "MinMaxCoords.h"
#import "Journey.h"
#import "KnownPoints.h"

@implementation CalcMakerPos
#pragma mark Calculate GeoCoords zu Pixeln
+ (CGPoint)calcPosFor: (CLLocationCoordinate2D)coord WithDataFrom: (CoordRect*)rect AtView: (UIView*)view{

     double maxLat = [rect maxLat];
     double minLat = [rect minLat];
     double maxLon = [rect maxLon];
     double minLon = [rect minLon];
     int x = (int)((coord.longitude - minLon) / (maxLon - minLon) * view.frame.size.width);
     int y = (int)((coord.latitude - minLat) / (maxLat - minLat) * view.frame.size.height);
     NSLog(@"Point(%d, %d)", x,y);
     return CGPointMake(x, y);
}

#pragma mark check whether point is free
+ (Boolean)hasOverlay:(KnownPoints*)points byPoint:(CGPoint)p{
    BOOL isOverLay = false;

    return isOverLay;
}
@end

我希望你能帮助我。

来自德国的问候

罗比字节

4

2 回答 2

0

这可能是由循环导入语句引起的。

确保它CalcMakerPos没有被导入或添加@classKnownPoints.

于 2013-01-29T09:26:51.760 回答
0

KnownPoints并被Journey进口两次。从实现文件中删除导入,因为它们是多余的。

之后清理并构建您的项目。

于 2013-01-29T09:36:32.817 回答