Zuckermo
A RubyMotion wrapper for Facebook.
Hat Tip to clayallsopp/twittermotion for inspiration
Usage
Setup
Facebook.app_id = 'xxxxxxxxx'
Note you must configure your app_id
to one registered with facebook, you must also
set this app to allow iOS sign in and set your bundle id (e.g. com.company.appname).
Sign in
Facebook.sign_in permissions, audience do |granted, ns_error|
# have fun
end
You must supply permissions, we ask for ['email']
by default, which is the most basic
level of permissions we can ask for (facebook refers to this as basic info). Audience is
required for certain permissions (see the Facebook framework for details of these).
Accounts
> Facebook.accounts
=> [#<Facebook::User>]
> Facebook.accounts[0].username
=> "name@example.com"
iOS 5
You can include this gem when targeting iOS5, but when actuallt running on iOS 5 the
facebook functionality will return []
for accounts, and sign_in
will return an error.
You can check if we support the current os with Facebook.supported?
at any time.
This is because of the lack of the Facebook framework, I'd happily accept a PR to use a polyfill ;)
Installation
-
gem install zuckermo
-
Add
require 'zuckermo'
to yourRakefile
Contributing
It would be really cool if this was a fully-compatible Facebook API wrapper, so add whatever functionality you think helps!
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request