Git Product home page Git Product logo

szmichaelyb / facebookimagepicker-ios Goto Github PK

View Code? Open in Web Editor NEW

This project forked from oceanlabs/facebookimagepicker-ios

0.0 2.0 0.0 232 KB

A Facebook image picker providing a simple UI for a user to pick photos from a users Facebook account. It provides an image picker interface that matches the iOS SDK's UIImagePickerController.

Home Page: https://www.kite.ly

License: MIT License

Ruby 1.61% Objective-C 98.39%

facebookimagepicker-ios's Introduction

iOS Facebook Image Picker

A Facebook image picker providing a simple UI for a user to pick photos from a users Facebook account. It provides an image picker interface that matches the iOS SDK's UIImagePickerController.

It takes care of all authentication with Facebook as and when necessary. It will automatically renew auth tokens or prompt the user to re-authorize the app if needed.

Video Preview

Preview

Requirements

  • Xcode 6 and iOS SDK 7
  • iOS 7.0+ target deployment
  • FBSDKCoreKit, FBSDKLoginKit (>= 4.0)

Installation

CocoaPods

CocoaPods is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like the Kite Print SDK in your projects. If you're using it just add the following to your Podfile:

pod "FacebookImagePicker"

Usage

You need to have set up your application correctly to work with Facebook as per https://developers.facebook.com/docs/ios/getting-started

To launch the Facebook Image Picker:

#import <OLFacebookImagePickerController.h>

OLFacebookImagePickerController *picker = [[OLFacebookImagePickerController alloc] init];
picker.delegate = self;
[self presentViewController:picker animated:YES completion:nil];

Implement the OLFacebookImagePickerControllerDelegate protocol:

- (void)facebookImagePicker:(OLFacebookImagePickerController *)imagePicker didFinishPickingImages:(NSArray/*<OLFacebookImage>*/ *)images {
    [self dismissViewControllerAnimated:YES completion:nil];
    // do something with the OLFacebookImage image objects
}

- (void)facebookImagePickerDidCancelPickingImages:(OLFacebookImagePickerController *)imagePicker {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)facebookImagePicker:(OLFacebookImagePickerController *)imagePicker didFailWithError:(NSError *)error {
    // do something with the error such as display an alert to the user
}

App Transport Security

Xcode 7 and iOS 9 includes some new security features. In order to connect to Facebook you will need to add some more exceptions to your project's info plist file (in addition to the ones that your project might require). We need to add forward secrecy exceptions for Facebooks's CDNs. The following is what you need to copy your app's info plist, which includes anything that is needed by Kite as well:

	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSExceptionDomains</key>
		<dict>
			<key>akamaihd.net</key>
			<dict>
				<key>NSExceptionRequiresForwardSecrecy</key>
				<false/>
				<key>NSIncludesSubdomains</key>
				<true/>
			</dict>
			<key>facebook.com</key>
			<dict>
				<key>NSExceptionRequiresForwardSecrecy</key>
				<false/>
				<key>NSIncludesSubdomains</key>
				<true/>
			</dict>
			<key>fbcdn.net</key>
			<dict>
				<key>NSExceptionRequiresForwardSecrecy</key>
				<false/>
				<key>NSIncludesSubdomains</key>
				<true/>
			</dict>
		</dict>
	</dict>

Set maximum number of selections

Limit the number of assets to be picked.

- (BOOL)facebookImagePicker:(OLFacebookImagePickerController *)imagePicker shouldSelectImage:(OLFacebookImage *)image
{
    // Allow 10 assets to be picked
    return (imagePicker.selected.count < 10);
}

Sample Apps

The project is bundled with a Sample App to highlight the libraries usage. Alternatively you can see the library in action in the following iOS apps:

  • HuggleUp
  • Get in touch to list your app here

License

This project is available under the MIT license. See the LICENSE file for more info.

facebookimagepicker-ios's People

Contributors

dbotha avatar kkarayannis avatar jfradj avatar julien-c avatar

Watchers

Michael.Yang 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.