mirror of
https://github.com/zhigang1992/RestKit.git
synced 2026-05-22 19:09:19 +08:00
Add helpful error message if you call requestMapping on an RKObjectMapping subclass
This commit is contained in:
@@ -115,8 +115,15 @@ static RKSourceToDesinationKeyTransformationBlock defaultSourceToDestinationKeyT
|
||||
return [[self alloc] initWithClass:objectClass];
|
||||
}
|
||||
|
||||
+ (instancetype)requestMapping
|
||||
+ (RKObjectMapping *)requestMapping
|
||||
{
|
||||
if (! [self isEqual:[RKObjectMapping class]]) {
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:[NSString stringWithFormat:@"`%@` is not meant to be invoked on `%@`. You probably want to invoke `[RKObjectMapping requestMapping]`.",
|
||||
NSStringFromSelector(_cmd),
|
||||
NSStringFromClass(self)]
|
||||
userInfo:nil];
|
||||
}
|
||||
return [self mappingForClass:[NSMutableDictionary class]];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user