Steps to reproduce the bug:
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
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).
Seems to affect not only iOS Facebook SDK v4.5.1 but also v4.6 and 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)
// }
// })
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.