LoginSignup
6
2

More than 5 years have passed since last update.

Xcode10に上げて自動変換かけたらdidFinishLaunchingWithOptionsが呼ばれなくなった時の対応

Last updated at Posted at 2018-09-25

元のコード

func application(_: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

自動変換後のコード

private func application(_: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {}

修正後のコード

func application(_: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {}

説明

自動変換に任せたら、privateがついていました。
その結果正しく動かなかったみたいです。
自動変換便利だけど気をつけよう...

参考

補足

おそらく以下のようにErrorとWarningが両方でるかとおもいます。
スクリーンショット 2018-09-25 19.40.12.png
これに対して、Fix All Issuesを実行すると、本来は上のErrorだけを解決すればいいものが下のWarningも同時に解決されてprivateが付いてしまいます。

6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2