alexrothenberg / motion-addressbook

MIT License
89 stars 30 forks source link

OSX support #33

Closed jmay closed 11 years ago

jmay commented 11 years ago

Would be nice to have iOS/OSX support in a single gem, like BW.

But ABAddressBook has many differences between iOS & OSX, not sure how easy it will be to wrap them both in the same API.

jmay commented 11 years ago

This doesn't look too bad ... except that all the API calls are different :-( There appear to be OSX C counterparts to all the iOS function calls, but OSX also has a proper Obj-C OO layer which isn't available on iOS.

alexrothenberg commented 11 years ago

You're right apple does give us an ABAddressBook class on OSX. Layering ruby classes on top of it seems wrong unless the API is hard to use and needs to be wrapped.

I wonder what makes sense....

jmay commented 11 years ago

I'm going to copy BubbleWrap's convention for supporting iOS and OSX: separate ios and osx directories under motion, and platform-specific require blocks in lib/bubble-wrap/core.rb.

I'll duplicate person.rb etc. and we'll see how different things are under OSX.

jmay commented 11 years ago

Making excellent progress with this. Check out the osx-support branch on my fork if interested.

jmay commented 11 years ago

Gnar! Can't use same mechanism to figure out whether a Person has been saved or not. OSX assigns an id right away.

jmay commented 11 years ago

Another bother: if you have iCloud syncing enabled, then running the test suite triggers a bunch of system logging ... and I suspect is causing things to break because of the rapid record creation/deletion going on in the tests.

I might release this without thorough testing, for folks to play with. Maybe there's a way to run tests in a controlled environment - without trying to mock the entire AB framework.

alexrothenberg commented 11 years ago

Great work. Merged with pull #38.

Release in gem v1.5.0