简体   繁体   English

桥接标题问题 - 'MyClass'不可用:无法找到此类的Swift声明

[英]Bridging Header issue - 'MyClass' is unavailable: cannot find Swift declaration for this class

I have visited this links - 我访问了这个链接 -

MyClass is unavailable: cannot find Swift declaration for this class - Release Build Only MyClass不可用:找不到此类的Swift声明 - 仅发布版本

Adding Linked or Embedded Swift Framework: 'MyClass' is unavailable: cannot find Swift declaration for this class 添加链接或嵌入式Swift框架:'MyClass'不可用:找不到此类的Swift声明

Swift: using private framework Swift:使用私有框架

But none of the above links helped me to solve my problem. 但上述链接都没有帮助我解决我的问题。

I am developing an App using objective-c, in the app I am integrating ios-charts whose framework is developed in swift.I have merged the project as given in the README file. 我正在使用objective-c开发一个应用程序,在应用程序中我正在集成ios-charts,其框架是在swift中开发的。我已经合并了README文件中给出的项目。 After integrating i have created a MyClass.swift file and then inherited the MyClass.swift file with a Class which is defined in charts.framework .But this is rising an error 集成后,我创建了一个MyClass.swift文件,然后使用在charts.framework定义的Class继承了MyClass.swift文件。但是这会出现错误

'Class' is unavailable: cannot find Swift declaration for this class 'Class'不可用:找不到此类的Swift声明

Does anyone help me to solve this error? 有没有人帮我解决这个错误? Any suggestions?? 有什么建议么??

This may be due to possibility that you are building for device and using for simulator and vice-versa. 这可能是由于您正在为设备构建和使用模拟器的可能性,反之亦然。 Please check this. 请检查一下。 This is very important thing. 这是非常重要的事情。 If you compiled or build framework for device, it will not work on simulator. 如果您为设备编译或构建框架,它将无法在模拟器上运行。

我对此问题的解决方法是将框架的部署目标从我的设备更改为“ 通用iOS设备 ”,然后重新构建框架。

尝试添加Myoblass声明的@objc infront(即@objc类MyClass {...})

I encountered the same problem, ie, when calling functions from 'MyClass' contained in 'MyFramework', it reports that 'MyClass' is unavailable. 我遇到了同样的问题,即当从'MyFramework'中包含的'MyClass'调用函数时,它报告'MyClass'不可用。 It turns out to be the iOS deployment targets of the framework and the application calling it are different. 事实证明,它是框架的iOS部署目标,并且调用它的应用程序是不同的。 When I set both to be the same, the problem goes away. 当我将两者设置为相同时,问题就会消失。

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 1)从项目中删除框架

2) Then:- 2)然后: -

  • 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 如果您正在运行模拟器,请转到框架项目并构建框架项目,从iOS模拟器列表(模拟器列表中的任何设备)中选择模拟器,然后将框架导入主机项目

  • 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 如果您正在运行物理设备,请转到框架项目并构建框架项目,选择“通用iOS设备”/物理设备(已连接),然后将框架导入主机项目

It should be working fine now. 现在它应该工作正常。 Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MyClass不可用:找不到此类的Swift声明 - MyClass is unavailable: cannot find Swift declaration for this class &#39;MyClass&#39;不可用:找不到此类的Swift声明 - 模拟器 - 'MyClass' is unavailable: cannot find Swift declaration for this class - Simulator 在iPhone 4s(iOS 9.3)上构建应用程序时出现错误-“类不可用:找不到该类的Swift声明” - Error - “Class is unavailable : Cannot find Swift declaration for this class”, while building app on iPhone 4s (iOS 9.3) (Class)不可用:仅在iPhone &lt;= 5模拟器,Generic iOS Device和Release Build上找不到此类的快速声明 - (Class) is unavailable: cannot find swift declaration for this class ONLY for iPhone <= 5 simulator, Generic iOS Device and Release Build Swift 桥接头导入问题 - Swift Bridging Header import issue Swift 桥接头失败问题 - Swift bridging header fail issue Swift 中的桥接标头转换 - Bridging header conversion in Swift 继承自MyClass:UIViewController导致错误&#39;无法找到接口声明&#39; - Inheriting from MyClass : UIViewController causes error 'Cannot find interface declaration' 如何找到Bridging-Header.h的路径 - Swift,Xcode - How to find path of Bridging-Header.h - Swift, Xcode Xcode在某些文件中没有找到Swift桥接header文件 - Xcode does not find Swift bridging header file in some files
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM