0

我正在 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;
}
4

1 回答 1

3

我唯一能想到的就是你的项目中有些东西过时了。您是否尝试过清洁(通过ProductClean)和重建?

于 2012-08-11T13:11:52.080 回答