NStimeInterval属性错误

我的对象声明如下: my.h
@interface My:NSObject{
    NSTimeInterval time;
}
@property (assign) NSTimeInterval time;
@end
my.m
@implementation My
@synthesize time;
@end
代码中的某个地方:
-(NSTimeInterval)getTimeInterval:(NSString*)timeStr
{
    NSTimeInterval interval;
    //some code
    return interval;
}


-(void) func:(NSString*)timeInterval
{
    My *my = [[My alloc] init];
    my.time = [self getTimeInterval:timeInterval];
}
在线
my.time = [self getTimeInterval:timeInterval];
我得到错误:“'setTime'的参数1的不兼容类型” 谁能告诉我问题出在哪里?     
已邀请:
你的函数“getTimeInterval”接受一个字符串作为参数,我假设你将NSTimeInterval / double传入函数,导致警告。你应该改变你的
-(NSTimeInterval)getTimeInterval:(NSString*)timeStr 
获取NSTimerInterval的参数(这只是一种说法加倍的奇特方式)。如果你想传递一个时间的字符串表示并返回NSTimeInterval,你的代码中就会出现错误,并且应该将timeInterval变量更改为包含你的时间的字符串变量。     
这在很多方面都很奇怪。 我很确定NSTimeInterval只是double的typedef,这使得属性的定义被赋值为错误。删除它,看它是否有效。     

要回复问题请先登录注册