braze-inc / braze-expo-plugin

Other
11 stars 10 forks source link

[Bug]: The Swift pod `ExpoAdapterBraze` depends upon `react-native-appboy-sdk`, which does not define modules #5

Closed christophe-chausseray closed 1 year ago

christophe-chausseray commented 1 year ago

Which Platforms?

iOS

Which React Native Version?

0.70.5

Which @braze/expo-plugin version?

0.4.0

Which react-native-appboy-sdk SDK version?

1.40.0

Repro Rate

100% of the time

Steps To Reproduce

Example:

  1. npx create-expo-app expo-braze-app
  2. npm install react-native-appboy-sdk@1.40.0 @braze/expo-plugin@0.4.0
  3. Add plugin config in the app.json
    "plugins": [
    [
      "@braze/expo-plugin",
      {
        "androidApiKey": "ANDROID_API_KEY",
        "iosApiKey": "IOS_API_KEY",
        "baseUrl": "BRAZE_URL",
        "enableBrazeIosPush": true,
        "enableFirebaseCloudMessaging": true,
        "firebaseCloudMessagingSenderId": "SENDER_ID"
      }
    ]
    ]
  4. npx expo prebuild -> get an error Something went wrong running pod install in the ios directory. Command pod install failed.
  5. Run cd ios/ && pod install to try to install the iOS dependencies manually and check if I can get more details on the error.

Expected Behavior

It should install iOS pods without errors.

Actual Incorrect Behavior

Instead, I get this error on the pod install

Installing react-native-appboy-sdk (1.40.0)
[!] The following Swift pods cannot yet be integrated as static libraries:

The Swift pod `ExpoAdapterBraze` depends upon `react-native-appboy-sdk`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies

Verbose Logs

The Swift pod `ExpoAdapterBraze` depends upon `react-native-appboy-sdk`, which does not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies

Additional Information

If we don't want to modify the Podfile of our app (as we are in managed workflow), it looks like that something needs to be added in the podspec of the react-native-appboy-sdk (https://blog.cocoapods.org/CocoaPods-1.5.0/)

wesleyorbin commented 1 year ago

Hi @christophe-chausseray. Apologies for the delay. I was unable to reproduce the issue with the above steps. If you look in your Podfile.properties.json, do you see "ios.useFrameworks": "static"? Our plugin adds that property to prevent this issue so if something in your project overwrites that value, it could cause it to pop up again.

In the near future, the React Native SDK will use the Braze Swift SDK, which should prevent this error from occurring and remove the need for that property.

christophe-chausseray commented 1 year ago

Indeed, I saw that on our project which is using Expo 46.

We got this error only when we added the flipper plugin to use flipper. By default, this plugin was commenting this line use_frameworks! :linkage => podfile_properties['ios.useFrameworks'].to_sym if podfile_properties['ios.useFrameworks'] in the podfile.

I had to set the parameter stripUseFrameworks: false explicitly in the flipper plugin configuration to make the installation of our pods working.

Thanks for your answer. Sorry about this issue, the problem was not directly link to your plugin in fact. So, I think it can be closed. :)

Btw, I don't know if you already checked it but I created another issue to be able to use your plugin in Expo 47. Do you think that it something you are planning in a near future @wesleyorbin as well ?