Skip to content
This repository was archived by the owner on Nov 2, 2019. It is now read-only.

Commit c73fe35

Browse files
committed
Add iOS 9.0+ method for opening URLs to ApplicationDelegate.
1 parent 1fa8368 commit c73fe35

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

Samples/Catalog/Sources/AppDelegate.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ extension AppDelegate: UIApplicationDelegate {
4040
annotation: annotation)
4141
}
4242

43+
@available(iOS 9.0, *)
44+
func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
45+
return SDKApplicationDelegate.shared.application(application, openURL: url, options: options)
46+
}
47+
4348
func applicationDidBecomeActive(application: UIApplication) {
4449
AppEventsLogger.activate(application)
4550
}

Sources/Core/Common/SDKApplicationDelegate.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,27 @@ extension SDKApplicationDelegate {
6262

6363
- returns: `true` if the url was intended for the Facebook SDK, otherwise - `false`.
6464
*/
65+
@available(iOS, deprecated=9.0, message="Please use application:openURL:options:")
6566
public func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
6667
return delegate.application(application, openURL:url, sourceApplication:sourceApplication, annotation:annotation)
6768
}
69+
70+
/**
71+
Call this function from the `UIApplicationDelegate.application(app:openURL:options:)` function of the AppDelegate for your app.
72+
It should be invoked for the proper processing of responses during interaction
73+
with the native Facebook app or Safari as part of SSO authorization flow or Facebook dialogs.
74+
75+
- parameter application: The application as passed to `UIApplicationDelegate`.
76+
- parameter url: The URL as passed to `UIApplicationDelegate`.
77+
- parameter options: The options as passed to `UIApplicationDelegate`.
78+
79+
- returns: `true` if the url was intended for the Facebook SDK, otherwise - `false`.
80+
*/
81+
@available(iOS 9.0, *)
82+
public func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
83+
return delegate.application(application,
84+
openURL: url,
85+
sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String,
86+
annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
87+
}
6888
}

0 commit comments

Comments
 (0)