这是我用来从后端加载用户对象的代码:
[RKObjectManager managerWithBaseURL:[[NSURL alloc] initWithString:@"http://localhost:8080"]];
RKObjectMapping *userMapping = [RKObjectMapping mappingForClass:[User class]];
[userMapping mapKeyPath:@"id" toAttribute:@"id"];
[userMapping mapKeyPath:@"userName" toAttribute:@"userName"];
[userMapping mapKeyPath:@"firstName" toAttribute:@"firstName"];
[userMapping mapKeyPath:@"lastName" toAttribute:@"lastName"];
[userMapping mapKeyPath:@"email" toAttribute:@"email"];
[userMapping mapKeyPath:@"facebookId" toAttribute:@"facebookId"];
[userMapping mapKeyPath:@"twitterId" toAttribute:@"twitterId"];
[[RKObjectManager sharedManager].mappingProvider setObjectMapping:userMapping forResourcePathPattern:@"/users"];
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/users" delegate:self];
此代码运行没有问题,但没有请求到达服务器,也没有在客户端调用委托方法。
难道我做错了什么?
谢谢。