BluesZhang / gdata-objectivec-client

Automatically exported from code.google.com/p/gdata-objectivec-client
Other
0 stars 0 forks source link

Synchronous API #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The APIs are designed to work asynchroneously using delegates.

This can be an issue in some cases. (for GUI-less daemons especially)

There needs to be an API for this. (which works better than waitForTicket: 
which is polling events 
every 1/1000s)

Original issue reported on code.google.com by brun...@gmail.com on 13 Jan 2008 at 4:21

GoogleCodeExporter commented 9 years ago
Any tool can use NSRunLoop's -currentRunLoop and -runUntilDate to make the async
callbacks work. No user interface is necessary.

All of the GDataObject data classes can be used independently of the 
GDataService
classes as well.

waitForTicket: doesn't poll for events; it polls for completion of the ticket. 
Events happen asynchronously.

Original comment by gregrobbins on 13 Jan 2008 at 5:22

GoogleCodeExporter commented 9 years ago
So, please don't deprecate waitForTicket: in future releases, as it is useful.

I however think that it would be better if the GData API could provide 
synchronous methods (using NSURLConnection's convenience class method, 
sendSynchronousRequest:returningResponse:error:, to load a 
URL request synchronously, for example)

This would also make GData/ObjC more inline with the API provided by other 
languages (I haven't checked all, 
but Python and Java are in this case it seems).
I think it's much easier (and cleaner) to type something like    
CalendarFeed resultFeed = service.getFeed(feedUrl, CalendarFeed.class);
or
feed = self.cal_client.GetAllCalendarsFeed()
than what is currently required by GData/ObjC what async download isn't 
needed/wanted.

Original comment by brun...@gmail.com on 13 Jan 2008 at 7:08

GoogleCodeExporter commented 9 years ago
I wrote a synchronous wrapper using NSRunLoop.  Some convenience methods aren't 
necessary, but they would be nice.

Original comment by lem...@gmail.com on 31 Jan 2010 at 2:03

GoogleCodeExporter commented 9 years ago
Hi Lem, Could you provide your code for the sync wrapper?

Original comment by smith....@gmail.com on 8 Jul 2011 at 3:43

GoogleCodeExporter commented 9 years ago
The library does include waitForTicket: and waitForCompletionWithTimeout: 
methods for use by unit tests and UI-less tools, so there's no need for a 
wrapper.

Synchronous http fetches are sufficient reason for apps to be rejected from 
Apple's app stores. 

Original comment by grobb...@google.com on 8 Jul 2011 at 8:33