I upgraded my project to Swift 2 in Xcode 7 beta (7A120f) and get this error when trying to po self at the lldb prompt:
warning: Swift error in module myApp:
Swift had fatal errors constructing the ast context for this module: cannot load underlying module for 'UIKit' Debug info from this module will be unavailable in the debugger.
I'm then left with a crippled debugger (no values). This happens regardless of where I place a breakpoint. I've tried:
I'm able to create a new project and see debug output in it, so this probably has something to do with how my project was migrated by xcode.
What is the ast context and how can I correct it?
Edit: ast is 'Abstract Syntax Tree'. Still no idea how to fix it though.
I'm having the same issue in my project. The error that lldb spits out when attempting to po
an object highlights the issue:
(lldb)po fileURL
warning: Swift error in module <APP_NAME>:
Swift had fatal errors constructing the ast context for this module: <module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/Crashlytics.h"
^
<APP_PATH>/Pods/Crashlytics/Crashlytics.framework/Headers/Crashlytics.h:10:9: error: include of non-modular header inside framework module 'Crashlytics'
#import <Fabric/FABAttributes.h>
^
The Crashlytics.h
umbrella header in Crashlytics.framework
is importing Fabric/FABAttributes.h
, which is not part of the Crashlytics module (i.e. not in its module.modulemap
). This is Crashlytics 3.1.0 installed using CocoaPods.
Why Xcode 7 treats this as a fatal error is beyond me (it was just a warning in 6). In Xcode 6 you could work around this sort of "non-modular header include" by enabling the "Allow Non-modular includes in Framework Modules" (CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES
) build setting in your application target.
I've had no luck getting the Xcode 7 betas to honor the above flag (rdar://22044453 <-- please dup).
The only solution I've found to get the debugger working is to remove the Crashlytics pod. I comment out the Crashlytics and Fabric pods, run pod install
, resume debugging and then reinstall the pods before a release.
I really hope this is fixed in Xcode 7 by the time it comes out of beta.
Check your bridging header and if you have
@import Crashlytics;
(or any other frameworks that cause the error. In my case it was GoogleMobileAds
)
try replacing with
#import <Crashlytics/Crashlytics.h>
To fix this I manually migrated all my files and settings to a new xcode project. Nothing else worked. There is probably a better fix but I couldn't spend any more time looking for it.
I had the same issue. In the most cases this issues appears when you use objective-c frameworks or libraries in Swift project.
The issue was fixed by importing objective-c frameworks or libraries in Bridging-Header only.
#import <SampleFramework/SampleFramework.h>
and remove all imports of this framework from Swift files
import SampleFramework // <-- Remove it
Then Clean and Build.
Make sure that you did this procedure for all objective-c frameworks or libraries in your projects.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With