2015-09-14 38 views
2

步驟來重現錯誤:IOS Facebook登錄崩潰的取消按鈕

  1. 登錄與Facebook
  2. 輸入憑據
  3. 點擊取消按鈕從您的實現

相關的代碼片段: ~~~

NSLog(@"Your code goes here"); 
var manager = FBSDKLoginManager(); 


    manager.loginBehavior = FBSDKLoginBehavior.Web 

    manager.logInWithReadPermissions(
     ["public_profile","email" ], 
     handler: { 
      (result: FBSDKLoginManagerLoginResult!, error: NSError!) -> Void in 

      if ((error) != nil) 
      { 
       // Process error 
       println("error\(error)") 

      } 
      else if result.isCancelled { 
       // Handle cancellations 
       println("isCancelled\(result.isCancelled)") 


      } 
      else { 
       // If you ask for multiple permissions at once, you 
       // should check if specific permissions missing 
       if result.grantedPermissions.contains("email") 
       { 
        self.returnUserData() 
       } 
      } 


    }) 

~~~

SDK版本:V4.5.1

當我調試我收到以下錯誤

+[FBSDKInternalUtility unregisterTransientObject:]: 
    0x103ad7cb2 <+0>: pushq %rbp 
    0x103ad7cb3 <+1>: movq %rsp, %rbp 
    0x103ad7cb6 <+4>: pushq %r15 
    0x103ad7cb8 <+6>: pushq %r14 
    0x103ad7cba <+8>: pushq %r13 

0x103ad7cbc <+10>: pushq %r12 
0x103ad7cbe <+12>: pushq %rbx 
0x103ad7cbf <+13>: pushq %rax 
0x103ad7cc0 <+14>: movq %rdx, %rdi 
0x103ad7cc3 <+17>: callq *0x207d57(%rip)   ; (void *)0x0000000105e6e930: objc_retain 
0x103ad7cc9 <+23>: movq %rax, %r14 
0x103ad7ccc <+26>: movq 0x5375cd(%rip), %rdi  ; _transientObjects 
0x103ad7cd3 <+33>: movq 0x2f99ae(%rip), %rsi  ; "objectForKey:" 
0x103ad7cda <+40>: movq 0x207d2f(%rip), %r13  ; (void *)0x0000000105e71000: objc_msgSend 

    0x103ad7ce1 <+47>: movq %r14, %rdx 
    0x103ad7ce4 <+50>: callq *%r13 
    0x103ad7ce7 <+53>: movq %rax, %rdi 
    0x103ad7cea <+56>: callq 0x103c2e7e0    ; symbol stub for: objc_retainAutoreleasedReturnValue 
    0x103ad7cef <+61>: movq %rax, %rbx 
    0x103ad7cf2 <+64>: movq 0x2f9a3f(%rip), %rsi  ; "unsignedIntegerValue" 
    0x103ad7cf9 <+71>: movq %rbx, %rdi 
    0x103ad7cfc <+74>: callq *%r13 
    0x103ad7cff <+77>: movq %rax, %r15 

0x103ad7d02 <+80>: movq %rbx, %rdi 
0x103ad7d05 <+83>: callq *0x207d0d(%rip)   ; (void *)0x0000000105e6e9b0: objc_release 
0x103ad7d0b <+89>: testq %r15, %r15 
0x103ad7d0e <+92>: je  0x103ad7d74    ; <+194> at FBSDKInternalUtility.m:456 
0x103ad7d10 <+94>: cmpq $0x1, %r15 
0x103ad7d14 <+98>: jne 0x103ad7d2f    ; <+125> at FBSDKInternalUtility.m:454 
0x103ad7d16 <+100>: movq 0x537583(%rip), %rdi  ; _transientObjects 
0x103ad7d1d <+107>: movq 0x2f9184(%rip), %rsi  ; "removeObjectForKey:" 
0x103ad7d24 <+114>: movq %r14, %rdx 
0x103ad7d27 <+117>: callq *0x207ce3(%rip)   ; (void *)0x0000000105e71000: objc_msgSend 
0x103ad7d2d <+123>: jmp 0x103ad7d74    ; <+194> at FBSDKInternalUtility.m:456 
0x103ad7d2f <+125>: movq 0x53756a(%rip), %r12  ; _transientObjects 
0x103ad7d36 <+132>: movq 0x302fa3(%rip), %rdi  ; (void *)0x0000000105d0cb88: NSNumber 
0x103ad7d3d <+139>: decq %r15 
0x103ad7d40 <+142>: movq 0x2f92d9(%rip), %rsi  ; "numberWithUnsignedLong:" 
0x103ad7d47 <+149>: movq %r15, %rdx 
0x103ad7d4a <+152>: callq *%r13 
0x103ad7d4d <+155>: movq %rax, %rdi 
0x103ad7d50 <+158>: callq 0x103c2e7e0    ; symbol stub for: objc_retainAutoreleasedReturnValue 
0x103ad7d55 <+163>: movq %rax, %rbx 
0x103ad7d58 <+166>: movq 0x2f99e1(%rip), %rsi  ; "setObject:forKey:" 
0x103ad7d5f <+173>: movq %r12, %rdi 
0x103ad7d62 <+176>: movq %rbx, %rdx 
0x103ad7d65 <+179>: movq %r14, %rcx 
0x103ad7d68 <+182>: callq *%r13 
0x103ad7d6b <+185>: movq %rbx, %rdi 
0x103ad7d6e <+188>: callq *0x207ca4(%rip)   ; (void *)0x0000000105e6e9b0: objc_release 
0x103ad7d74 <+194>: movq %r14, %rdi 
0x103ad7d77 <+197>: addq $0x8, %rsp 
0x103ad7d7b <+201>: popq %rbx 
0x103ad7d7c <+202>: popq %r12 
0x103ad7d7e <+204>: popq %r13 
0x103ad7d80 <+206>: popq %r14 
0x103ad7d82 <+208>: popq %r15 
0x103ad7d84 <+210>: popq %rbp 
0x103ad7d85 <+211>: jmpq *0x207c8d(%rip)   ; (void *)0x0000000105e6e9b0: objc_release 
+1

什麼是錯誤日誌? –

+0

讓我給你 –

回答

1

我今天也目睹了這一墜毀我。在完全相同的地方,即[FBSDKInternalUtility unregisterTransientObject:]和執行完全相同的步驟(FB登錄 - >輸入憑據 - >取消按鈕 - >崩潰)之後。

似乎不僅會影響iOS Facebook SDK v4.5.1,還會影響v4.6和v4.1.0。

-1
@IBAction func btnFBLoginPressed(sender: AnyObject) { 
    let fbLoginManager : FBSDKLoginManager = FBSDKLoginManager() 

    fbLoginManager.logInWithPublishPermissions(["publish_actions"], fromViewController: self, handler: { (result, error) -> Void in 
     if (error == nil){ //--> From here I prevent that error 
      if result.isCancelled { 
       print("button is cancelled") 
      } else { 
       let fbloginresult : FBSDKLoginManagerLoginResult = result 
        if(fbloginresult.grantedPermissions.contains("publish_actions")){ 
        self.getFBUserData() 
       } 
      } 
     } 
    }) 
} 
func getFBUserData(){ 
    if((FBSDKAccessToken.currentAccessToken()) != nil){ 
     print(FBSDKAccessToken.currentAccessToken().tokenString) 
//   FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, first_name, last_name, picture.type(large), email"]).startWithCompletionHandler({ (connection, result, error) -> Void in 
//    if (error == nil){ 
//     print(result) 
//    } 
//   }) 
     } 
    } 
+0

請添加一些解釋。賦予基礎邏輯比賦予代碼更重要,因爲它可以幫助OP和其他讀者自己解決這個問題和類似的問題。 –