2016-09-20 8 views
0

Xcode 7.3をXcode 8にアップデートしました。バージョン8にアップデートした後、AppDelegateで複数の警告が表示されるXcode?

AppDelegateで複数の警告が表示されています。警告は次のとおりです。

Extraneous '_' in parameter: 'application' has no keyword argument name 

マイAppDelagate.swiftファイルはこれです:私は警告を示し関数で_を除去するためのXcodeの提案に従っ

import UIKit 

@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:. 
    } 


} 

私は上記の警告を取り除きました。しかし、今、私は

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { 
     // Override point for customization after application launch. 
     return true 
    } 

のための新たな警告を受ける警告は次のとおりです。

[email protected] method 'application(_:didFinishLaunchingWithOptions:)' cannot satisfy optional requirement of @objc protocol 'UIApplicationDelegate' 

私はオンラインソリューションを追いました。しかし、この警告を取り除くことに運がなかった。

ご協力いただければ幸いです。おかげさまで

答えて

3

あなたのコードでは、スウィフト3のために正しいです。しかし、あなたがしている環境は明らかに2スウィフトことになっていると考え、それはエラーメッセージの理由です。

Xcode 7で誤ってファイルを開いたように聞こえますが、それは説明します。あなたのコードはSwift 3です.Xcode 7はSwift 2です。それはスイフト3については知らないし、あなたのコードを理解していない。 Swift 3に変換したので、このプロジェクトでXcode 7を使用することはできません。

それともこれはXcodeの8であるが、従来のビルド設定がオンのままなので、それはこれがスウィフト2のはず。しかし、それはないです考えています。それはSwift 3です。

+0

私はXcode 8にアップデートした後でプロジェクトを作成しました。私はXcode 7を使用していません。 – AK1

+0

私は自分のコードをすぐに3に変換しました。警告は消えました。 Xcode 8で従来のswiftバージョンを使用することはできません。 – AK1

+0

はいできます。しかし、私の答えがあなたに伝えるものを聞きなさい。あなたのコードは従来のSwiftではありません。それはスイフト3です。 – matt

関連する問題