Re: App refuses to find Framework's Objective-C Generated Header: whats wrong?
Re: App refuses to find Framework's Objective-C Generated Header: whats wrong?
- Subject: Re: App refuses to find Framework's Objective-C Generated Header: whats wrong?
- From: David Hoerl <email@hidden>
- Date: Fri, 14 Oct 2016 09:28:25 -0400
I did this, but no matter what I try, I cannot get this to work:
- construct a Swift 3 only framework and add it to my app
- insure that the framework is in the link phase, and there is a
dependency on it, and that its included in the General tab as an embedded framework
- insure that "Defines Module" is enabled in the Framework itself
- add a "@import MyFramework;" line to an Objective C .m file in the app (no error on that)
Build:
- the framework builds, I see the MyFramework-Swift.h file
- Objective C app files that have the @import MyFramework; generate
errors: "Cannot access such and such a property on a forward class
declaration."
...the instructions are very short:
make sure the Defines Module build setting for the framework you’re
importing is set to “Yes”
Yes - did this from the start.
It’s the “Defines Module” setting in the *framework* target that
matters, not in the app target (and in that case the MyFramework-Swift.h
file is irrelevant: it’s only for mixing code *within* a target).
So, on the face of it, there could be two errors in what you’re doing:
a. Your framework target has “Defines Module” set to NO.
No - its was always set to YES
b. Your app target doesn’t know that the framework exists for compile
purposes. It’s not enough for the framework to be linked against, e.g.
if specified only in the link phase or specified as a linker option. You
have to add the framework reference to the project (typically in the
project’s General tab, under “Embedded Binaries”).
I had not done this, but doing so changed nothing.
Note that a Swift framework has to be embedded, since binary ABI compatibility is *not*
yet available.
OK - I had missed this step.
What you’ll actually do here depends whether the framework target is in
the same project and/or workspace as the app target. You weren’t clear
on that point.
The framework is located in a different directory completely (different
git repository). However, xcodeproj is included, my app is building it
just fine, there are no other errors other than a simple "@import
MyFamework;" in the Objective C file has no apparent effect.
I’m hoping your problem is one of these two straightforward things.
Otherwise, tracking down the problem gets harder.
I am afraid of that. At least I have a (crummy) workaround.
P.S. I guess I should add another simple error:
c. Your framework target must have its module name build setting set to
or defaulted to “MyFramework”.
Yes to both. Everything is set to one name now (which is "API")
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden