Xcode 7 beta debugger not showing values of variab

2020-02-20 07:13发布

I have tried the answers from question here but none of them helped :(

I have installed Xcode 7 beta 5 and the debugger will not show values of variables when debugging swift code. It works fine in Obj-C code.

I have tried changing the Compiler Optimisation level to None and it had not effect.

enter image description here

8条回答
▲ chillily
2楼-- · 2020-02-20 07:58

I had the same issue. I solved it from this link here:

Swift debugger does not show variable values when importing ObjC framework

First try to move in subfolder all .framework, as Author of this post says:

I got a message from an Apple developer stating that they've observed this problem, and that it could be fixed by moving the .framework to a subfolder of the project. Apparently the module .. was built in directory error appears only if the .framework is in the same folder as the .xcodeproj aka $(PROJECT_DIR).

But in my case, the main issue was OpenTok framework. After I add action in the breakpoint

po self 

Log shows up the message:

warning: Swift error in module myapp: Swift had fatal errors constructing the ast context for this module: :1:9: note: in file included from :1: #import "/Users/me/Developer/myapp-ios/Pods/OpenTok/OpenTok.framework/Headers/OpenTok.h"

And finally I added these lines of codes in Podfile:

post_install do |installer|
  `find Pods -regex 'Pods/OpenTok.*\\.h' -print0 | xargs -0 sed -i '' 's/\\(<\\)OpenTok\\/\\(.*\\)\\(>\\)/\\"\\2\\"/'`
end

After that finally, pod install.

查看更多
做自己的国王
3楼-- · 2020-02-20 08:01

I was still finding this an issue in the final release of XCode 7.0. It turns out my bridging header needed updating as one of the references was no longer needed in it.

I found that out by using 'po' in the debugger for one of the variables, e.g. 'po self.views'. The debugger then listed all the errors in the bridging header for me. Weird way to find out the problem but it worked.

EDIT: And just in case do a clean build after fixing any issues

查看更多
4楼-- · 2020-02-20 08:06

I had the same problem. The reason is because I'm using Crashlytics which is a ObjC framework.

Try to remove some of the ObjC frameworks and then shift + cmd + k to clean your project and rebuild it again.

It should work after that.

查看更多
狗以群分
5楼-- · 2020-02-20 08:08

The thread that @Breek linked to contains the solution - Twitter has released a fix for this. Upgrading Crashlytics from 3.1.x to 3.2 fixed the debugger for me on the Xcode 7 GM seed. If for some reason you cannot upgrade Crashlytics, you should be able to edit their header files as indicated in the thread as a temporary workaround; that is, changing #import <Fabric/FABAttributes.h> in Crashlytics.h to @import Fabric; instead.

查看更多
叛逆
6楼-- · 2020-02-20 08:09

Apple fixed this problem in Xcode 7 Beta 6

And there is a link about the problem from Twitter Developer: https://twittercommunity.com/t/xcode-7-debugger/50792

查看更多
forever°为你锁心
7楼-- · 2020-02-20 08:12

Goto Project -> Targets -> Build Setting -> Optimisation Level -> Debug and set value to whatever u want

查看更多
登录 后发表回答