你好,我正在开发 React Native 项目,我使用这个 How to convert iOS react native template to swift? 从 Objective-C 转换为 swift线程。
现在我想用这个 https://github.com/wonday/react-native-orientation-locker要集成此库,我需要导入方向类,但是当我导入方向类时出现错误
这是我的项目层次结构
所以我的问题是我们如何在swift项目中导入objective c文件或者我们如何在桥接头文件中导入第三方库
当我以这种方式导入它时
#import "Orientation/Orientation.h"
我收到以下错误
❌ 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
error Failed to build iOS project. 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
最佳答案
回答我自己的问题, 如本指南第三步所述https://facebook.github.io/react-native/docs/linking-libraries-ios
我还需要在 HeaderSearchPath 数组中添加第三方模块,如图所示
关于objective-c - 如何在 swift 中导入 Objective c 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56955495/