小编Rom*_*man的帖子

FBSDKLoginManager.loginWithReadPermissions不在iOS上调用处理程序

简化,代码是这样的:

func login() {
     NSLog("Will login with read permissions")
     FBSDKLoginManager().logInWithReadPermissions(
            ["public_profile"],
            handler: {
                (result: FBSDKLoginManagerLoginResult!, error: NSError!) -> Void in
                    NSLog("Handler is called")
            })
     NSLog("Returning from login")
}
Run Code Online (Sandbox Code Playgroud)

调用它时,它会生成以下日志语句:

2015-05-25 11:35:07.886 MyApp[1213:646722] Will login with read permissions
2015-05-25 11:44:22.048 MyApp[1213:646722] Returning from login
Run Code Online (Sandbox Code Playgroud)

(上面的语句之间的大的时间差异是由于我使用调试器来逐步执行logInWithReadPermissions的内部.没有调试器的运行不会改变行为.)

我已经在安装了Facebook原生应用程序并且我已登录的设备上试过这个,我在没有本机应用程序的设备上试过这个,我从来没有访问过Facebook.我也在模拟器上试过这个.我得到了相同的结果.

我假设这是一个同步调用,但为了以防万一,我试着在调用线程中无限期地等待 - 处理程序仍然没有被调用,并且设备上没有任何可见的事情发生.

我打开了我能找到的所有日志记录:

FBSDKSettings.setLoggingBehavior(
   [FBSDKLoggingBehaviorAppEvents,
    FBSDKLoggingBehaviorInformational,
    FBSDKLoggingBehaviorAccessTokens,
    FBSDKLoggingBehaviorUIControlErrors,
    FBSDKLoggingBehaviorGraphAPIDebugWarning,
    FBSDKLoggingBehaviorGraphAPIDebugInfo,
    FBSDKLoggingBehaviorNetworkRequests,
    FBSDKLoggingBehaviorCacheErrors,
    FBSDKLoggingBehaviorDeveloperErrors])
Run Code Online (Sandbox Code Playgroud)

然后,在启动时,我得到这样的:

2015-05-25 11:35:01.320 MyApp[1213:646722] FBSDKLog: Request <#1111>:
  URL:  https://graph.facebook.com/v2.3
  Method:   POST
  UserAgent:    FBiOSSDK.4.1.0
  MIME: multipart/form-data; boundary=3i2ndDfv2rTHiSisAbouNdArYfORhtTPEefj3q2f
  Body (w/o attachments):   
    batch_app_id:   140xxxxxxxxxxxxx …
Run Code Online (Sandbox Code Playgroud)

facebook ios swift

3
推荐指数
1
解决办法
1538
查看次数

标签 统计

facebook ×1

ios ×1

swift ×1