Skip to content

Commit e6aacbd

Browse files
authored
update facebook setup code (#594)
1 parent 07a38e7 commit e6aacbd

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

_includes/ios/users.md

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -518,12 +518,18 @@ There's also two code changes you'll need to make. First, add the following to y
518518
```
519519
```swift
520520
import FBSDKCoreKit
521-
import ParseFacebookUtilsV4
521+
import Parse
522522

523523
// AppDelegate.swift
524-
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
525-
Parse.setApplicationId("parseAppId", clientKey:"parseClientKey")
526-
PFFacebookUtils.initializeFacebookWithApplicationLaunchOptions(launchOptions)
524+
func application(application: UIApplicatiofunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
525+
// Initialize Parse.
526+
let parseConfig = ParseClientConfiguration {
527+
$0.applicationId = "parseAppId"
528+
$0.clientKey = "parseClientKey"
529+
$0.server = "parseServerUrlString"
530+
}
531+
Parse.initialize(with: parseConfig)
532+
PFFacebookUtils.initializeFacebook(applicationLaunchOptions: launchOptions)
527533
}
528534
```
529535
</div>
@@ -547,18 +553,30 @@ Next, add the following handlers in your app delegate.
547553
}
548554
```
549555
```swift
550-
func application(application: UIApplication,
551-
openURL url: NSURL,
552-
sourceApplication: String?,
553-
annotation: AnyObject?) -> Bool {
554-
return FBSDKApplicationDelegate.sharedInstance().application(application,
555-
openURL: url,
556-
sourceApplication: sourceApplication,
557-
annotation: annotation)
556+
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
557+
558+
return FBSDKApplicationDelegate.sharedInstance().application(
559+
application,
560+
open: url,
561+
sourceApplication: sourceApplication,
562+
annotation: annotation
563+
)
564+
565+
}
566+
567+
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
568+
569+
return FBSDKApplicationDelegate.sharedInstance().application(
570+
app,
571+
open: url,
572+
sourceApplication: options[.sourceApplication] as? String,
573+
annotation: options[.annotation]
574+
)
575+
558576
}
559577

560578
//Make sure it isn't already declared in the app delegate (possible redefinition of func error)
561-
func applicationDidBecomeActive(application: UIApplication) {
579+
func applicationDidBecomeActive(_ application: UIApplication) {
562580
FBSDKAppEvents.activateApp()
563581
}
564582
```

0 commit comments

Comments
 (0)