Reputation: 4104
I seem to be able to start restkit just fine and load objects using the traditional loadobjectsatresourcepath: delegate: method. However, when I introduce the block:^{}, restkit crashes every time.
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/api/v1/places" delegate:self block:^(RKObjectLoader* loader) {
loader.objectMapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[Place class]];
}];
I get this in the log:
2012-05-12 19:07:32.266 App - [RKObjectManagerloadObjectsAtResourcePath:delegate:block:]: unrecognized selector sent to instance 0x3aa2e0
2012-05-12 19:07:32.268 App - *** Terminating app due to uncaught exception 'NSInvalidArgumentException',
reason: '-[RKObjectManager loadObjectsAtResourcePath:delegate:block:]: unrecognized selector sent to instance 0x3aa2e0'
Any thoughts on how to resolve this issue? THanks!
Upvotes: 0
Views: 363
Reputation: 6958
The exception tells you exactly what the problem is: RKObjectManager
does not respond to loadObjectsAtResourcePath:delegate:block:
. A quick glance at the API documentation reveals that the original method no longer exists in 0.10.0, and seems to have been replaced with loadObjectsAtResourcePath:usingBlock:.
You should be able to avoid the exception by using the new method:
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/api/v1/places" usingBlock:^(RKObjectLoader* loader) {
loader.objectMapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[Place class]];
}];
Upvotes: 1