简体   繁体   English

iOS中的Facebook访问令牌

[英]Facebook access token in iOS

Which is the right approach to get access token for Facebook in iOS app? 在iOS应用中为Facebook获取访问令牌的正确方法是哪种?

  1. Using Facebook app 使用Facebook应用
  2. Using safari 使用野生动物园
  3. USing inline dialog 使用内联对话框

In case you are using the Facebook api for iOS you need only ask it to authorize. 如果您使用iOS的Facebook api,则只需要求它进行授权即可。 It will actually check if your device support multitasking. 它实际上会检查您的设备是否支持多任务。 If so, it will first try to use Facebook app. 如果是这样,它将首先尝试使用Facebook应用程序。 If it will fall(as the app might be not installed on that device after all), it will proceed to safari. 如果它掉了(因为该应用程序可能根本未安装在该设备上),它将继续进行野生动物园。 And if you are on non-multitasking device it will open an inline dialog popup. 如果您使用的是非多任务设备,它将打开一个内联对话框弹出窗口。
Just use the last version and that's it! 只需使用最新版本即可!

it's done automatically 它是自动完成的

it used to be that facebook authentication would always open a uiwebview to opt the user to enter his credentials. 过去,facebook身份验证总是会打开uiwebview来选择用户输入其凭据。

But now - if your ios version supports multitasking - it will open the facebook app or safari if possible and ask for authorization and then redirect back to your application. 但是现在-如果您的ios版本支持多任务处理-它将在可能的情况下打开facebook应用或野生动物园并请求授权,然后重定向回您的应用。 for more information you should refer to the sample application of the facebook sdk. 有关更多信息,请参考facebook sdk的示例应用程序。

So it will try 1 then 2 and then fallback to 3 因此它将尝试1再2,然后回退到3

https://github.com/facebook/facebook-ios-sdk https://github.com/facebook/facebook-ios-sdk

我认为更好的方法是使用UIWebView或ASIHTTPRequest

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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