Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
768 views
in Technique[技术] by (71.8m points)

xcode - Swift debugger does not show variable values when importing ObjC framework

When I create a new OS X "Game" project with Sprite Kit, and set a breakpoint anywhere I can see the variable values just fine:

enter image description here

Then I change the code to import my own framework (TilemapKit) which is a pure Objective-C framework:

import SpriteKit
import TilemapKit

class GameScene: SKScene {
    override func didMoveToView(view: SKView) {
        print("dang!")
    }
}

No other changes made. I'm not even using any of the TilemapKit code (yet). When the breakpoint triggers, I see this:

enter image description here

The entire project stops being debuggable as far as observing variable values goes. This behavior is perfectly consistent. Without the framework import I can debug again.

Since I'm on Xcode 7 beta (7A121l) and OS X 10.11 developer preview I know this could simply be a (temporary) bug.

Command line Tiles are set to use the Xcode 7.0 version btw. I tried enabling modules in the framework target, made sure the deployment target is the same (10.11), disabled symbol stripping. I added a Bridging Header and #imported the TilemapKit framework in it (removing the Swift import in that case would still give me the non-debuggable app, so it doesn't seem to matter how or where I import the framework).

Does anyone have a suggestion on what could cause this behavior and how I might go about fixing it - or at least how I could try to narrow down the issue?

Is the culprit more likely to be connected to the project's vs the framework's build settings? Do I need to enable something in the app project to make it compatible with ObjC frameworks? (I already got -ObjC in the Other Linker flags)


UPDATE:

I ran po self in the debug console and found this notice:

<built-in>:3:6: error: module 'TilemapKit' was built in directory '/TilemapKit.framework' but now resides in directory './TilemapKit.framework'
#define __clang_major__ 7
     ^
missing required module 'TilemapKit'
Debug info from this module will be unavailable in the debugger.

How come the framework build directory changed? And why would that matter and how to fix this?

PS: the same framework in a new ObjC app can be debugged just fine.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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).

However moving the framework to a subfolder didn't fix the issue in my case, but it's still worth a try until this gets fixed in a newer Xcode 7 beta (still occurs in beta 3).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...