Value of type 'AppDelegate' has no member 'present'のエラーに関して
buildすると
Value of type 'AppDelegate' has no member 'present'
と出ます。
ソースを載せておきますので教えてください。
import UIKit
import Fabric
import Crashlytics
import Smooch
import OneSignal
import JLRoutes
import GameKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDelegate {
var window: UIWindow?
func applicationDidBecomeActive(_ application: UIApplication) {
func authenticateLocalPlayer() {
let player = GKLocalPlayer.localPlayer() //ログイン確認画面の作成
player.authenticateHandler = {(viewController, error) -> Void in
//GameCenterに認証されていない時、viewControllerに認証画面が入ってくるので、
//それを表示させれば認証処理が簡単にできる
if viewController != nil
{
self.present(viewController!, animated: true, completion: nil)
}
}
}
}
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// OneSignal
OneSignal.initWithLaunchOptions(launchOptions, appId: keys.oneSignal, handleNotificationReceived: { notification in
}, handleNotificationAction: { result in
}, settings: [kOSSettingsKeyAutoPrompt: true, kOSSettingsKeyInFocusDisplayOption: OSNotificationDisplayType.notification.rawValue])
// Smooch
Smooch.initWith(SKTSettings(appId: keys.smooch))
// Crashlytics
Fabric.with([Crashlytics.start(withAPIKey: keys.crashlytics)])
// Default time
NSTimeZone.default = TimeZone(identifier: "JST")!
// Global Tint Color (Xcode Bug #1)
UIView.appearance().tintColor = UIColor(red: 106.0/255.0, green: 118.0/255.0, blue: 220.0/255.0, alpha: 1.0)
// Routes
RoutesManager.sharedInstance.setup()
// Delegate
if let splitViewController = UIStoryboard(name: "Main", bundle: nil).instantiateInitialViewController() as? UISplitViewController {
splitViewController.delegate = self
splitViewController.preferredDisplayMode = .allVisible
window?.rootViewController = splitViewController
window?.makeKeyAndVisible()
}
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
return JLRoutes.routeURL(url)
}
// MARK: UISplitViewControllerDelegate
func splitViewController(_ splitViewController: UISplitViewController, collapseSecondary secondaryViewController: UIViewController, onto primaryViewController: UIViewController) -> Bool {
if secondaryViewController.isKind(of: UINavigationController.self) {
return false
} else {
return true
}
}
func splitViewController(_ splitViewController: UISplitViewController, separateSecondaryFrom primaryViewController: UIViewController) -> UIViewController? {
if primaryViewController.isKind(of: UINavigationController.self) {
let nvc = primaryViewController as! UINavigationController
if nvc.topViewController is PartiesTableViewController {
return UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "noparty")
}
}
return nil
}
}