简体   繁体   中英

Upload Image to Facebook Objective-C

I'm currently trying to upload an image from my Mac application to Facebook. To do this, I'd like for the user to simply input his username and password, and to click a button.

The only issue is, Facebook doesn't actually have an API for the Mac, it only has one for iOS. This shouldn't be a problem, except for the fact that to login, you must use a web view, something I'm not to keen on doing, since I'd like the interface to be two simple text fields.

I've also looked into PHFacebook, a class I found online, but it also seems to utilize an NSWebView.

I'm wondering if there's a security issue when you use text fields; indeed, it's slightly strange no available API offers this function !

So, to conclude, is it possible, or is there an API, that lets you upload an image and lets you provide the user's credentials through simple NSStrings?

There's a Cocoa framework called MKAbeFook that lets you access Facebook APIs. I don't know if it's up to date, but you should give it a try.

您可以在Mac应用程序上通过JSON进行此操作,但我认为Facebook协议的工作方式只是提供要上传的图像,然后用户通过Webview登录其Facebook帐户并必须对其进行授权。

It looks like this is not supported unless you can embed a web browser.

If you scroll to the bottom of: facebook authentication docs , it seems to say this.

Embedding a web browser is generally doable, but may be overkill for what you are trying to do.

Good luck!

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