【Swift4】@objc絡みのワーニング
また出た良くわからないワーニング
- Swift3からSwift4にマイグレーションしてると、以下のようなワーニングが出た
The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "AppName" target.
消し方
- TargetsのBuild Settingsで「inference」で検索する。
Swift 3 @objc Inferenceの項目が表示されるので、
Targetsの設定を「Default」に変更する - 以下のサイトを参考に・・・
その先
- Objective-CからSwiftのメソッドが見えなくなる。"AppName-Swift.h"にObjective-Cから呼び出したいSwiftメソッドが出力されなくなってしまった。
どうも参照したい各メソッドに@objcを書かなければならないらしい。面倒くさい。人をハメようとしてるとしか思えない