Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

I was incorrectly initializing GTLExGirlFriendEntity; GTLExGirlFriendEntity is an object that contains properties that must be set; some of those properties are themselves objects that contain properties that must be set; etc etc...

A little background: These objects and the files within which they exist were created for me after I compiled an iOS Client library generator and then used it to generate my iOS Client library. I did not take the time to look at all the objects and understand how they work because they're many. Had I done so, I wouldn't have had the problem I was having. Anyway, I've made the necessary changes and everything is now working as expected.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.