我在将Auth0导入到我的项目中时遇到问题,我正在使用Cocoa Pod,并且已经安装了Auth0,然后将Auth0库导入到我的应用程序委托中。然后,这需要您将一个函数导入到您的应用程序委托中,当我这样做时,我遇到一个问题,即OpenExternalURLOptionsKey'不是'UIApplication'的成员类型,在这里我看不到麻烦,因为Auth0可可豆荚安装确实起作用了。
我已经尝试过将cocoapod重新安装在podfile中,但是我看不到另一个问题在哪里,所以不知道应该从哪里开始解决问题。
import UIKit
import CoreData
import Auth0
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
// Saves changes in the application's managed object context before the application terminates.
self.saveContext()
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any]) -> Bool {
return Auth0.resumeAuth(url, options: options)
}
我正在尝试在我的应用中使抽搐迹象看起来合理
答案 0 :(得分:1)
您的委托方法错误。它缺少options
参数默认值的空字典。用这个替换它。
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
return Auth0.resumeAuth(url, options: options)
}