Davis
Davis

Reputation: 317

Restkit: Assertion failure in -[RKObjectMappingProvider mappingForPatternMatchingString:context:]

I'm using restkit trying to serialize an object after I do a PUT request, and I'm getting the following error:

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot look up mapping matching nil pattern string.'

How can I fix this?

My serialization mapping is just an inverse mapping of the object mapping, and I know the object mapping works fine.

Upvotes: 0

Views: 249

Answers (2)

Peter Lapisu
Peter Lapisu

Reputation: 20975

i was getting this error when

[self.responseObjectManager loadObjectsAtResourcePath:nil usingBlock:^(RKObjectLoader * loader){}];

so changed it to

[self.responseObjectManager loadObjectsAtResourcePath:@"" usingBlock:^(RKObjectLoader * loader){}];

Upvotes: 0

Davis
Davis

Reputation: 317

I was modifying the loader's URL in the block of putObject:usingBlock: and I replaced it with a NSURL, not a RKURL like restkit was expecting.

It probably tried to assign the variable resourcePath based upon a property that RKURL has and NSURL lacks. resourcePath was then used as the pattern string, and was of course nil.

I'm still able to modify the loader's URL, but now that I assign it a RKURL everything works.

Upvotes: 1

Related Questions