昨天,我将 Xcode 更新到最新版本(5.1 (5B130a))
以兼容iOS 7.1
. Then I build my project, I get the error "Cast from pointer to smaller type 'int' loses information"
in EAGLView.mm
file ( line 408
) when 64-bit simulators (eg: iPhone Retina 4-inch 64-bit) is selected.
我正在使用cocos2d-x-2.2.2
. 在我更新 Xcode 之前,我的项目仍然可以在所有设备上正常构建和运行。
感谢所有推荐。
更新:今天,我下载了最新版本的 cocos2d-x(cocos2d-x 2.2.3)。但问题仍然存在。
这是发生该错误的一些代码:
/cocos2d-x-2.2.2/cocos2dx/platform/ios/EAGLView.mm:408:18: Cast from pointer to smaller type 'int' loses information
// Pass the touches to the superview
#pragma mark EAGLView - Touch Delegate
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
if (isKeyboardShown_)
{
[self handleTouchesAfterKeyboardShow];
return;
}
int ids[IOS_MAX_TOUCHES_COUNT] = {0};
float xs[IOS_MAX_TOUCHES_COUNT] = {0.0f};
float ys[IOS_MAX_TOUCHES_COUNT] = {0.0f};
int i = 0;
for (UITouch *touch in touches) {
ids[i] = (int)touch; // error occur here
xs[i] = [touch locationInView: [touch view]].x * view.contentScaleFactor;;
ys[i] = [touch locationInView: [touch view]].y * view.contentScaleFactor;;
++i;
}
cocos2d::CCEGLView::sharedOpenGLView()->handleTouchesBegin(i, ids, xs, ys);
}