How to link missing pod headers - Xcode 11.2.1

514 views Asked by At

I'm killing myself over trying to get a Pod linked & the project up and running. For some background: I am running a ReactNative (version 0.61.5) project and am using Xcode 11.2.1; the current cocoapods version is 1.9.1. It should also be noted that I am no iOS+Xcode expert.

The problematic package here is @bugsnag/react-native; specifically, the problem lies with the underlying native library, bugsnag-cocoa. When building the project, I am getting the following error:

Swift Compiler Error: No such module 'Bugsnag

While the Pod is installed, it looks like the public headers aren't being linked correctly.

Pod available in Pods project

I do not see anything that jumps out as a bug in @bugsnag/react-native's podspec file (https://github.com/bugsnag/bugsnag-js/blob/next/packages/react-native/BugsnagReactNative.podspec). The weird thing is, when I spin up a clean react-native project, and install @bugsnag/react-native, I don't run into issues--the pod is linked correctly and the project runs.

I tried adding the vendor lib, bugsnag-cocoa, to my project workspace; then proceeded to move the Bugsnag framework to my Frameworks, Libraries and Embedded Content--this worked locally, however, breaks in CI/CD :sadface:

I also tried to add bugsnag-cocoa as a sub-library of my project; however, I cannot do anything with the library from that point ... I can't click on the lib? Why is that?

Bugsnag project icon is opaque & unclickable


Is there anyway I can manually add the headers from the pod to my project? I tried adding the path, to the pod's vendor files, in the proj target's Build Settings -> Library Search Paths and Build Settings -> Header Search Paths--this did not work, I am still getting no such module Bugsnag. It's very possible I missed something fwiw.

P.S. I have the .xcworkspace opened, so that isn't the issue and I made sure to run pod install (amongst other permutations such as pod install --repo-update and pod update).

1

There are 1 answers

1
Div-dog On BEST ANSWER

It looks like you're using swift. You should include #import <Bugsnag/Bugsnag.h> in your bridging header file. Once you do that you shouldn't need to import Bugsnag into your AppDelegate file as Bugsnag will already be available.