OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.57k stars 373 forks source link

Build fails with react-native 0.64.1 under Xcode 12.5 #1223

Closed pnogier closed 3 years ago

pnogier commented 3 years ago

Hi there,

I just upgraded to Xcode 12.5, Upgraded react-native from 0.62.2 to 0.64.1, Upgraded react-native-onesignal from 3.9.0 to 4.1.0

Now when I try to build my app, I get the following error : ld: library not found for -lPods-OneSignalNotificationServiceExtension

None on the solutions listed in #1179 or #1103 solved my issue.

Here is my Podfile

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '12.0'

target 'Spacial' do
  # Pods for Spacial
  pod 'Stripe', '~> 21.5.1'
  pod 'tipsi-stripe', :path => '../node_modules/tipsi-stripe'

  #pod 'react-native-onesignal', :path => '../node_modules/react-native-onesignal'

  pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen'

  pod 'RNDeviceInfo', :path => '../node_modules/react-native-device-info'

  config = use_native_modules!
  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => false
  )

  target 'SpacialTests' do
    inherit! :complete
    # Pods for testing
  end

  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    installer.pods_project.build_configurations.each do |config|
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
    end
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
       config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
      end
     end
  end
end

target 'OneSignalNotificationServiceExtension' do
  pod 'OneSignal', '>= 3.0', '< 4.0'
end

Did some of you already faced this issue and find a solution ?

Thank you,

Cheers

pnogier commented 3 years ago

Well, I guess I found why this happened :

Each time I run a pod install, it automatically add the libPods-OneSignalNotificationServiceExtension.a under Framework and Libraries in my OneSignalNotificationServiceExtension Target. I juts had to remove it manually and everything builds properly now.

However I now have to find why this library automatically adds itself and fix it. 🤗

Closing for now.

MathiasMoralesDixtra commented 3 years ago

Well, I guess I found why this happened :

Each time I run a pod install, it automatically add the libPods-OneSignalNotificationServiceExtension.a under Framework and Libraries in my OneSignalNotificationServiceExtension Target. I juts had to remove it manually and everything builds properly now.

However I now have to find why this library automatically adds itself and fix it. 🤗

Closing for now.

Do you have news about that? I have the same issue.

MathiasMoralesDixtra commented 3 years ago

In my case, I fixed when I set the same version on Podfileplatform :ios, '11.0' that on Target in OneSignal notification and Project.

Screen Shot 2021-08-04 at 15 30 18 Screen Shot 2021-08-04 at 15 30 06
pnogier commented 3 years ago

Hi @MathiasMoralesDixtra, Thank you for the suggestion, I'll give it a try soon :)

vokecodes commented 3 years ago

You need to check the platform version in your Podfile and make it match your main target deployment info and one signal target

pisacode commented 2 years ago

I accidentally opened .xcodeproject file instead of .xcworkspace and the same error appeared. Got me 30 minutes to figure out to open the correct file.