我刚刚遇到苹果过去提供的旧拼图资料。当我想知道是否有人可以提供帮助时,我遇到了一些错误。
我收到错误:错误:'endTrackingPiece:position:'参数2的不兼容类型错误:'continueTrackingPiece:position:'
参数2的不兼容类型- (void) touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
{
UITouch* touch = [touches anyObject];
//Check if we have a double-tap in the piece view and notify the application controller or begin tracking piece dragging
if([touch tapCount] >= 2)
[(AppController*)[[UIApplication sharedApplication] delegate] resetPiece:self];
else {
_tracking = YES;
[(AppController*)[[UIApplication sharedApplication] delegate] beginTrackingPiece:self position:[touch locationInView]];
}
}
- (void) touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
UITouch* touch = [touches anyObject];
//Continue tracking piece dragging
if(_tracking)
[(AppController*)[[UIApplication sharedApplication] delegate] continueTrackingPiece:self position:[touch locationInView]];
}
- (void) touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
UITouch* touch = [touches anyObject];
//Finish tracking piece dragging
if(_tracking) {
[(AppController*)[[UIApplication sharedApplication] delegate] endTrackingPiece:self position:[touch locationInView]];
_tracking = NO;
}
}
提前致谢
答案 0 :(得分:1)
这里的问题是locationInView期望UIView *作为参数,请参阅此处的参考:
因此,对于这三行中的每一行,修复都是要改变
[touch locationInView]
到
[touch locationInView: self]
在此之前,您可能需要更改项目文件中的基本SDK,如果它指的是Aspen1.2.sdk,我找到的版本是。我将它更新到iOS4.3(这是在XCode 4中,我应该添加。)
如果您想要删除弃用警告,请更改
_puzzles = [[[NSFileManager defaultManager] directoryContentsAtPath:path] mutableCopy];
到
_puzzles = [[[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:NULL] mutableCopy];
在AppController.m _resetPuzzle。
完成上述操作后,我得到一个在iOS模拟器中运行的干净建筑项目。确保你的音量没有静音,否则你会错过“Yay!”当你完成一个谜题:)