-
Notifications
You must be signed in to change notification settings - Fork 336
FBSDKApplicationDelegate in FacebookCore? #35
Comments
The native Swift class to get the same functionality is |
Gotcha |
No wait if it is ApplicationDelegate.. how swift recognize the ApplicationDelegate (ios native) and the ApplicationDelegate (FacebookCore) ? And I've tried and it doesn't work. |
Swift is using the type system and inferred module semantics. Hope it makes sense now ;) |
Also, as a hint - the call looks like this: ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions) and ApplicationDelegate.shared.application(application,
openURL: url,
sourceApplication: sourceApplication,
annotation: annotation) |
I tried return FacebookCore.ApplicationDelegate.shared.application(app, openURL: url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey]!) but return FBSDKApplicationDelegate.sharedInstance().application(app, openURL: url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as! String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey]) works.. |
Try the following: return FacebookCore.ApplicationDelegate.shared.application(app, openURL: url, sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String, annotation: options[UIApplicationOpenURLOptionsAnnotationKey] ?? []) Going to provide an implementation for a new method in a brief moment, since in case you are target iOS 9.0+ - the old one is deprecated. |
Let me know if the above method works for you with Swift SDK. |
This works for me:
|
Adding this to appDelegate fixed this issue for me (using fbsdk 4.19.0)
|
I got deprecated warning from Facebook SDK and this fixed it. 🤔
Tested on FBSDKCoreKit 4.20.0 |
@RajChanchal @AquilaSagitta @borisyurkevich |
@nlutsenko Could you clarify the latest AppDelegate functions for iOS 10? Thx. |
@savethedave following works fine in iOS 10:
|
Thx @RajChanchal you are correct. FWIW, I was following all guides and forum posts to the letter, but still having trouble. Then I reinstalled the SDK using Cocoapods instead of manual compiling, and it all worked fine. To be fair to FB, they do recommend using Cocoapods clearly in their docs, but other parts of the docs are obviously lacking, and probably wasting thousands of developer hours monthly - an unfortunate exception to the generally good docs FB has had in recent years. For reference to others having trouble, here's the relevant parts of my AppDelegate file that are working for me as of this date (iOS 10, SDK 0.2.0):
|
When
is called, do we also need to call :
? |
Should I remember y'all that the issue is closed and it's related to an older version? |
I'm still getting this issue with FacebookCore 0.7.0 func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if #available(iOS 9.0, *) {
return SDKApplicationDelegate.shared.application(app, open: url, options: options)
}
return false
} and if I rename it tells me
What is the current name? According to the docs it's |
Fixed it by changing my import from ExplanationAfter digging through the facebook sources I realized ObjC class has a macro to export the class as a different name to swift using NS_SWIFT_NAME(ApplicationDelegate)
@interface FBSDKApplicationDelegate : NSObject Same for AppEvents: NS_SWIFT_NAME(AppEvents)
@interface FBSDKAppEvents : NSObject Both are only referenced within Side note about
|
After the login and the permission agreement the web view is blank and the only button is "Done" which close and cancel the login. I followed the developer guide.
see update 1
see last update (2)
Found: Application delegate haven't the correct "openURL" methods..
The guide is incorrect when they don't say you have to write those two rows..
But what is the native library "AppDelegate"?
white web screen here
Update 1
The first problem (White screen) was solved by adding the application delegate method (Not mentioned in the guide)
The second problem is that with FBSDKApplicationDelegate works.. but with
ApplicationDelegate
(or if used into the ios application managerFacebookCore.ApplicationDelegate
) the application crash becauseUIApplicationOpenURLOptionsAnnotation
is nil.Update 2 and recap
The problem of the white web screen after accepting the permission agreement was solved adding the facebook app delegate.
The second problem of the applicationDelegate method has been solved by replacing the
FBSDKApplicationDelegate
in functionswith
FacebookCore.ApplicationDelegate
(that I hope it will be named FBApplicationDelegate) as it followThanks to @nlutsenko 👍
The text was updated successfully, but these errors were encountered: