我正在Xcode(4.4.1)上构建一个iOS(5.1)应用程序,我几乎完成了第一阶段的开发,但我仍然坚持最后一行代码。我一直在使用Kumulos作为后端& API解决方案,目前所有API工作正常,除了这一点:
Kumulos* k = [[Kumulos alloc]init];
[k setDelegate:self];
[k createNewTimePointWithJourneyIDFK:[journeyID integerValue]
andTime:currentDate andLat:[lat floatValue] andLon:[lon floatValue]];
当它命中createNewTimePointWithJourneyIDFK:方法时,它会终止。在日志中它提到了这个方法,并说一个无法识别的选择器被发送到一个实例。
现在我意识到这个问题在SO上被问了一百万次,但是我已经1)检查了方法是否被定义了,2)它已被正确调用(或者至少据我所知) )。我完成上述操作的方式是我完成其余API调用的方式,并且它们运行良好,所以我看不出问题所在。非常令人沮丧,我花了好几个小时在最后一行!所以请不要以为我在几分钟后不知道该怎么做就听到了。
错误消息
2012-08-11 22:36:58.769 busApp4Kumulos[5485:707] -[Kumulos
createNewTimePointWithJourneyIDFK:andTime:andLat:andLon:]:
unrecognizedselector sent to instance 0x3d1b70 2012-08-11 22:36:58.778
busApp4Kumulos[5485:707]
*** Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '-[Kumulos
createNewTimePointWithJourneyIDFK:andTime:andLat:andLon:]:
unrecognized selector sent to instance 0x3d1b70'
*** First throw call stack:
(0x35add88f 0x37e84259 0x35ae0a9b 0x35adf915 0x35a3a650 0x3ef5
0x37f86de3 0x37f86785 0x37f80e3f 0x35ab1b01 0x35ab112f 0x35ab0351
0x35a334a5 0x35a3336d 0x376cf439 0x3353fcd5 0x2dd9 0x2d74)
terminate called throwing an exception(lldb)
方法
它位于Kumulos.m文件中。
-(KSAPIOperation*) createNewTimePointWithJourneyIDFK:(NSInteger)journeyIDFK
andTime:(NSDate*)time andLat:(float)lat andLon:(float)lon{
NSMutableDictionary* theParams = [[NSMutableDictionary alloc]init];
[theParams setValue:[NSNumber numberWithInt:journeyIDFK] forKey:@"journeyIDFK"];
[theParams setValue:time forKey:@"time"];
[theParams setValue:[NSNumber numberWithFloat:lat] forKey:@"lat"];
[theParams setValue:[NSNumber numberWithFloat:lon] forKey:@"lon"];
KSAPIOperation* newOp = [[KSAPIOperation alloc]initWithAPIKey:theAPIKey
andSecretKey:theSecretKey andMethodName:@"createNewTimePoint"
andParams:theParams];
[newOp setDelegate:self];
[newOp setUseSSL:useSSL];
//we pass the method signature for the kumulosProxy callback on this thread
[newOp setCallbackSelector:@selector( kumulosAPI: apiOperation: createNewTimePointDidCompleteWithResult:)];
[newOp setSuccessCallbackMethodSignature:[self methodSignatureForSelector:@selector(apiOperation: didCompleteWithResult:)]];
[newOp setErrorCallbackMethodSignature:[self methodSignatureForSelector:@selector(apiOperation: didFailWithError:)]];
[opQueue addOperation:newOp];
return newOp;
}
答案 0 :(得分:3)
我唯一能想到的是你的项目中陈旧的东西。您是否尝试过清洁(通过产品→清洁)并重建?