简体   繁体   English

ios facebook登录在取消按钮上崩溃

[英]ios facebook login crash on cancel button

Steps to reproduce the bug:重现错误的步骤:

  1. Login with facebook用脸书登录
  2. enter credentials输入凭据
  3. Click on cancel button点击取消按钮

Relevant code snippets from your implementation: ~~~来自您的实现的相关代码片段:~~~

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 version: v4.5.1 SDK版本:v4.5.1

When i am debugging i am getting below error当我调试时出现以下错误

+[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

I've also witnessed this crash today.我今天也亲眼目睹了这次崩溃。 In the exactly same place, ie [FBSDKInternalUtility unregisterTransientObject:] and after executing exactly the same steps (FB login -> enter credentials -> Cancel button -> crash).在完全相同的地方,即 [FBSDKInternalUtility unregisterTransientObject:] 并在执行完全相同的步骤后(FB 登录 -> 输入凭据 -> 取消按钮 -> 崩溃)。

Seems to affect not only iOS Facebook SDK v4.5.1 but also v4.6 and v4.1.0.似乎不仅影响 iOS Facebook SDK v4.5.1,还影响 v4.6 和 v4.1.0。

@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)
//                }
//            })
      }
   }

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

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