App refuses to find Framework's Objective-C Generated Header: whats wrong?
App refuses to find Framework's Objective-C Generated Header: whats wrong?
- Subject: App refuses to find Framework's Objective-C Generated Header: whats wrong?
- From: David Hoerl <email@hidden>
- Date: Thu, 13 Oct 2016 09:13:52 -0400
The process for an app to include and use a Swift (or mixed framework)
is detailed in this document:
https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html
It specifically deals with the case of accessing a Swift only framework
within the app (Swift or Objective C source files): search on "Importing
External Frameworks". Essentially you should add "@import MyFramework;"
to your Objective-C source files.
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
- insure that "Defines Module" is enabled
- add a "@import MyFramework;" line to an Objective C .m file in the app
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."
No matter what I do - remove the derived folder, restart Xcode, jump up
and down, and swear at my Mac - nothing helps.
The "MyFramework-Swift.h" file is constructed - I can see it in the
app's derived folder, where the Frameworks are build.
After hours and hours of banging my head, I finally just copied that
header file into my app's directory, with all the other .h files, and
added a line to my source "#include "MyFramework-Swift.h" under the
@import MyFramework; line.
Finally - now I can build my app!
Unless someone can point out the error of my ways, I'll be stuck running
some script to copy that file after the framework builds, but before the
app source is compiled. I must be doing something wrong, but no amount
of googling has helped.
I would be extremely thankful for anyone who can shed some light on my
plight!
_______________________________________________
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