简体   繁体   中英

Upload Facebook profile picture using FBSDKProfileExpressionKit - swift 3.0

I am using FBSDKProfileExpressionKit.framework.

I am trying to upload photo error is occurred.

invalid image cannot upload try again.

In ViewController.swift

override func viewDidLoad() {
        super.viewDidLoad()
        let data = UIImageJPEGRepresentation(uplodeImage.image!, 0)
        FBSDKProfileExpressionSharer.uploadProfilePicture(from: data! as Data, metadata: nil)
        FBSDKProfileExpressionSharer.wasLaunchedFromFacebook()
        print("set")
    }

In AppDelegate.swift

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
    FBSDKProfileExpressionURLHandler.parseIncomingURL(url)
    return true
   }

My question :-

can i upload profile picture to facebook?

You can't upload profile picture with Graph-Api.

You can upload profile picture withFBSDKProfileExpressionKit

You must have latest Facebook App and also check the image Size and Dimension

You can upload photo and video as follow

[FBSDKProfileExpressionSharer uploadProfilePictureFromData:videoData metadata:nil];

[FBSDKProfileExpressionSharer uploadProfilePictureFromUIImage:uiimage metadata:nil];

More info :- https://developers.facebook.com/docs/profile-expression-kit

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM