我在这里有这个NSArray方法:
-(NSArray*)User:(NSString *)user andPassWordExists:(NSString *)password
但我不再需要返回数组,只是是或否,我如何将此方法更改为BOOL方法?
-(BOOL*)User:(NSString *)user Password:(NSString *)password
上面的代码给了我这个错误:
Conflicting return type in implementation of User:Password: NSArray vs BOOL
如何将此方法更改为bool?
答案 0 :(得分:2)
签名应为
-(BOOL)User:(NSString *)user Password:(NSString *)password
在标题和源文件中。
答案 1 :(得分:0)
struct CheckinUser {
bool user:YES;
bool pwd:YES;
};
typedef struct CheckinUser CheckinUser;
-(CheckinUser)User:(NSString *)user Password:(NSString *)password
{
CheckinUser result;
result.user = YES;
result.pwd = NO;
return result;
}