FaceBook Connect for iPhone - Dev Garage Paris

1,775 views
1,720 views

Published on

Facebook Developer Garage workshop
How we integrated FB in friendspin.net iPhone application

http://www.facebook.com/event.php?eid=350205870642&index=1

Published in: Technology, News & Politics
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,775
On SlideShare
0
From Embeds
0
Number of Embeds
56
Actions
Shares
0
Downloads
20
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

FaceBook Connect for iPhone - Dev Garage Paris

  1. 1. Integrating Facebook Connect with an iPhone application Mik BRY - mikbry@aerolitec.com Facebook Developer Garage – Paris 2009 Intro <ul><li>Mik BRY aka mobile Gran Guuru
  2. 2. FriendsPin.net an iPhone App from Pschit.com
  3. 3. Easy with iPhone SDK
  4. 4. Send informations
  5. 5. Retreive informations
  6. 6. Connected with FB Web/Community
  7. 7. More to come </li></ul>
  8. 8. iPhone connect SDK Integrating Facebook Connect with an iPhone application Mik BRY - mikbry@aerolitec.com Facebook Developer Garage – Paris 2009 <ul><li>Drop the package in your project
  9. 9. Include your FB application ID
  10. 10. <10 lines of code
  11. 11. You are ready to sign up with your FB ID </li></ul>http://developers.facebook.com/connect.php?tab=iphone
  12. 12. #import &quot;FBConnect/FBConnect.h&quot; /////////////////////////////////////////////////////////////////////////////////////////////////// // This application will not work until you enter your Facebook application's API key here: static NSString* kApiKey = @&quot;xxxxxxxxxxxxxxx&quot; ; // Enter either your API secret or a callback URL (as described in documentation): static NSString* kApiSecret = @&quot;xxxxxxxxxxxxxxxxxxx&quot; ; // @&quot;<YOUR SECRET KEY>&quot;; static NSString* kGetSessionProxy = nil ; // @&quot;<YOUR SESSION CALLBACK)>&quot;; /////////////////////////////////////////////////////////////////////////////////////////////////// // FBSessionDelegate - ( void )session:( FBSession *)session didLogin:( FBUID )uid { DLog ( @&quot;FBsession&quot; ); if ( _session && session != _session ) { [ _session release ], _session = nil ; } if ( _session == nil ) { _session = [session retain ]; } NSString * fql = [ NSString stringWithFormat : @&quot;select uid,name,username,pic,pic_square,status from user where uid == %lld&quot; , session. uid ]; NSDictionary * params = [ NSDictionary dictionaryWithObject :fql forKey : @&quot;query&quot; ]; [[ FBRequest requestWithDelegate : self ] call : @&quot;facebook.fql.query&quot; params :params]; } /////////////////////////////////////////////////////////////////////////////////////////////////// // FBRequestDelegate - ( void )request:( FBRequest *)request didLoad:( id )result { … }
  13. 13. Send information <ul><li>You need extended permissions
  14. 14. Update your status
  15. 15. Send notification to friends
  16. 16. Upload photos </li></ul>Integrating Facebook Connect with an iPhone application Mik BRY - mikbry@aerolitec.com Facebook Developer Garage – Paris 2009
  17. 17. - ( void )updateFBStatus:( NSString *)status { // Need to check permission status_update NSDictionary *params = [ NSDictionary dictionaryWithObjectsAndKeys : status, @&quot;status&quot; , @&quot;true&quot; , @&quot;status_includes_verb&quot; , nil ]; [[ FBRequest requestWithDelegate : self ] call : @&quot;facebook.Users.setStatus&quot; params :params]; } - ( void )sendFBInvite:( NSString *)uid { NSString *notificationMessage = NSLocalizedString ( @&quot;Hi friend&quot; , nil ); NSDictionary *params = [ NSDictionary dictionaryWithObjectsAndKeys :uid, @&quot;to_ids&quot; ,notificationMessage, @&quot;notification&quot; , @&quot;user_to_user&quot; , @&quot;type&quot; , nil ]; [[ FBRequest requestWithDelegate : self ] call : @&quot;facebook.Notifications.send&quot; params :params]; }
  18. 18. Get informations <ul><li>Using FQL FacebookQueryLanguage
  19. 19. Your userlist Get information user's friends
  20. 20. Streams Using extended permissions
  21. 21. Everything you want </li></ul>Integrating Facebook Connect with an iPhone application Mik BRY - mikbry@aerolitec.com Facebook Developer Garage – Paris 2009 http://wiki.developers.facebook.com/index.php/FQL
  22. 22. -( void )getFBUsersList { if ([ FBFriends count ] == 0 ) { [ FBFriends release ], FBFriends = nil ; [ FBFriendsUID release ], FBFriendsUID = nil ; } if ( FBFriends || FBCommand == 1 ) return ; FBSession * fb = [ self getFBSession ]; NSString * fql = [ NSString stringWithFormat : @&quot;SELECT uid, name from user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=%lld)&quot; , fb. uid ]; NSDictionary * params = [ NSDictionary dictionaryWithObject :fql forKey : @&quot;query&quot; ]; [[ FBRequest requestWithDelegate : self ] call : @&quot;facebook.fql.query&quot; params :params]; }
  23. 23. Connected with FB web <ul><li>Your FB page is linked to your app
  24. 24. Get usage statistics
  25. 25. Some limitations in app
  26. 26. In app « be a fan » not possible
  27. 27. Application suggestion </li></ul>Integrating Facebook Connect with an iPhone application Mik BRY - mikbry@aerolitec.com Facebook Developer Garage – Paris 2009
  28. 28. More to come <ul><li>Unified API
  29. 29. Common mailbox
  30. 30. Better app suggestion, management
  31. 31. Questions? </li></ul>Integrating Facebook Connect with an iPhone application Mik BRY - mikbry@aerolitec.com Facebook Developer Garage – Paris 2009 http://wiki.developers.facebook.com/index.php/Developer_Roadmap [email_address]

×