UA-17470720-3

Jump to content


Photo
- - - - -

STV+WebServices


  • Please log in to reply
9 replies to this topic

#1 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 28 November 2012 - 02:03 AM

Hello there,

Could you please add a delegate method (or section actions) to catch the event of a network failure ? ex "section.didNotFetchedItems".


Thanks
Aris

#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 28 November 2012 - 06:53 PM

Thank you Aris for the great idea! :) Will do with the very next release.
  • Aris Kox likes this

#3 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 30 November 2012 - 03:42 AM

Since you liked my idea, here's one more.

Expose the "webServiceClient" property of the data store, so that we can register our own clients (AFNetworking subclasses) ;-)

What I'm doing now is:


SCWebServiceStore *store = (SCWebServiceStore *)mySection.dataStore;
[store performSelector:@selector(setWebServiceClient:) withObject:[MyHTTPClient sharedClient]];

#4 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 30 November 2012 - 03:45 AM

We could also register our custom JSON deserializer.

So that we can have custom objects instead of NSDictionary objects !

#5 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 30 November 2012 - 04:19 AM

And another great idea would be to automatically reflect any change made in SCArrayOfItems sections & subclasses to the tableView.

check this question
http://sensiblecocoa...-with-new-data/

#6 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 01 December 2012 - 03:02 AM

You could also add a flag in section or datastore to indicate when the store is asynchronously fetching the data. ex BOOL sourceIsUpdating.

This is useful to avoid reloading a table when it is already loading its data

Edited by Aris Kox, 01 December 2012 - 03:02 AM.


#7 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 03 December 2012 - 12:17 PM

Hi Aris,

Thanks again for all your interesting ideas :)

Since you liked my idea, here's one more.

Expose the "webServiceClient" property of the data store, so that we can register our own clients (AFNetworking subclasses) ;-)


I am not sure it's wise for us to do that, as me might decide at anytime to not use AFNetworking, or even implement our own networking under layer. For this reason, we completely encapsulated all AFNetworking internal plumbing. Having said that, here are two options that you might consider:
  • Subclass SCWebServiceStore yourself and expose whatever you wish there. This will only work as long as STV keeps using AFNetworking internally.
  • Let us know of what you need to do exactly and we'll try to figure out a way in an abstract way without exposing any of the internal networking plumbing.
Hope this helps.

#8 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 05 December 2012 - 12:04 AM

Hi Tarek,

I Initially wanted register my own client so that I could catch network errors and/or implement off-line caching with the web service. However, your approach, subclassing the entire store, is more convenient.

BTW, Do you have any thoughts on reply #5 ?

#9 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 06 December 2012 - 11:38 AM

BTW, Do you have any thoughts on reply #5 ?


There are many reasons why we don't have STV automatically update the UI when the underlying data changes by means other than STV or the end-user:
  • You may be doing batch changes to underlaying data, in which case automatically updating the UI on each change would be extremely inefficient, and it's much better to do the UI updates in batches.
  • You might need to update the data using a certain animation that STV has no way of knowing.
  • Some users bind STV tables to huge amounts of data with complex and deep structures. Providing KVO (key-value-observing) for all these structures can have a big performance impact. We have no concerete data yet on the exact performance hit per each iOS device though.
Having said all the above, we will still study providing a certain 'mode' for STV where you can turn on to have it do automatic UI updates. Thank you very much for all your input.

#10 Aris Kox

Aris Kox

    Sr. Member

  • STV 5.0 Pro
  • PipPipPip
  • 35 posts
Reputation: 14
Good

Posted 06 December 2012 - 12:30 PM

I agree 100% with what you say.

In addition, you could clarify this issue in the documentation and provide some examples on how to update (insert/delete/update) SCArrayOfItems with animations.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users