swift
1// Copyright (c) 2016-present, Facebook, Inc. All rights reserved. 2// 3// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, 4// copy, modify, and distribute this software in source code or binary form for use 5// in connection with the web services and APIs provided by Facebook. 6// 7// As with any software that integrates with the Facebook platform, your use of 8// this software is subject to the Facebook Developer Principles and Policies 9// [http://developers.facebook.com/policy/]. This copyright notice shall be 10// included in all copies or substantial portions of the software. 11// 12// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 13// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 14// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 15// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 16// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 17// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 19import FBSDKCoreKit 20import Foundation 21import UIKit 22 23/** 24 The `SDKApplicationDelegate` is designed to post process the results from Facebook Login or Facebook Dialogs 25 (or any action that requires switching over to the native Facebook app or Safari). 26 27 The methods in this class are designed to mirror those in UIApplicationDelegate, and you 28 should call them in the respective methods in your AppDelegate implementation. 29 */ 30public final class SDKApplicationDelegate { 31 private weak var delegate: FBSDKApplicationDelegate? 32 33 /// Returns the singleton instance of an application delegate. 34 public static let shared: SDKApplicationDelegate = SDKApplicationDelegate() 35 36 private init() { 37 self.delegate = FBSDKApplicationDelegate.sharedInstance() 38 } 39 40 /** 41 Call this function from the `UIApplicationDelegate.application(application:didFinishLaunchingWithOptions:)` function 42 of the AppDelegate of your app It should be invoked for the proper initialization of the Facebook SDK. 43 44 - parameter application: The application as passed to `UIApplicationDelegate`. 45 - parameter launchOptions: The launchOptions as passed to `UIApplicationDelegate`. 46 47 - returns: `true` if the url contained in the `launchOptions` was intended for the Facebook SDK, otherwise - `false`. 48 */ 49 @discardableResult 50 public func 51 application(_ application: UIApplication, 52 didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool { //ここでエラー 53 return delegate?.application(application, didFinishLaunchingWithOptions: launchOptions) ?? false 54 } 55 56 /** 57 Call this function from the `UIApplicationDelegate.application(application:openURL:sourceApplication:annotation:)` 58 function of the AppDelegate for your app. It should be invoked for the proper processing of responses during 59 interaction with the native Facebook app or Safari as part of SSO authorization flow or Facebook dialogs. 60 61 - parameter application: The application as passed to `UIApplicationDelegate`. 62 - parameter url: The URL as passed to `UIApplicationDelegate`. 63 - parameter sourceApplication: The sourceApplication as passed to `UIApplicationDelegate`. 64 - parameter annotation: The annotation as passed to `UIApplicationDelegate`. 65 66 - returns: `true` if the url was intended for the Facebook SDK, otherwise - `false`. 67 */ 68 @available(iOS, deprecated: 9.0, message: "Please use application(_:open:options:).") 69 @discardableResult 70 public func application(_ application: UIApplication, 71 open url: URL, 72 sourceApplication: String?, 73 annotation: Any) -> Bool { 74 return delegate?.application(application, 75 open: url, 76 sourceApplication: sourceApplication, 77 annotation: annotation) ?? false 78 } 79 80 /** 81 Call this function from the `UIApplicationDelegate.application(app:openURL:options:)` 82 function of the AppDelegate for your app. 83 It should be invoked for the proper processing of responses during interaction 84 with the native Facebook app or Safari as part of SSO authorization flow or Facebook dialogs. 85 86 - parameter app: The application as passed to `UIApplicationDelegate`. 87 - parameter url: The URL as passed to `UIApplicationDelegate`. 88 - parameter options: The options as passed to `UIApplicationDelegate`. 89 90 - returns: `true` if the url was intended for the Facebook SDK, otherwise - `false`. 91 */ 92 @available(iOS 9.0, *) 93 @discardableResult 94 public func application(_ app: UIApplication, 95 open url: URL, 96 options: [UIApplication.OpenURLOptionsKey //ここでエラー : Any] = [:]) -> Bool { 97 return delegate?.application(app, 98 open: url, 99 sourceApplication: options[.sourceApplication] as? String, 100 annotation: options[.annotation]) ?? false 101 } 102}
このコードで、
'LaunchOptionsKey' is not a member type of 'UIApplication'
と
'OpenURLOptionsKey' is not a member type of 'UIApplication'
の二つのエラーが表示されます。
解決策がわかりません。
助けていただけると助かります。
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/10/05 02:54
2018/10/07 03:45