Giter Site home page Giter Site logo

jonathannorris / facebooksample Goto Github PK

View Code? Open in Web Editor NEW

This project forked from linox/facebooksample

0.0 2.0 0.0 823 KB

Facebook compose sheet view controller like in iOS 6.0

Home Page: http://www.developers-life.com/facebook-compose-view.html

Objective-C 100.00%

facebooksample's Introduction

This project based on https://github.com/doubleencore/DETweetComposeViewController

Facebook connection based on SDK 3.1 (last at 25 september 2012)

What is it? DEFacebookComposeViewController is an iOS 4 compatible. Looks like as the Facebook Sheet in iOS 6.

How to use

  1. download and setup Facebook sdk https://developers.facebook.com/ios/ or from git https://github.com/facebook/facebook-ios-sdk

  2. register your app on http://developers.facebook.com

  3. replace on your app id in plist file. FacebookAppID and in CFBundleURLTypes

  4. #import "DEFacebookComposeViewController.h"

  5. example of usage

 DEFacebookComposeViewControllerCompletionHandler completionHandler = ^(DEFacebookComposeViewControllerResult result) {
        switch (result) {
            case DEFacebookComposeViewControllerResultCancelled:
                NSLog(@"Facebook Result: Cancelled");
                break;
            case DEFacebookComposeViewControllerResultDone:
                NSLog(@"Facebook Result: Sent");
                break;
        }
        
        [self dismissModalViewControllerAnimated:YES];
    };
    
    DEFacebookComposeViewController *facebookViewComposer = [[DEFacebookComposeViewController alloc] init];
    self.modalPresentationStyle = UIModalPresentationCurrentContext;
    [facebookViewComposer setInitialText:@"Look on this"];
    [facebookViewComposer addImage:[UIImage imageNamed:@"1.jpg"]];
    facebookViewComposer.completionHandler = completionHandler;
    [self presentViewController:facebookViewComposer animated:YES completion:^{ }]; 
  1. add this code to your main class and you should be sure if app is entered to this method
- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {

    // attempt to extract a token from the url
    return [FBSession.activeSession handleOpenURL:url];
}

Post on my blog http://www.developers-life.com/facebook-compose-view.html Welcome for any questions

If you liked it, you can support me:

PayPal - The safer, easier way to pay online!

facebooksample's People

Contributors

chrux avatar jonathannorris avatar sakrist avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.