iOS9 上 facebook sdk 4.6 中的 facebook 登录管理器中发送到实例的无法识别的选择器
unrecognized selector sent to instance at facebook login manager in facebook sdk 4.6 on iOS9
您好,我刚刚将我的应用程序升级到 iOS 9,并使用 Facebook 的最新 SDK(4.6 版)登录 Facebook。
我正在使用自定义登录按钮,因此也使用 LoginManager class。使用以前的版本它工作正常但现在我的应用程序在我按下登录按钮说 "unrecognized selector sent to instance"
时崩溃
下面是我在 GameScene class 中用于登录的代码。
var fbLogin = FBSDKLoginManager()
func onClickFBLogin(){
let vc = self.view?.window?.rootViewController
fbLogin.logInWithReadPermissions(["public_profile"] as [AnyObject], fromViewController: vc, handler: {(result:FBSDKLoginManagerLoginResult!, error:NSError!) -> Void in
if(error != nil){
print("Facebook login error \(error)")
} else if(result.isCancelled){
print("Facebook login cancelled")
} else{
print("facebook login successful")
if(self.isSaveMeButtonPressed){
print("facebook login successful")
}
}
})
}
应用程序在以下登录时崩溃 Xcode。
[FBSDKLoginManager logInWithReadPermissions:fromViewController:handler:]: unrecognized selector sent to instance 0x7f82e51251e0
有人面临同样的问题吗?或者谁能帮我解决这个问题?
提前致谢。
对于 iOS 9,您向 info.plist 添加了更多键。此错误可能与此有关。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
</dict>
</dict>
更新 Facebook SDK 时出现问题。似乎 Facebook 通过提供一个包文件改变了过去在 Documents 文件夹中安装 SDK 的方式,但现在它提供了一个不可安装的 zip 文件。因此,我只是替换了 ~\Documents\FacebookSDK 文件夹中的现有文件。在那之后,看起来 Xcode 采取了部分更新代码,有些仍然保持不变。
我从我的项目中删除了所有框架并重新添加了我们在 Xcode 中添加框架的常用方法。现在一切正常。
Facebook 应更新有关如何更新到更新的 SDK 的文档。
另一个可能的问题是从 CocoaPod 安装 facebook Pod。
从项目的 Podfile 中删除 pod,运行 pod install,您会看到从项目中删除了 facebook pod。
我使用他们网站上的 facebook SDK 并手动导入框架(并使用他们的说明完成 facebook SDK 集成)。
重新编译并再次 运行 您的应用...
这是我得到的完整错误:
Checklists[14748:612592] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBSDKLoginManager isAuthenticationURL:]: unrecognized selector sent to instance 0x6000002887f0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010999212b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010a55bf41 objc_exception_throw + 48
2 CoreFoundation 0x0000000109a13024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000109914f78 ___forwarding___ + 1432
4 CoreFoundation 0x0000000109914958 _CF_forwarding_prep_0 + 120
5 FBSDKCoreKit 0x00000001096e58b3 -[FBSDKApplicationDelegate openURLWithSafariViewController:sender:fromViewController:handler:] + 355
6 Checklists 0x0000000108b513ed -[FBSDKLoginManager(Native) performBrowserLogInWithParameters:handler:] + 654
7 Checklists 0x0000000108b50450 -[FBSDKLoginManager logInWithBehavior:] + 483
8 Checklists 0x0000000108b50250 -[FBSDKLoginManager logInWithPermissions:handler:] + 312
9 Checklists 0x0000000108b4ecde -[FBSDKLoginManager logInWithReadPermissions:fromViewController:handler:] + 280
10 Checklists 0x0000000108b4b757 -[FBSDKLoginButton _buttonPressed:] + 1662
11 UIKit 0x000000010b504972 -[UIApplication sendAction:to:from:forEvent:] + 83
12 UIKit 0x000000010b683c3c -[UIControl sendAction:to:forEvent:] + 67
13 UIKit 0x000000010b683f59 -[UIControl _sendActionsForEvents:withEvent:] + 450
14 UIKit 0x000000010b682e86 -[UIControl touchesEnded:withEvent:] + 618
15 UIKit 0x000000010b57a807 -[UIWindow _sendTouchesForEvent:] + 2807
16 UIKit 0x000000010b57bf2a -[UIWindow sendEvent:] + 4124
17 UIKit 0x000000010b51f365 -[UIApplication sendEvent:] + 352
18 UIKit 0x000000010be6ba1d __dispatchPreprocessedEventFromEventQueue + 2809
19 UIKit 0x000000010be6e672 __handleEventQueueInternal + 5957
20 CoreFoundation 0x0000000109935101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21 CoreFoundation 0x00000001099d4f71 __CFRunLoopDoSource0 + 81
22 CoreFoundation 0x0000000109919a19 __CFRunLoopDoSources0 + 185
23 CoreFoundation 0x0000000109918fff __CFRunLoopRun + 1279
24 CoreFoundation 0x0000000109918889 CFRunLoopRunSpecific + 409
25 GraphicsServices 0x0000000110ae99c6 GSEventRunModal + 62
26 UIKit 0x000000010b5035d6 UIApplicationMain + 159
27 Checklists 0x0000000108b49747 main + 55
28 libdyld.dylib 0x000000010e45dd81 start + 1
29 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
您好,我刚刚将我的应用程序升级到 iOS 9,并使用 Facebook 的最新 SDK(4.6 版)登录 Facebook。
我正在使用自定义登录按钮,因此也使用 LoginManager class。使用以前的版本它工作正常但现在我的应用程序在我按下登录按钮说 "unrecognized selector sent to instance"
时崩溃下面是我在 GameScene class 中用于登录的代码。
var fbLogin = FBSDKLoginManager()
func onClickFBLogin(){
let vc = self.view?.window?.rootViewController
fbLogin.logInWithReadPermissions(["public_profile"] as [AnyObject], fromViewController: vc, handler: {(result:FBSDKLoginManagerLoginResult!, error:NSError!) -> Void in
if(error != nil){
print("Facebook login error \(error)")
} else if(result.isCancelled){
print("Facebook login cancelled")
} else{
print("facebook login successful")
if(self.isSaveMeButtonPressed){
print("facebook login successful")
}
}
})
}
应用程序在以下登录时崩溃 Xcode。
[FBSDKLoginManager logInWithReadPermissions:fromViewController:handler:]: unrecognized selector sent to instance 0x7f82e51251e0
有人面临同样的问题吗?或者谁能帮我解决这个问题?
提前致谢。
对于 iOS 9,您向 info.plist 添加了更多键。此错误可能与此有关。
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>facebook.com</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>fbcdn.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
<key>akamaihd.net</key>
<dict>
<key>NSIncludesSubdomains</key> <true/>
<key>NSExceptionRequiresForwardSecrecy</key> <false/>
</dict>
</dict>
</dict>
更新 Facebook SDK 时出现问题。似乎 Facebook 通过提供一个包文件改变了过去在 Documents 文件夹中安装 SDK 的方式,但现在它提供了一个不可安装的 zip 文件。因此,我只是替换了 ~\Documents\FacebookSDK 文件夹中的现有文件。在那之后,看起来 Xcode 采取了部分更新代码,有些仍然保持不变。
我从我的项目中删除了所有框架并重新添加了我们在 Xcode 中添加框架的常用方法。现在一切正常。
Facebook 应更新有关如何更新到更新的 SDK 的文档。
另一个可能的问题是从 CocoaPod 安装 facebook Pod。 从项目的 Podfile 中删除 pod,运行 pod install,您会看到从项目中删除了 facebook pod。 我使用他们网站上的 facebook SDK 并手动导入框架(并使用他们的说明完成 facebook SDK 集成)。 重新编译并再次 运行 您的应用...
这是我得到的完整错误:
Checklists[14748:612592] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FBSDKLoginManager isAuthenticationURL:]: unrecognized selector sent to instance 0x6000002887f0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010999212b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010a55bf41 objc_exception_throw + 48
2 CoreFoundation 0x0000000109a13024 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000109914f78 ___forwarding___ + 1432
4 CoreFoundation 0x0000000109914958 _CF_forwarding_prep_0 + 120
5 FBSDKCoreKit 0x00000001096e58b3 -[FBSDKApplicationDelegate openURLWithSafariViewController:sender:fromViewController:handler:] + 355
6 Checklists 0x0000000108b513ed -[FBSDKLoginManager(Native) performBrowserLogInWithParameters:handler:] + 654
7 Checklists 0x0000000108b50450 -[FBSDKLoginManager logInWithBehavior:] + 483
8 Checklists 0x0000000108b50250 -[FBSDKLoginManager logInWithPermissions:handler:] + 312
9 Checklists 0x0000000108b4ecde -[FBSDKLoginManager logInWithReadPermissions:fromViewController:handler:] + 280
10 Checklists 0x0000000108b4b757 -[FBSDKLoginButton _buttonPressed:] + 1662
11 UIKit 0x000000010b504972 -[UIApplication sendAction:to:from:forEvent:] + 83
12 UIKit 0x000000010b683c3c -[UIControl sendAction:to:forEvent:] + 67
13 UIKit 0x000000010b683f59 -[UIControl _sendActionsForEvents:withEvent:] + 450
14 UIKit 0x000000010b682e86 -[UIControl touchesEnded:withEvent:] + 618
15 UIKit 0x000000010b57a807 -[UIWindow _sendTouchesForEvent:] + 2807
16 UIKit 0x000000010b57bf2a -[UIWindow sendEvent:] + 4124
17 UIKit 0x000000010b51f365 -[UIApplication sendEvent:] + 352
18 UIKit 0x000000010be6ba1d __dispatchPreprocessedEventFromEventQueue + 2809
19 UIKit 0x000000010be6e672 __handleEventQueueInternal + 5957
20 CoreFoundation 0x0000000109935101 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
21 CoreFoundation 0x00000001099d4f71 __CFRunLoopDoSource0 + 81
22 CoreFoundation 0x0000000109919a19 __CFRunLoopDoSources0 + 185
23 CoreFoundation 0x0000000109918fff __CFRunLoopRun + 1279
24 CoreFoundation 0x0000000109918889 CFRunLoopRunSpecific + 409
25 GraphicsServices 0x0000000110ae99c6 GSEventRunModal + 62
26 UIKit 0x000000010b5035d6 UIApplicationMain + 159
27 Checklists 0x0000000108b49747 main + 55
28 libdyld.dylib 0x000000010e45dd81 start + 1
29 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException