Here's my configuration :
Pod X : Linked with MyProjectSharedCode, declares class SomeClass (in Objective C)
MyProjectExtension : Today extension, sharing data with MyProject
MyProject : Companion app to configure MyProjectExtension
MyProjectSharedCode : Embedded framework for common code in MyProject and MyProjectExtension. Uses SomeClass.
I can't get it working. I've tried :
Importing PodX.hin MyProjectSharedCode.h, but it results in a compiler error :
include of non-modular header inside framework module
Which lead me to a few Stackoverflow links, including this one. However, changing this option didn't allow me to compile either. As #NachoSoto says in the accepted answer's last comment, the answer doesn't seem to work since Xcode 6 B5.
Any help/leads would be much appreciated.
There's a good post that came out today about using the development branch of Cocoapods 0.36.0 which is where frameworks/swift support is being added.
http://swiftwala.com/cocoapods-is-ready-for-swift/
Baring that I've been linking pods into a framework and then including the headers in the bridging header. Its a little wacky but it works so long as you don't want to write swift that uses the pods in the framework itself.
Edit
The pre-release version of 0.36.0 is out you can see the blog post here.
Related
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)
I have an app written in Objective-C that links against some modules (frameworks) written in Swift 2.x.
Question
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 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
This does not happen if I link the modules to an app built in Swift 2.3.
For me it was just as simple as it was painful and time consuming:
import SDWebImage was the PROBLEM,
because one of the frameworks had the SDWebImage already packed in it(and I couldn't see it), and that framework happened to be Objective-C, and the app was Swift.
I also added the SDWebImage to the project, because I use it in the classes I write, and that what created the mess the Xcode debugger couldn't deal with.
So basically, make sure you don't have ANYTHING duplicated in ANY way, I'd check for common things like SDWebImage for example.
use fr v instead po for debugging
For more debugging
https://www.codeproject.com/Articles/1181358/Debugging-with-Xcode
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.
tl:dr
Add a user defined setting under "Build Settings" for your app target.
SWIFT_VERSION = 2.3
More Info
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.
When it comes to debugging with LLDM the Swift 2.3 modules fail to load (in to the Swift 3.0 runtime).
Forcing the app to use Swift 2.3 (or legacy Swift as Apple call it), fixes the issue.
Swift apps have this setting exposed by Xcode but you have to manually add it for an Objective-C app.
Further Advice
Port your Swift 2.3 code to Swift 3.0 as soon as possible, Apple won't support 2.x for very long.
In my case, I had to remove Objective-C Bridging header from build settings file. My Bridging header file did not do anything.. so it was okay.
I ran into the error in auto-import: failed to get module 'XYZ' from AST context message while attempting to debug in an 9.3 simulator. Switching to a 10.2 simulator resolved the issue.
I ran into this when building a framework with Carthage. Trying to debug would print the error, which referenced an Obj-C framework dependency.
I found this blog post which suggested adding a the following user-defined build setting to my project:
For Debug: REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES = NO
For Release: REMOVE_HEADERS_FROM_EMBEDDED_BUNDLES = YES
This fixed the issue for me.
Try to restart Xcode. In my case it resolved an issue.
In my case there was a compiler error in the "C" code which was reported in LLDB, after fixing the error LLDB started working again.
As suggested by Tim https://stackoverflow.com/a/41876400/1840269 the root cause to our problem was a matter of duplicates.
We had a obj-c wrapper category for SDWebImage that was used from both obj-c and Swift.
When Importing the category from Swift everything blew up because of redefinition/duplicate import since the SDWebImage pod already exposed it self as a Swift module.
The solution? We re-implemented the obj-c category as a Swift extension - and kept using it from both Swift and obj-c by adding #objc in front of the extension and importing the #import "product-Swift.h" file from obj-c.
And maybe start with checking: https://developer.apple.com/library/content/qa/qa1947/_index.html.
I just took 2 days for me to resolve and debugging through print command all the time. Now I got the issue:
My project is in Swift and I was using objective-C library same as imported in pods for swift(old Objective-C project merged in this one) and was using import IQKeyboardManager as well as import "IQKeyboardManager.h" header as well. That conflicts and deleting the header one resolved my issue finally.
You can check with this type of duplicity in libraries.
Here in this change-log(facebook change-log) it is stated that there is no need for objective-c bridging headers for swift.
But when I import FBSDKCoreKit in AppDelegate.swift these errors occur:
FBSDKAppLinkResolver.h
/Users/[username]/Documents/FacebookSDK/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h:21:9:
Include of non-modular header inside framework module
'FBSDKCoreKit.FBSDKAppLinkResolver'
AppDelegate.swift
/Users/ashrafkholeif/Projects/xcode/TabbedApplicationTemplate/TabbedApplicationTemplate/TabbedApplicationTemplate/AppDelegate.swift:10:8:
Could not build Objective-C module 'FBSDKCoreKit'
edit: I even set the allow non-modular header inside framework modules to YES.
I had the exact same issue, the solution suggested on https://stackoverflow.com/a/29457503/425682 for an Objective-C project worked straight away on my Swift project:
Write a new file in the Facebook SDK folder under Bolts.framework/Modules/module.modulemap with the following content:
framework module Bolts {
umbrella header "Bolts.h"
export *
module * { export * }
explicit module BFAppLinkResolver {
header "BFAppLinkResolver.h"
link "BFAppLinkResolver"
export *
}}
This works without bridging headers (not needed anymore in version 4.0.1 of the SDK as mentioned by the OP), and without changes to the build settings.
EDIT: this bug is now fixed as of version 4.1 of the Facebook SDK, the library works without having to do any change.
This is a bug and Facebook is currently "assigning this to the appropriate team".
To get updates to this issue follow this link:
https://developers.facebook.com/bugs/362995353893156/
and hit subscribe.
Hopefully it doesn't take them too long to fix.
Also here is a related question recently posted on SO:
issue using FBSDK in swift iOS application
And some people have found success using the answers on this link (none have worked for me):
Facebook iOS8 SDK build module error for FBSDKCoreKit
The fix that worked for me:
rm -r ~/Documents/FacebookSDK/FBSDKCoreKit.framework/Modules/
Repeat with other frameworks.
Source: https://developers.facebook.com/docs/ios/troubleshooting#xcode_link
Create a new header file and import any objective-c code you are using, something like this..
#ifndef RJv1_RJBridge_h
#define RJv1_RJBridge_h
#import "NSMutableString+Obfuscated.h"
#import <FBSDKCoreKit/FBSDKCoreKit.h>
#import <FBSDKLoginKit/FBSDKLoginKit.h>
#endif
Then go to your Build Settings, look for Install Objective-C Compability Header, and make sure is set to Yes, then add a relative path to your header file in the field Objective-C Bridging Header.
Hope it works!
I have this in a .h file:
class Ogre::ManualObject;
I don't know how it got there but it's always compiled under multiple compilers - until suddenly XCode5.1 raises it as an error.
Have Apple changed the C++ compiler again?
As John suggested, change class Ogre::ManualObject; to namespace Ogre{ class ManualObject;}. I had exactly the same problem (but with different declarations), also with Ogre and Xcode 5.1. Changed 3 lines, everything worked.
Possibly that never was legal. It would depend on the code around it (hard to say just based on that one line without knowing the referencing points). See this SO thread.
Apparently, you are not the only one experiencing this issue after an XCode 5.1 update. See this thread regarding Scaleform (autodesk.com). I however couldn't find anything related in the XCode or LLVM/clang release notes.
RubyMotion provides these instructions for vendoring 3rd party code: http://www.rubymotion.com/developer-center/guides/project-management/#_files_dependencies
I'm trying to add Parse.com's iOS SDK. These are the instructions for adding it to an XCode project: https://parse.com/apps/quickstart#ios/existing. However, I'm not using XCode since I'm working with RubyMotion.
I documented my attempt here: https://github.com/adelevie/RubyMotionSamples/commit/603bf4428995bb203cce7e7e8e6989d6e86bda3b
And here are the errors I'm getting: https://gist.github.com/2595284
I believe we're actually dealing with a static library here, so I believe you should specify :static instead of :Xcode as the second option.
With the following code in your Rakefile, the app compiles:
app.libs << '/usr/lib/libz.1.1.3.dylib'
app.frameworks += [
'AudioToolbox',
'CFNetwork',
'SystemConfiguration',
'MobileCoreServices',
'Security',
'QuartzCore']
app.vendor_project('vendor/Parse.framework', :static,
:products => ['Parse'],
:headers_dir => 'Heiders')
However, I'm getting the following error running the Parse setApplicationId method:
(main)>> Objective-C stub for message `setApplicationId:clientKey:' type `v#:##' not precompiled. Make sure you properly link with the framework or library that defines this message.
The documentation linked says, "To vendor a 3rd-party library in a RubyMotion project, the source code must be available somewhere on the filesystem." So I don't think dropping a .framework file in there will work.
You could try downloading the ParseStartProject, called "Blank Xcode w/ SDK" from parse.com/docs. If you vendor that project folder, RubyMotion will be able to find an xcode project like it's looking for. You'll want to delete the .m and .h files from the xcode project, of course, since you only want the project to include Parse.framework.
I haven't actually tried this. Please let us know if you get it working.
Okay copied this from an answer in the RubyMotion group. It seems to fix the stub error message:
Now, to make this work, I've modified /Library/RubyMotion/lib/motion/project/vendor.rb and changed the Dir.glob on line 38 from:
source_files = (opts.delete(:source_files) or Dir.glob('*.
{c,m,cpp,cxx,mm,h}'))
to:
source_files = (opts.delete(:source_files) or Dir.glob('**/*.
{c,m,cpp,cxx,mm,h}'))
http://groups.google.com/group/rubymotion/msg/0efa74214523d0f5
While trying to get the template Xcode 4 ogre project to work, the build fails because it can't find OgreCamera.h.
I've installed Ogre to /opt/local/lib/OGRE, and specified that as the Ogre SDK location when creating the Xcode 4 project.
Needless to say, the header and framework include paths in the project settings point exactly to where all the header files are, yet not one of them can be found. I've tried commenting out the include of OgreCamera.h, and upon trying to run, the next include, OgreEntity.h, cannot be found. Commenting that out and running again, the next include can't be found, and so on (these includes are in OgreFramework.h.
I don't understand why these headers, which clearly exist when I go look for them in the Finder or Terminal, can't be found by the project, even when I specify their full path like this:
#include </opt/local/lib/OGRE/lib/release/Ogre.framework/Versions/1.7.4/Headers/OgreCamera.h>
Did I somehow install the Ogre SDK incorrectly? (I copied it from the DMG into placeā¦)
I had the same problem, and found partial success by following rjstelling's answer from this thread:
why can't Xcode find this header file?
That solved the OgreCamera.h include issues, but now I'm stuck on including the boost libraries. They are not picked up on the search paths, or in the Indexing group as suggested in the thread above.
Basically it looks like a bug in XCode4 that has to be worked around until a patch is released. There is also more information here:
Compile, Build or Archive problems with Xcode 4 (and dependencies)