[英]How do I synchronously get the Facebook UID of the connected user in iOS?
I use iOS Facebook SDK 3.1. 我使用iOS Facebook SDK 3.1。 I am using FBSession's openActiveSessionWithReadPermissions:allowLoginUI:completionHandler: to connect the user to Facebook. 我正在使用FBSession的openActiveSessionWithReadPermissions:allowLoginUI:completionHandler:将用户连接到Facebook。 After the user is connected, is there way to synchronously get the logged in user's UID? 连接用户后,是否有办法同步获取已登录用户的UID? I am aware I can asynchronously get the UID with FBRequestConnection's startForMeWithCompletionHandler: , but the asynchronousness complicates my flow and the extra HTTP request seems wasted to get something as simple as the UID. 我知道我可以使用FBRequestConnection的startForMeWithCompletionHandler:异步获取UID,但是异步使我的流程复杂化,多余的HTTP请求似乎浪费了获取与UID一样简单的操作。
the asyncronousness complicates my flow 异步使我的流程复杂化
It's usually easier for the programmer to do things synchronously, but its usually better for the user to do things asynchronously. 对于程序员来说,同步执行通常比较容易 ,但是对于用户而言,异步执行通常会更好 。
the extra HTTP request seems wasted to get something as simple as the UID 多余的HTTP请求似乎浪费了一些像UID一样简单的东西
How long will that request take? 该请求将花费多长时间? 100 milliseconds? 100毫秒? 1 second? 1秒? 10 seconds? 10秒? Answer: you have no way of knowing how long it'll take, and it could easily be 10 seconds or more in some cases. 答:您无法知道需要多长时间,在某些情况下很容易会达到10秒或更长时间。 Do you really want to freeze your app for that long because you're too lazy to do things the right way? 您是否真的想冻结应用程序这么长时间,因为您懒得以正确的方式做事? What will your users think? 您的用户会怎么想? Do you care? 你关心?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.