Comments (1)
We've attempted to use the Photos framework to obtain a PHAsset and it works. However, it requires manually creating the user interface, which is not our preference.
PHFetchOptions *options = [[PHFetchOptions alloc] init];
options.predicate = [NSPredicate predicateWithFormat:@"mediaType = %d", PHAssetMediaTypeVideo];
PHFetchResult *assetsFetchResult = [PHAsset fetchAssetsWithOptions:options];
[assetsFetchResult enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
PHAsset *asset = (PHAsset *)obj;
}];
We prefer to use PHPickerViewController. Unfortunately, it doesn't seem to work as expected. Instead of receiving a PHAsset type, we only obtained a file URL. The same error as mentioned below occurred: "FBSDKErrorDeveloperMessageKey=Must refer to an asset file".
PHPickerConfiguration *configuration = [[PHPickerConfiguration alloc] initWithPhotoLibrary:[PHPhotoLibrary sharedPhotoLibrary]];
configuration.selectionLimit = 1;
configuration.filter = [PHPickerFilter videosFilter];
PHPickerViewController *picker = [[PHPickerViewController alloc] initWithConfiguration:configuration];
if (@available(iOS 14, *)) {
picker.delegate = self;
} else {
// Fallback on earlier versions
}
[self presentViewController:picker animated:YES completion:nil];
//delegate
- (void)picker:(PHPickerViewController *)picker didFinishPicking:(NSArray<PHPickerResult *> *)results {
[picker dismissViewControllerAnimated:YES completion:nil];
for (PHPickerResult *result in results) {
if (@available(iOS 14, *)) {
NSItemProvider *itemProvider = result.itemProvider;
NSString *assetIdentifier = result.assetIdentifier;
[itemProvider loadFileRepresentationForTypeIdentifier:@"public.movie" completionHandler:^(NSURL * _Nullable url, NSError * _Nullable error) {
NSLog(@"Selected video URL: %@", url);
dispatch_async(dispatch_get_main_queue(), ^{
FBSDKShareVideo *vedio = [[FBSDKShareVideo alloc] initWithVideoURL:url previewPhoto:nil];
FBSDKShareVideoContent *vc = [[FBSDKShareVideoContent alloc] init];
vc.video = vedio;
FBSDKShareDialog *dialog = [FBSDKShareDialog dialogWithViewController:self withContent:vc delegate:self];
dialog.mode = FBSDKShareDialogModeNative;
[dialog show];
});
}];
} else {
// Fallback on earlier versions
}
}
}
from facebook-ios-sdk.
Related Issues (20)
- unity sdk 17.0.0 how date update ?
- App is live but only approved testers can login (using limited login on 17.0.0) HOT 16
- Limited Login Failed on iOS 17 HOT 2
- Facebook Login using SDK 17.0.0 always displays a limited login warning HOT 2
- Warning Issue with FBAudienceNetwork 6.15.0 Upgrade via Cocoapods HOT 4
- Get wrong first name from `Profile.current?.firstName`
- Multiple FBAudienceNetwork pod spec for the same version HOT 1
- Swift Package version 17.0.0 fails on Xcode 15.3
- SDK v17.0.0 may not get valid AccessToken immediately after call ApplicationDelegate didFinishLaunchingWithOptions
- v17.0.0 Invalid access tokenString HOT 10
- sdk17.0.0 iOS系统17以上 登录不了 token验证失败 HOT 3
- limited login auth token not refreshed when trackingPreference not explicitly passed in login config HOT 3
- AuthenticationToken.current == nil HOT 1
- Facebook Share Not Working HOT 6
- Facebook login is not working when appURLSchemeSuffix, appID, clientToken and displayName are defined dynamically for more than one Facebook login within one app
- Limited log in is failing with error: FBSDKErrorDeveloperMessageKey=Invalid ID token from login response.
- Shouldn't imageURL(forMode: , size: ) be available even in a limited login?
- Build failed because FacebookCore.swiftmodule is not built for arm64. Please try a run destination with a different architecture.
- After FBSDK 17.0.0, `[FBSDKLoginManager logInFromViewController]` always return login flow canceled HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-ios-sdk.