When using the Google Endpoints Technology, a method return type as well as the request body of an API request must be an entity type. I have 2 API methods: one of them returns an entity and expects an entity as input. The other does not expect any input but returns an entity. The one that expects no input works fine but I have failed to use the one that expects an input. I don't know how to provide the correct input to its associated function in objective c. As far as Google's datastore is concerned, the following is an example of an entity:
{"balance":1000.21,"num":100,"nickname":null,"is_vip":true,"name":"foo"}
With the above knowledge, I have the following code in my ios project:
GTLExGirlFriendEntity *userInput;
userInput=(GTLExGirlFriendEntity *)@{@"name":@"Run Away Bride"};
GTLQueryExGirlFriend *query = [GTLQueryExGirlFriend queryForExGirlFriendsGetExGirlFriendsWithObject:userInput];
[service executeQuery:query completionHandler:^(GTLServiceTicket *ticket, GTLExGirlFriendObjectCollection *object, NSError *error) {
//Some code in here, etc etc...
}];
When I run my project, I get the following error:
2015-04-10 14:26:49.546 exgirlfriend[65703:560200] -[__NSDictionaryI JSON]: unrecognized selector sent to instance 0x7fb8224bf7c0
2015-04-10 14:26:49.622 exgirlfriend[65703:560200] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryI JSON]: unrecognized selector sent to instance 0x7fb8224bf7c0'
*** First throw call stack:
( A bunch of data in here... )
The problem here is that my input is not being interpreted as an Entity or GTLExGirlFriendEntity. Does anyone know what I can do to solve this problem.
NOTE: The project works as expected if I only call the API method that expects no input.