Giter Club home page Giter Club logo

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 jfradj avatar julien-c avatar kkarayannis avatar samkaufman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

facebookimagepicker-ios's Issues

Swift3 version?

Great plugin hence would be great to have it working with swift 3!

PodSpec Bump

Hi,

Can someone with write access please bump the Facebook dependencies to 4.10 from 4.08. I'd prefer to use cocoapods rather than adding the code directly to my source code, and I can't do that as our app uses the latest facebook sdk 4.10.

Thanks!

Doesn't work on ios9

Hi, I've just updated to xcode 7 and ios 9. Library wasn't working so I installed latest update via cocoa pods. But problem persisted.
After sending request facebook app is not opening, but safari with facebook page instead. I'm giving permission and it gets back to the app. Then I'm getting following error:

NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802)

thrown right there:

id data = [result objectForKey:@"data"];
if (![data isKindOfClass:[NSArray class]]) {
     handler(nil, parsingError, nil);
     return;
}

Request: Hide logout button in navigation bar...

It would be great to have configuration to hide the logout button in the nav bar. I currently have the user login to Facebook in earlier flows of the app.

Thanks a lot for a great component!

Functionality ShouldPick

Hey OceanLabs,

great work, really much appreciated this.
I am using this in Swift2.1 though.

Can you quickly explain to me how to allow the user to just pick 1 Image each?
I'll get an error using the Should function.

FB SDK 4.8.0

Hi, can you update dependency for

FBSDKCoreKit
FBSDKLoginKit

to version 4.8.0 ?

Swift 2.0 and XCode 7: Use of undeclared type 'OLFacebookImagePickerControllerDelegate'

Hi,

I tried to implement your library in my project using swift 2.0 and XCode 7 but when I try to compile I get the following error message: "Use of undeclared type 'OLFacebookImagePickerControllerDelegate'".

I double checked my bridging header but everything seems to look fine, I use other libraries that are included in this header and to be sure I included every .h that I found:

#import <FacebookImagePicker/OLFacebookImagePickerController.h>
#import <FacebookImagePicker/OLFacebookAlbumRequest.h>
#import <FacebookImagePicker/OLFacebookPhotosForAlbumRequest.h>
#import <FacebookImagePicker/OLFacebookAlbum.h>
#import <FacebookImagePicker/OLFacebookImage.h>
#import <FacebookImagePicker/OLFacebookImagePickerController.h>

I included the library using cocapod (0.39.0.beta.4) using "use_frameworks!" flag and targeted iOS 8.0.
I tried to compile the application under the iPhone 6s simulator on iOS 8.0.

When I use "import FacebookImagePicker" it looks like everything is working but when the controller loads it shows me nothing except a black screen with a navigationBar titled "Photos" and a "done" button.

If I try to touch the button nothing happens ...

I specified that the controller that launch the pickerViewController has inherited from the OLFacebookImagePickerControllerDelegate and UINavigationControllerDelegate protocols and is set delegate of the pickerViewController.

I tried to print something in all the protocol's methods I could implement but nothing has showed up despite the fact that my user is logged in the app with facebook SDK 4.6.0

Do you have any idea of what is happening ? Did I make a mistake including the library ?

Thank you.

Single / Multi-select modes

Would be awesome if you could specify whether or not the user can or can't select multiple photos. Right now the default/only option is yes

Selected not updating picker UI

I'm writing an app that allows the user to select one Facebook image at a time using the picker. After each selection I want the selected image to reset to nil and the picker UI to update to reflect this. I am able to reset the selected images array, but the UI won't update, it continues to show the previously selected images. Has anyone else experienced this issue? Any solutions?

no multiple selection !

Is there a way to stop multiple selection from albums. Currently user can able to select multiple photos. Its not in requirement for me, so is there a direct way with your library to achieve this? If you didn't implemented such thing then also let me know, in which class and method I will able to stop it? I'll surely look by my self.

Thanks a ton for such a good work !! +1

Issue installing FacebookImagePicker using cocoapods

Hi guys,

I'm getting the following errors when adding FacebookImagePicker to my pods:
1. Include of non-modular header inside framework module 'FacebookSDK.FBAppLinkResolver'
2. Could not build module 'FacebookSDK'

Any idea what could be the problem?

Here are my cocoapods fyi:

  • Using FBSDKCoreKit (4.10.1)
  • Using FBSDKLoginKit (4.10.1)
  • Using FBSDKShareKit (4.10.1)
  • Using Facebook-iOS-SDK (3.23.2)
  • Using FacebookImagePicker (1.1.0)
  • Using SDWebImage (3.7.5)

Thanks in advance!

Getting duplicate symbols for arm64 while building in XCode

Hi,

I'm getting the following error while building in XCode 7.3.1 with CocoaPods 1.0.0:

6 duplicate symbols for architecture arm64

Error log:

ld: warning: directory not found for option '-L/Users/Tanay/Documents/PushNotificationTestWorkspace/UP-login-address-book-server-PHP/build/Debug-iphoneos'
ld: warning: directory not found for option '-F/Users/Tanay/Documents/PushNotificationTestWorkspace/UP-login-address-book-server-PHP/ultimatephone/Utilities/DSFacebookImagePicker'
duplicate symbol _kOLErrorDomainFacebookImagePicker in:
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookAlbumRequest.o)
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookImagePickerConstants.o)
duplicate symbol _kOLErrorCodeFacebookImagePickerNoOpenSession in:
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookAlbumRequest.o)
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookImagePickerConstants.o)
duplicate symbol _kOLErrorCodeFacebookImagePickerBadResponse in:
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookAlbumRequest.o)
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookImagePickerConstants.o)
duplicate symbol _kOLErrorDomainFacebookImagePicker in:
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookAlbumRequest.o)
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookPhotosForAlbumRequest.o)
duplicate symbol _kOLErrorCodeFacebookImagePickerNoOpenSession in:
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookAlbumRequest.o)
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookPhotosForAlbumRequest.o)
duplicate symbol _kOLErrorCodeFacebookImagePickerBadResponse in:
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookAlbumRequest.o)
/Users/Tanay/Library/Developer/Xcode/DerivedData/UltimatePhone-fevdobpimbjbiiazgoeyetpzjdvn/Build/Products/Debug-iphoneos/FacebookImagePicker/libFacebookImagePicker.a(OLFacebookPhotosForAlbumRequest.o)
ld: 6 duplicate symbols for architecture arm64

CocoaPods could not find compatible versions for pod "FBSDKCoreKit":

I'm trying to add FacebookImagePicker-iOS to my project using cocoapods. Here's my podfile:

use_frameworks!
pod "FacebookImagePicker"
  pod 'Parse'
  pod 'AWSCognito'
  pod 'AWSS3'
  pod 'FBSDKCoreKit'
  pod 'MBProgressHUD', '~> 1.1.0'
  pod 'Kite-Print-SDK'
  pod 'PayPal-iOS-SDK/Core', '~> 2.18.0'
  pod 'Stripe'

But Cocoapods is print this error when I try to install:

[!] CocoaPods could not find compatible versions for pod "FBSDKCoreKit":
  In snapshot (Podfile.lock):
    FBSDKCoreKit (= 4.20.2)

  In Podfile:
    FBSDKCoreKit

    FacebookImagePicker was resolved to 2.0.6, which depends on
      FBSDKCoreKit (~> 4.6.0)

CocoaPods could not find compatible versions for pod "SDWebImage":
  In snapshot (Podfile.lock):
    SDWebImage (= 4.4.6, ~> 4.4.0)

  In Podfile:
    FacebookImagePicker was resolved to 1.1.0, which depends on
      SDWebImage (~> 3.7.2)

    Kite-Print-SDK was resolved to 8.0.1, which depends on
      Photobook (~> 2.0.0) was resolved to 2.0.1, which depends on
        SDWebImage (~> 4.4.0)

Any help appreciated. Thanks

Picker shows only black background

Hi, I've added your library via cocoa pods to my swift project like this:

use_frameworks!
pod 'FacebookImagePicker'
post_install do |installer|
  installer.pods_project.build_configuration_list.build_configurations.each do |configuration|
    configuration.build_settings['CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES'] = 'YES'
  end
end

Then I simply import module:

import FacebookImagePicker

and then show the picker:

var picker = OLFacebookImagePickerController()
self.presentViewController(picker, animated: true, completion: nil)

First facebook app (or safari with facebook page if app is not present) starts, asks for permission (I use test accounts), comes back to app and this is what I see:

ios simulator screen shot 31 sie 2015 23 21 37

ofc I have some photos added on this user.

Add allowsEditing method

Is it possible to implement an allowsEditing method similar to the native UIImagePickerControllor one?

I basically try to crop the fb image to a square when importing and allowing the user to edit it itself.

Bizzarre linker errors if integrated in project without cocoa pods (old fashioned way)

@dbotha My requirement is to display the chosen image in fullscreen so that the user could further confirm the selected image or cancel it (like the native image picker in iOS). I removed the pod for FacebookImagePicker-iOS from my project and tried to add it manually (added other depends including Facebook SDK and SDWebImage through pods), but doing so generates 6-7 duplicate symbol linker errors for all the constants defined in OLFacebookImagePickerConstants.h. Googled it, tried all the possible ways but can't get rid of errors.

Could you please help in this regard?

OLFacebookImage data

Hi,

First of all thank you for a great picker!
Looks like the source field that is used for fullURL is deprecated.
It would also be nice to retrieve the photo id.

Thanks!

Pressing Done on Album Screen

If you press done before going into any albums, when the view controller is initially presented, you'll get an index out of bounds FATAL error.

*** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 0 beyond bounds for empty NSArray'

Facebook callback not being called - RESOLVED

When I use the library i get a message saying that I ahve already authorized the app, and then when i click okay, it goes immediately dismisses the photo picker view, and I can never get too it.

Also the HuggleUp App doesn't seem to show up images on the picker view, its just empty. After dismissing the empry picker view by clicking 'Done' it crashes. I am using an iPhone 6S with iOS 9.1

Large Resolution Facebook Image

How do you get a higher resolution image from Facebook? I tried changing this line to get the larger image size from the Facebook Graph

   - (void)getPhotos:(OLFacebookPhotosForAlbumRequestHandler)handler {
        if ([FBSDKAccessToken currentAccessToken]) {
            // connection is open, perform the request
            [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
            NSString *graphPath = [NSString stringWithFormat:@"%@/photos?fields=picture.type(large),source,images&limit=100", self.album.albumId];

Also Tried

    NSString *graphPath = [NSString stringWithFormat:@"%@/photos?fields=picture?type=large,source,images&limit=100", self.album.albumId];

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.