Cannot debug Swift module/framework embedded in Objective-C app

后端 未结 11 1696
悲哀的现实
悲哀的现实 2021-02-01 02:57

Alternative titles (to aid searching)

  • Cannot debug Swift 2.3 framework linked to an Objective-C app in Xcode 8
  • error in auto-import: f
11条回答
  •  失恋的感觉
    2021-02-01 03:52

    I discussed this issue with an Apple engineer named Sean at WWDC 2017.

    My team spent weeks trying to figure this out, and it ended up being a bug on Apple's compiler, which we could never have figured out by ourselves. Also, it has a VERY easy workaround.

    There happens to be a bug with the way the compiling flags get aggregated from the frameworks and the project, and the "pure Objective-C" project "activates" it.

    Solution: add one single, empty Swift file ("Whatever.swift", or whatever) in your Objective-C project, making it not-pure-objective-c anymore (new->file->Swift file, don't create the bridging header. The file will only contain the import of Foundation).

    And that's it. Problem solved.

提交回复
热议问题