Showing posts with label facebook. Show all posts
Showing posts with label facebook. Show all posts

Thursday, September 20, 2012

Social.framework

It feels like an eternity since it was announced but iOS 6 is finally available to the masses, and we can now talk about the all the (few) new goodies that it contains.
Apple included the Social Framework in iOS 6 as an abstraction layer for accessing the various social services that are now included with iOS. The key feature here is that you never have to deal with the Facebook SDK again if you wish...
So let's explore how you can use the new Social framework classes to replace REST API access functionality that is provided via the Official Facebook SDK
TL;DR; Sample code

Create an ACAccountStore

According to Apple's developer documentation the ACAccountStore
[ACAccountStore] provides an interface for accessing, manipulating, and storing accounts. To create and retrieve accounts from the Accounts database, you must create an ACAccountStore object. Each ACAccount object belongs to a single ACAccountStore object.
A simple alloc && init sent to ACAccountStore will suffice. Perhaps the easiest thing you'll do this week.

Get the Facebook ACAccountType

The 2nd easiest thing you'll do this week

Request access to currently logged in Facebook User

Before the callback block is called the User will be presented with a UI to confirm that they want your app to have permission to access this API. In the event that initial permission has been revoked, or disabled you will be given a negative boolean value.

Select an authenticated ACAccount

Your block will need to reference your ACAccountStore instance in order to see which accounts you have access to. To actually access the accounts you need to call the accountsWithAccountType: method which returns a NSArray of ACAccount objects. Where the type argument is account type we got in the previous section.
Apple has designed the ACAccountStore class to support multiple authorised user accounts. While iOS 6 only supports a single Facebook account, it does support multiple Twitter accounts. So while it is safe to assume that first (and only entry) in this collection is the ACAccount you want to use, the same cannot be said when you are working with Twitter accounts. Ideally you would want to present a 'picker' UI to the end user.

Construct a SLRequest

SLRequest is the Social frameworks NSURL request abstraction to enable it to support request signing, and token passing, features used by Twitter and Facebook. The SLRequest class also has a convenience method for dispatching this request.
If you are a fan of request queuing, and application wide request management there is also the option to extract a prepared NSURLRequest object with you can then pass to something like an AFNetworking request operation (See below).


That's it! If you weren't able to string the process together in your head magically, you can view the entire gist. Thanks for reading!

Friday, June 26, 2009

Ah, the sixties


This program made me wonder what is the big thing of our generation. Yes i know that we have the internet, but is that all we get? Might sound greedy but if you think back to the sixties they had colour TV, Jet Airplanes, moon landings etc. Is the current parallel Twitter and Facebook?

As great as the internet revolution is, i hope for something bigger. Sure my pre (When Palm holla's at me) will have wireless charging, but where my lasers, and hover boards!

Granted i went to Shanghai, and didn't ride a maglev train, but that is a trial, and show of chinese showmanship like this, and this, rather than an actual technological revolution, at least in my opinion.

Saturday, June 21, 2008

Facebook Chat

This started as a long post, but as i am learning actions speak louder than words

Sunday, June 03, 2007

Reverse Engineering: Facebook poking

Since i declared Poking war on all my facebook friends, i've been thinking of doing some R & D. So i'm developing a Greasemonkey Script that would enable me to reply to all the pokes simultaneously.

Well thus far, heres what i've discovered.

A poking request is made by sending the user id of the person you wish to poke to a php page.

http://(networkName).facebook.com/ajax/poke.php?id=(userID)

with this request, goes a cookie with your login credentials.


Host: solent.facebook.com

User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.1) Gecko/20061223 Firefox/2.0.0.1

Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5

Accept-Language: en-us,en;q=0.5

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Proxy-Connection: keep-alive

Content-Type: application/x-www-form-urlencoded

Referer: http://solent.facebook.com/profile.php?id=511999790

Content-Length: 70

Cookie: login=[Login credentials etc. Need to workout the encoding on these]

Pragma: no-cache

Cache-Control: no-cache

As you can see i did this on my mac, using Firefox to take advantage of firebug. If you drop in the refer url it will take you that persons profile page, i imagine that this is also checked to stop spam bots, however i plan to fake the refers in the application, so that shouldn't be a problem.

Therefore in essence to automate the process, all you need to do is create an array of the users that you wish to poke, and loop though them sending your credentials each time to ensure that it is accepted by the server.

While i was poking around i also discovered that FB uses a modified version of Apache 1.3.37 (they suffix it with "fb1"). Whether this is an edit to the string, or actual modification, who knows?

Anyways, when i stop working 7 days a week, or going to bed at 2:15 am, i'll but together a small java app to take advantage of this.

Now if you think this is a lot of work, it isn't really, i got a http request class already built and fully functioning thanks to my work on isolation. So just gotta reverse engineer some more, and apply this concept.

Let the poking war continue!


Quote of the Day

Caption

Monday, May 28, 2007

Because i have time

Remember that facebook widget i spoke of?

Well it's actually in the oven, now and should be ready soon-ish, just have to work out how to communicate with the REST API that facebook uses, and i'm quids in.

Heres a screenshot of it running live in safari, and i built it based on a dashcode generate file, rather than actually using dashcode. Always more fun getting your hands dirty.

Friday, March 30, 2007

Latest Project: Facebook Widget

To help me with my face book addiction, i've decided to make a dashboard widget, strangely enough it's for the said website, facebook. A bit more useful than the search widget that currently resides on the internet, and a lot more simple than the famed Isolation project.

After 20 minutes in photoshop here it is


ETA, is about a week i hope, besides how hard can it be ...

As i see it have to translate part of the current offical Java API to Javascript, and parse some xml. Thats the hardest part, the actual widget design should be simple. Development starts in about week, after the java work is done. ^_^

But i think i've announced too much vapourware so i need to start delivering

I'm off to bed, some of us have to work you know.

Wednesday, March 28, 2007

Facebook is the nuts!

Get one, i love it.

I've got in contact with people from my primary school
One of my cousins
Couple people from secondary school

Basically for someone enjoys "trying" to be social, it's amazing.

Quote of the Day
"I'm sorry charile murphy, it was an accident i'm having too much fun."

Dave Chappelle