简体   繁体   English

如何快速导入Objective C文件

[英]How to Import the Objective c file in the swift

Hello I am working on the react native project which i converted to swift from objective c using this How to convert iOS react native template to swift? 您好我正在使用本机将我从目标c转换为swift的react native项目进行工作如何将iOS react native模板转换为swift? thread. 线。

Now I wanted to use this https://github.com/wonday/react-native-orientation-locker to integrate this library i need to import orienation class but when i import the orientation class i am getting error 现在我想使用此https://github.com/wonday/react-native-orientation-locker集成此库,我需要导入Orienation类,但是当我导入方向类时却出现错误

Here is the my project hierarchy 这是我的项目层次结构

在此处输入图片说明

So my question is how we can import objective c files in swift project or how we can import the third party libraries in bridging header file 所以我的问题是如何在swift项目中导入目标c文件或如何在桥接头文件中导入第三方库

When i import it in this way 当我以这种方式导入时

#import "Orientation/Orientation.h"

I am getting the following error 我收到以下错误

❌ error: failed to emit precompiled header '/Users/softech/Desktop/vsts-agent-osx-x64-2.136.1/_work/r2/a/Application/ios/build/VidizmoMobileApp/Build/Intermediates.noindex/PrecompiledHeaders/VidizmoMobileApp-Bridging-Header-swift_G3EOBN6WTSYG-clang_3DYYERZEW34TU.pch' for bridging header /Users/softech/Desktop/vsts-agent-osx-x64-2.136.1/_work/r2/a/Application/ios/VidizmoMobileApp-Bridging-Header.h ❌错误:无法发出预编译的标头'/Users/softech/Desktop/vsts-agent-osx-x64-2.136.1/_work/r2/a/Application/ios/build/VidizmoMobileApp/Build/Intermediates.noindex/PrecompiledHeaders/ VidizmoMobileApp-Bridging-Header-swift_G3EOBN6WTSYG-clang_3DYYERZEW34TU.pch',用于桥接标头/Users/softech/Desktop/vsts-agent-osx-x64-2.136.1/_work/r2/a/Application/ios/VidizmoHeadApp-Bridging H

error Failed to build iOS project. 错误无法构建iOS项目。 We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening VidizmoMobileApp.xcworkspace 我们运行了“ xcodebuild”命令,但它退出,错误代码为65。要进一步调试构建日志,请考虑通过打开VidizmoMobileApp.xcworkspace使用Xcode.app构建您的应用程序

Answering my own question, as mentioned in the third step of this guide https://facebook.github.io/react-native/docs/linking-libraries-ios 如本指南第三步所述,回答我自己的问题https://facebook.github.io/react-native/docs/linking-libraries-ios

I also need to add the third party module in the HeaderSearchPath array as given in the picture 我还需要如图所示在HeaderSearchPath数组中添加第三方模块

在此处输入图片说明

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM