对于watchOS框架不可见UIColor初始化程序

Xcode reports a compile error when trying to instantiate a UIColor using init?(named name: String, in bundle: Bundle?, compatibleWith traitCollection: UITraitCollection?) on a watchOS framework.

脚步:

  1. Create a sample iOS app
  2. Add a new iOS framework to the xcodeproj. This will generate a new xcodeproj that will be added to the main one.
  3. Add a new watchOS target to the framework's xcodeproj
  4. Create a .swift file where you declare a UIColor instantiated using init?(named name: String, in bundle: Bundle?, compatibleWith traitCollection: UITraitCollection?) and set the target membership to both the iOS and watchOS frameworks.
let bundle = Bundle(identifier: "com.alexdmotoc.MyKit")
let myColor1 = UIColor(named: "MyColor1", in: bundle, compatibleWith: nil)!
  1. 选择watchOS框架的方案并尝试构建。

Xcode报告一个编译错误:“表达式的类型是模棱两可的,没有更多上下文”。项目没有建立。

难道我做错了什么?

随附一些图像以供参考。

the crash I get when trying to instantiate the colors from the assets folder the assets folder with the colors