无法调试Objective-C应用程序中嵌入的Swift模块/框架 [英] Cannot debug Swift module/framework embedded in Objective-C app

查看:90
本文介绍了无法调试Objective-C应用程序中嵌入的Swift模块/框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其他标题(以帮助搜索)

  • 无法调试Xcode 8中链接到Objective-C应用程序的Swift 2.3框架
  • error in auto-import: failed to get module 'XYZ' from AST context Xcode 8
  • Xcode 8无法调试Swift框架
  • warning: Swift error in module <XYZ>
  • 解决方法; Xcode Debugger不能仅调试用Objective-C编写的应用程序,而只能链接到用Swift编写的框架. (28312362)

Alternative titles (to aid searching)

  • Cannot debug Swift 2.3 framework linked to an Objective-C app in Xcode 8
  • error in auto-import: failed to get module 'XYZ' from AST context Xcode 8
  • Xcode 8 cannot debug Swift framework
  • warning: Swift error in module <XYZ>
  • Workaround for; Xcode Debugger cannot debug apps written in Objective-C only but that link against frameworks written in Swift only. (28312362)

我有一个用Objective-C编写的应用程序,可以链接到用Swift 2.x编写的某些模块(框架).

I have an app written in Objective-C that links against some modules (frameworks) written in Swift 2.x.

一切(调试等)在,但是当移至的问题并更新使用无法调试模块.

Everything (debugging etc.) works fine in xcode7, however when moving to xcode8 and updating the modules to use swift2.3 I was unable to debug the modules.

LLDB报告了以下错误:

LLDB reported these errors:

warning: Swift error in module XYZ.
Debug info from this module will be unavailable in the debugger.

error: in auto-import:
failed to get module 'ABC' from AST context

如果我将模块链接到Swift 2.3中内置的应用程序,则不会发生这种情况.

This does not happen if I link the modules to an app built in Swift 2.3.

推荐答案

tl:dr

在构建设置"下为您的应用目标添加用户定义的设置.

tl:dr

Add a user defined setting under "Build Settings" for your app target.

SWIFT_VERSION = 2.3

我不确定这是Xcode 8错误还是Apple政策(尝试强制开发人员使用Swift 3.0?).但是...默认情况下,Xcode 8将安装标准Swift运行时库的Swift 3.0版本.

I'm unsure if this is an Xcode 8 bug or if it's Apple policy (to try an force developers to Swift 3.0?). But... by default Xcode 8 installs the Swift 3.0 versions of the standard Swift runtime libraries.

在使用LLDM进行调试时,Swift 2.3模块无法加载(进入Swift 3.0运行时).

When it comes to debugging with LLDM the Swift 2.3 modules fail to load (in to the Swift 3.0 runtime).

强制该应用程序使用Swift 2.3(或Apple称之为旧版Swift)解决此问题.

Forcing the app to use Swift 2.3 (or legacy Swift as Apple call it), fixes the issue.

Swift应用程序具有Xcode公开的此设置,但是您必须为Objective-C应用程序手动添加它.

Swift apps have this setting exposed by Xcode but you have to manually add it for an Objective-C app.

尽快将您的Swift 2.3代码移植到Swift 3.0,Apple很长时间不会支持2.x.

Port your Swift 2.3 code to Swift 3.0 as soon as possible, Apple won't support 2.x for very long.

这篇关于无法调试Objective-C应用程序中嵌入的Swift模块/框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆