I am getting the following error:
MyClass is unavailable: cannot find Swift declaration for this class
but I only get it when doing a release build in Xcode...Debug works fine.
Anyone know what's up? I'm running 6.3
I am getting the following error:
MyClass is unavailable: cannot find Swift declaration for this class
but I only get it when doing a release build in Xcode...Debug works fine.
Anyone know what's up? I'm running 6.3
In my case, it was because my framework that I am developing was missing one of the Valid Architectures listed in my app's target. All I had to do was the following:
In my case, my framework was missing arm64
.
If MyClass is inside a dynamic framework (Cocoa Touch Framework), It is likely that you're using a build with wrong architecture. To check, browse your MyClass.framework in finder, and check Modules/AirServiceKit.swiftmodule
. There should be something like x86_64.swiftmodule
or arm64.swiftmodule
, if you're using simulator there should be x86, or arm if you're building for device.
armv7s
, and iPhone 4 is armv6
. –
Covering In case anyone else encounter this problem:
I had the exact same error and turned out that I had built my framework for an specific emulator. I changed the device
(in upper left corner) to Generic iOS device
and did a clean
and build
, then I used the generated .framework
file.
Everything worked just fine after using this generated .framework
file.
Embedded Binaries
part under General
tab of your project. In the wizard window which appears click check Copy item if needed
option. –
Pugnacious In my case, it was because my framework that I am developing was missing one of the Valid Architectures listed in my app's target. All I had to do was the following:
In my case, my framework was missing arm64
.
Check the flag value you have set for Build Active Architectures Only in Build Settings for Debug and Release
I had faced the same issue i resolved it by doing the following steps
delete the swift framework i.e. move the swift framework to trash
then clean the current project
build the swift framework again
drag the swift framework and drop in the application main directory
add the framework to the embedded frameworks
)then run the project
it works like a charm.your swift framework classes gets recognised in application.
I have a different answer, and I’m sure it’ll help many.
Your app projects link to an early iOS version (like iOS 9.0) and your framework links to a newer (like iOS 11.3)
Just change your framework version to iOS 9.0,
Clean,
(optionally run pod install
if your framework uses pods dependencies),
Build,
and add the framework file to your app project,
add to linked binaries and you’ve done =]
One of the reasons that causes this is that iOS 11 supports 64 bit only (arm64), so the framework gets only that architecture, but your app needs 32 architectures too which are missing.
I presume you're talking about a framework class
Let's just skip the technical stuff that happens in the background... (Almost everything regarding that has been explained :-) )
This error is just due to the framework's incompatibility for the build that you're trying to run it on..
Fix:-
1) Delete the framework from your project
2) Then:-
If you're running a simulator, go to your framework project and build the framework project selecting a simulator from the iOS Simulators list(any device from the simulators list) and then import the framework to the host project
If you're running a physical device, go to your framework project and build the framework project selecting "Generic iOS Device"/Physical Device(that's connected) and then import the framework to the host project
It should be working fine now. Hope this helps!
Have you tried to look at your scheme on your framework and see if it's pointing to "Release" under Product->Scheme->Run->Build configuration?
None of these answers solved my particular issue. The problem for me was, at some point (can't remember why) I added a custom module map file containing code such as:
framework module Foo {
umbrella header "Foo.h"
module * { export * }
export *
}
This conflicted with the Swift class for some reason. Deleting the modulemap file from the framework target fixed the error
For custom pod frameworks that use objc + swift:
Create a new header file like: {FrameworkName}.h and add:
#import "{FrameworkName}-umbrella.h"
and then do either a pod install... or add this file inside {FrameworkName}-umbrella.h like this: #import {FrameworkName}.h
© 2022 - 2024 — McMap. All rights reserved.