2014-05-14 2 views
0

Apportable을 사용하여 Android에 포팅중인 Cocos2d-Iphone 앱에 여러 NS_ENUM을 사용했습니다. 응용 프로그램은 Xcode에서 완벽하게 작동하지만 Apportable을 사용하여 빌드 할 때 NS_ENUM의 여러 오류가 발생합니다.Apportable을 사용하여 앱을 빌드 할 때 NS_ENUM 오류가 발생했습니다.

typedef NS_ENUM(NSUInteger, ballTypes) { 

redBall = 0, 
yellowBall = 1, 
blueBall = 2, 
greenBall = 3 
}; 

가 나는 또한 비슷한 방법으로 내 다른 열거의 정의 : 나는대로 ballTypes을 정의

/Users/mac/Documents/BallTestApp/BallManager.mm:57:32: error: assigning to 'ballTypes' from incompatible type 'int' 
    lastCreatedBallType = NULL; 
         ^~~~~ 
/Users/mac/Documents/BallTestApp/BallManager.mm:382:66: error: cannot initialize a parameter of type 'ballTypes' with an lvalue of type 'int' 
            withBallType:pBallType atLocation:ballPosition withManager:self]; 
                ^~~~~~~~~ 
/Users/mac/Documents/BallTestApp/Ball.h:193:103: note: passing argument to parameter 'myType' here 
-(id)initBallWithWorld:(b2World*)world inLayer:(GamePlayLayer*)layer withBallType:(ballTypes)myType atLocation:(CGPoint)myLocation withManager:(BallManager*)myBallManager; 
                          ^
/Users/mac/Documents/BallTestApp/BallManager.mm:575:79: error: cannot initialize a parameter of type 'xBallDistances' with an lvalue of type 'int' 
    myBallPos = self.carlBall.position.x + [self getBallDistance:i]; 
                   ^

: 다음 오류 중 일부입니다.

+0

xcode에서 권장되는 컴파일러 경고를 활성화하면 동일한 오류가 발생합니다. 단순히 값을 캐스팅하고 NULL이 아닌 실제 열거 형 이름을 0 이상으로 사용하십시오 (포인터 유형에 대해 예약 됨). 예 : type = (ballTypes) redBall. – LearnCocos2D

답변

0

NULL은과 같이 정의된다 :

#define NULL 0 

따라서 당신이 열거 값 INT 0을 할당하려는.

= NULL 대신 = redBall을 사용하면 경고가 해결됩니다.

관련 문제