FacebookImagePicker:用Swift编写的Facebook相册照片选择器
GBHFacebookImagePicker是Facebook用Swift编写的相册照片选择器,旨在提供一种将图片选择到Facebook帐户的简单方法。选取器提供一个简单的界面,类似于本机 iOS 照片选取器。
必要时,此选取器负责所有身份验证(来自网络或使用本机 Facebook 应用程序)。如果在登录期间不接受照片的权限,则选取器会提示另一个权限的请求。
截图/演示
特征
- [x] 使用 Facebook SDK 登录并显示用户的相册或标记的照片
- [x] 显示每个相册的图片
- [x] 处理被拒绝的Facebook照片许可
- [x] Multiple selection in one album
- [x] Select all
Example
In your terminal :
Or to run the example project manually, clone the repo, and run from the Example directory first.pod install
Don't forget to replace the current Facebook App's ID with your own in the plist file (Open as > Source code).
Like this :
Just in case, for public application (which can be use in the AppStore), you need to send your Facebook's App in review to have user's photos permission.
Usage
-
You need to set up your application correctly to work with Facebook : https://developers.facebook.com/docs/ios/getting-started and https://developers.facebook.com/docs/ios/ios9
-
Import the library :
- Then, implement the protocol :
GBHFacebookImagePickerDelegate
The imageModel contain :
- Display picker :
Customisation
You can apply some customisation. To do it you can use the FacebookPickerConfig structure.
Aditionals informations
- About tagged photos : the tagged photos are displayed in an album (hide by default, see customisation section to display it) with the name "Photos of You". You can change this default name in the settings. The tagged album's cover is the facebook account profile picture, which are retrieved with a special call to the graph API.
Translation
FacebookImagePicker is currently written in english. If you need translation for the permission popup (or whatever thing), just add this line in your localized file :
"Pictures" = "<your_translation>";
"Oups" = "<your_translation>";
"You need to allow photo's permission." = "<your_translation>";
"Allow" = "<your_translation>";
"Close" = "<your_translation>";
"Album(s)" = "<your_translation>";
"Photos of You" = "<your_translation>";
""No picture(s) in this album." = "<your_translation>";"
Requirements
- Xcode 11.4
- iOS 9.0+ target deployment
- FBSDKCoreKit, FBSDKLoginKit (>= 7.0 for the v5.0)
- Facebook Application, see usage for explaination
- Swift 3, 4, 4.2 or 5.1 project
Installation
FacebookImagePicker is available through CocoaPods.
To install it, simply add the following line to your Podfile:
Communication
- If you need help, open an issue.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request and read the contributing file.
Author
Florian Gabach, florian.gabach@gmail.com
License
FacebookImagePicker is available under the MIT license.
If your application use this picker consider to add the licence in your Credits/About section. You can use this library to do it.