> I have subclassed sqlitepersistenobjects for local storage and am
> using ObjectiveResource for remote interaction.
Oh good, I'm thrilled to hear that someone else is doing this as well.
This is the primary reason why we made ObjectiveResource a category
rather than a super class. We have an experimental project that
attempts to wed ObjectiveResource with a local ORM that we are calling
ObjectiveSync (http://github.com/yfactorial/objectivesync/tree/master).
We ran into some troubles with SQLitePersistentObjects and ended up
making some serious changes, so that's in there as well in the
"ObjectiveRecord" directory. If you want to have a look at
ObjectiveSync, that would be awesome since it hasn't been getting any
love recently.
> I ran into a snag with serializing NSNumber attributes for remote
> create and update calls. I have a number of attributes that I store
> as NSNumber's in float format, so they need to be accessed via
> floatValue and it seems like the standard serialization doesn't handle
> it.
It turns out that we (I, really) messed up NSNumber handling in the
ObjectiveResource 1.0 release. If you were to dig into the code with
the debugger, you would see that it only works because of
Objective-C's loose typing. We started to fix it for the 1.01 bugfix
release, but realized that the fix would change the API and the sample
code, so the fix has been pushed back to 1.1.
> I've writted a simple category for NSNumber based on those in the
> library which overrides the
> I just wanted to see if I was missing something or if you had intended
> that NSNumbers be supported in some other way. If not I can pass
> along the code for the NSNumber extension.
I thought that serialization was working with 1.0, but it's quite
possible that it's not. If you would be willing to post your changes
here, or create a ticket for them on lighthouse
(http://yfactorial.lighthouseapp.com/projects/18393-objectiveresource/tickets/new)
that would be much appreciated, and if it doesn't break any of the
unit tests (which I'm guessing it won't) it would be great to include
it in the 1.01 release.
We are getting ready to post the 1.01 bugfix release
(http://yfactorial.lighthouseapp.com/projects/18393-objectiveresource/tickets/bins/14713)
and after that we will be branching for work on 1.1
(http://yfactorial.lighthouseapp.com/projects/18393-objectiveresource/tickets/bins/14714).
The 1.1 release is going to include a number of changes that will
require changes to existing code. One of the first things we will fix
will be the NSNumber handling
(http://yfactorial.lighthouseapp.com/projects/18393-objectiveresource/tickets/44-update-sample-app-to-include-nsnumbers#ticket-44-3).
> Can I ask what kind of problems you were hitting with
> sqlitepersistenobjects?
> I am using an async queue to push local changes out our rails app in
> the background and I a little worried about the lack of thread safety
> in sqlitepersistenobjects.
> At the moment I am using the synchronized directive on the sqlite db
> object to try and keep the access thread safe, but it feels a little
> naive.
Thread safety is a big one. I also found the object cache to be
problematic from a memory management perspective.
The forked version that I've been using removes the object cache and
moves all database access to a single, synchronized method
(http://bit.ly/4C7EI). The fork unfortunately does away with
collection and association support, since I didn't need them, and it
made the other changes a lot easier to implement.
Josh