Wednesday 20 June 2012

ASIHTTPRequest Problem


This issue I had a lot of hard time to figure out why. The problem resides in ASIHTTPRequest itself (iOS), not the rails code.
To make a long story short, the problem is specific to the use of persistent connection for every request sent by ASIHTTPRequest.
While this is good for GET requests, most server implementation does not allow persistent connection to be used with POST request.
I didn't really have time to investigate it deeply on the server side of things but I think that the problem resides with the 100-Continue header that should be sent (and which isn't) with request that has body attached to it (hence PUT/POST). If you want to have a deeper look at what I'm talking about go have a read at the spec sheet: http://www.w3.org/Protocols/rfc2616/rfc2616-sec8.html
So the persistent connection used by ASIHTTPRequest wait for a 100 response to be sent, which is never sent. so it ends up being timed out.
A fix is to set persistentConnection to NO with your post requests like the following:

ASIHTTPRequest *req                     = [ASIHTTPRequest requestWithURL:url];
req.shouldAttemptPersistentConnection   = NO;

Monday 11 June 2012

Date Format Patterns

A date pattern is a string of characters, where specific strings of characters are replaced with date and time data from a calendar when formatting or used to generate data for a calendar when parsing. The following are the characters used in patterns to show the appropriate formats for a given locale.

http://unicode.org/reports/tr35/tr35-6.html#Date_Format_Patterns

Thursday 7 June 2012

Get Data From User Facebook Wall Post and Twitter Tweets

Get Data From User Facebook Wall Posts and Twitter Tweets

Twitter:
https://dev.twitter.com/docs/api/1/get/statuses/user_timeline
https://api.twitter.com/1/statuses/user_timeline.json?screen_name=zaintiger
https://api.twitter.com/1/statuses/user_timeline.json?screen_name=ISEE_Events

Facebook
http://stackoverflow.com/questions/6244693/using-app-access-token-in-ios
http://blog.awpny.com/kaiawpny/2011/how-to-facebook-access-token.html

https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id=121128207961282&client_secret=19f13a3ef1b80961f88f7bfd928ab0f3

https://graph.facebook.com/isee.Entertainment.and.Events
/posts?access_token=121128207961282|9QQBCRY8vflHgc11KIcWAbvRPRk