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

Commit

Permalink
Add iOS 9.0+ method for opening URLs to ApplicationDelegate.
Browse files Browse the repository at this point in the history
  • Loading branch information
nlutsenko committed Aug 8, 2016
1 parent 1fa8368 commit c73fe35
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Samples/Catalog/Sources/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ extension AppDelegate: UIApplicationDelegate {
annotation: annotation)
}

@available(iOS 9.0, *)
func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
return SDKApplicationDelegate.shared.application(application, openURL: url, options: options)
}

func applicationDidBecomeActive(application: UIApplication) {
AppEventsLogger.activate(application)
}
Expand Down
20 changes: 20 additions & 0 deletions Sources/Core/Common/SDKApplicationDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,27 @@ extension SDKApplicationDelegate {

- returns: `true` if the url was intended for the Facebook SDK, otherwise - `false`.
*/
@available(iOS, deprecated=9.0, message="Please use application:openURL:options:")
public func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject) -> Bool {
return delegate.application(application, openURL:url, sourceApplication:sourceApplication, annotation:annotation)
}

/**
Call this function from the `UIApplicationDelegate.application(app:openURL:options:)` function of the AppDelegate for your app.
It should be invoked for the proper processing of responses during interaction
with the native Facebook app or Safari as part of SSO authorization flow or Facebook dialogs.

- parameter application: The application as passed to `UIApplicationDelegate`.
- parameter url: The URL as passed to `UIApplicationDelegate`.
- parameter options: The options as passed to `UIApplicationDelegate`.

- returns: `true` if the url was intended for the Facebook SDK, otherwise - `false`.
*/
@available(iOS 9.0, *)
public func application(application: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {
return delegate.application(application,
openURL: url,
sourceApplication: options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String,
annotation: options[UIApplicationOpenURLOptionsAnnotationKey])
}
}

0 comments on commit c73fe35

Please sign in to comment.