React-native-onesignal: React-native 0.60 -lPods-OneSignalNotificationExtension not found

Created on 2 Sep 2019  ·  20Comments  ·  Source: OneSignal/react-native-onesignal

Description:

I've upgraded to React-native 0.60 and have followed the onesignal installation steps as shown here: https://documentation.onesignal.com/docs/react-native-sdk-setup

When I goto run the xcode application, I get an error relating to the OnesignalNotificationExtension.
Error: ld: library not found for -lPods-OneSignalNotificationServiceExtension

The OneSignalNotificationServiceExtension target has the following settings:

  • Header search paths: "${PODS_ROOT}/Headers/Public/react-native-onesignal"
  • Framework search paths: "${PODS_ROOT}/OneSignal/iOS_SDK/OneSignalSDK/Framework"

Environment

  • react-native-onesignal version: 3.3.2
  • react-native: 0.60.5

Steps to Reproduce Issue:

  1. Followed the RN setup: https://documentation.onesignal.com/docs/react-native-sdk-setup
  2. Run xcode project
  3. Expect to see: ld: library not found for -lPods-OneSignalNotificationServiceExtension
Help Wanted

Most helpful comment

I had the same problem when upgrading the RN version to 0.63.2 and trying to archive the app and I got fixed
by this.

It was a version mismatch between the version I specified in Podfile and the Target version that
I set for the OneSignal extension. As soon as I modified those two values to match each other,
the problem was gone.

Podfile
image

OneSignalNotificationExtension (or whatever you named to the notification extension)
image

All 20 comments

Howdy,
We released a new version yesterday. Can you please update and try again? Also try clearing your DerivedData folder located at /Users//Library/Developer/Xcode/DerivedData

Last thing to try is pod update from your ios directory

@jamesone did you solve this problem? The answer from @rgomezp does not help.
 

@rgomezp none of the above suggestions worked, using the latest release 3.4.1. Could do with some attention on this issue. Forced to remove OneSignalNotificationExtension until resolved, happy to try other suggestions/releases.

+1 following !

Howdy,
Please try running pod deintegrate && pod install from the ios directory in your project

Above suggestions are not working. Already updated to latest release v3.4.1, clean derived data, clean pods and reinstall but still getting error:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTOneSignalExtensionService", referenced from:
      objc-class-ref in NotificationService.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Podfile.lock

  - react-native-onesignal (3.4.1):
    - OneSignal (= 2.11.0)
    - React (< 1.0.0, >= 0.13.0)

UPDATE:
My bad. Turns out I need to replace the NotificationService.m contents with the latest code in DOC. I was still using RCTOneSignalExtensionService.h. Upon updating, the error is gone.

Great to hear! Please comment if you are still struggling with this issue and I can reopen

Its still issue in RN:0.60.10 with pod.
how to use pod with it ?

Hi,
I have same issueld: library not found for -lPods-OneSignalNotificationServiceExtension
I'm using react-native 0.61.4 and onesignal 3.6.1

with pod deintegrate and cleaning and DerivedData

I have found, but I don't know why, when I don't have a "Release" configuration in my configurations list, the "archive" fail with library not found.

archive fail :
Capture d’écran 2020-01-08 à 17 07 06

archive succeed 👍
Capture d’écran 2020-01-08 à 17 16 44

For your informations, Dev, Preprod & Prod are based on Release. It was working without "Release" on my olders projects with onesignal

Update @rgomezp :

  • Create a new react-native project
  • Add Onesignal
  • build & archive > it's ok
  • Rename "Release" configuration to an other name (like Dev)
  • build & archive > ld: library not found for -lPods-OneSignalNotificationServiceExtension

Above suggestions are not working. Already updated to latest release v3.4.1, clean derived data, clean pods and reinstall but still getting error:

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_RCTOneSignalExtensionService", referenced from:
      objc-class-ref in NotificationService.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Podfile.lock

  - react-native-onesignal (3.4.1):
    - OneSignal (= 2.11.0)
    - React (< 1.0.0, >= 0.13.0)

UPDATE:
My bad. Turns out I need to replace the NotificationService.m contents with the latest code in DOC. I was still using RCTOneSignalExtensionService.h. Upon updating, the error is gone.

This not working for me

  • one-signal (3.6.2)
  • react-native (0.60.0)

Having the same issue right now. -lPods-OneSignalNotificationServiceExtension failed when i've added new schemes. Any updates on that?

same

I had the same problem after upgrading react-native
This fixed my issue https://github.com/OneSignal/react-native-onesignal/issues/651#issuecomment-429062289

I had the same problem when upgrading the RN version to 0.63.2 and trying to archive the app and I got fixed
by this.

It was a version mismatch between the version I specified in Podfile and the Target version that
I set for the OneSignal extension. As soon as I modified those two values to match each other,
the problem was gone.

Podfile
image

OneSignalNotificationExtension (or whatever you named to the notification extension)
image

I have the same problem but none of the tips above solved my problem.

I have 2 projects that are quite similar : one that works and other that does not work.

In xcode build and archive steps are ok but on my CI or on my computer the command below succeeds on one project but fails on the other

xcodebuild "-workspace" "/Users/vagrant/git/packages/mobile-pro/ios/WecasaPro.xcworkspace" "-scheme" "WecasaPro" "-configuration" "Staging" "COMPILER_INDEX_STORE_ENABLE=NO" "archive" "-archivePath" "/var/folders/6q/wgy6jtp12w5gzgm9lzcglpqw0000gn/T/__archive__581470914/WecasaPro.xcarchive" "-destination" "generic/platform=iOS" | xcpretty

If I look at the logs of the command. For the project that works I have

▸ Building Pods/Pods-OneSignalNotificationServiceExtension [Staging]
▸ Check Dependencies
▸ Compiling Pods-OneSignalNotificationServiceExtension-dummy.m
▸ Compiling Pods-OneSignalNotificationServiceExtension-dummy.m
▸ Building library libPods-OneSignalNotificationServiceExtension.a
▸ Building library libPods-OneSignalNotificationServiceExtension.a
▸ Building WecasaPro/OneSignalNotificationServiceExtension [Staging]
▸ Check Dependencies
▸ Processing Info.plist
▸ Running script '[CP] Check Pods Manifest.lock'
▸ Compiling NotificationService.m
▸ Linking OneSignalNotificationServiceExtension
▸ Generating 'OneSignalNotificationServiceExtension.appex.dSYM'
▸ Touching OneSignalNotificationServiceExtension.appex
▸ Signing /Users/vagrant/Library/Developer/Xcode/DerivedData/WecasaPro-fuytaarwfdjqjucxpzvnzgjrhcvd/Build/Intermediates.noindex/ArchiveIntermediates/WecasaPro/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/OneSignalNotificationServiceExtension.appex
▸ Touching OneSignalNotificationServiceExtension.appex.dSYM

For the project that does not work I have

▸ Compiling Pods-OneSignalNotificationServiceExtension-dummy.m
▸ Compiling Pods-OneSignalNotificationServiceExtension-dummy.m
▸ Running script 'Copy generated compatibility header'
▸ Building library libPods-OneSignalNotificationServiceExtension.a

I checked the config of both projects several times and they seem to be similar.

Does anyone have a clue on what can cause this ?

After comparing my logs for the two projects I found that the one that succeeds uses the legacy build system but the other one uses the new build system.

I switched the projet to legacy build system but the problem is still there.

On the project that succeeds I have

CompileC /Users/scesbron/Library/Developer/Xcode/DerivedData/WecasaPro-guwmidkqvxjubvhfovvxnfhourjd/Build/Intermediates.noindex/ArchiveIntermediates/WecasaPro/IntermediateBuildFilesPath/Pods.build/Staging-iphoneos/Pods-OneSignalNotificationServiceExtension.build/Objects-normal/arm64/Pods-OneSignalNotificationServiceExtension-dummy.o Target\ Support\ Files/Pods-OneSignalNotificationServiceExtension/Pods-OneSignalNotificationServiceExtension-dummy.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler

and then

Libtool /Users/scesbron/Library/Developer/Xcode/DerivedData/WecasaPro-guwmidkqvxjubvhfovvxnfhourjd/Build/Intermediates.noindex/ArchiveIntermediates/WecasaPro/IntermediateBuildFilesPath/Pods.build/Staging-iphoneos/Pods-OneSignalNotificationServiceExtension.build/Objects-normal/armv7/libPods-OneSignalNotificationServiceExtension.a normal armv7

but on the other project after the compile I have a Ld command

Ld /Users/scesbron/Library/Developer/Xcode/DerivedData/wecasa-hcsnerxmdxdzhhhetgrrfvjexliq/Build/Intermediates.noindex/ArchiveIntermediates/wecasa/IntermediateBuildFilesPath/wecasa.build/Release-iphoneos/OneSignalNotificationServiceExtension.build/Objects-normal/armv7/OneSignalNotificationServiceExtension normal armv7

I don't know what is the difference between these commands and I don't know why the sequence is not the same

Last comment on my problem. I removed the OneSignalNotificationServiceExtension target, the related objective-c files and the reference to OneSignal in my podfile. The xcodebuild command succeeds.

I've added back one signal by doing all the steps described in the doc https://documentation.onesignal.com/docs/react-native-sdk-setup

After that my xcodebuild command still fails on

Ld /Users/scesbron/Library/Developer/Xcode/DerivedData/wecasa-hcsnerxmdxdzhhhetgrrfvjexliq/Build/Intermediates.noindex/ArchiveIntermediates/wecasa/IntermediateBuildFilesPath/wecasa.build/Release-iphoneos/OneSignalNotificationServiceExtension.build/Objects-normal/armv7/Binary/OneSignalNotificationServiceExtension` normal armv7

the /Users/scesbron/Library/Developer/Xcode/DerivedData/wecasa-hcsnerxmdxdzhhhetgrrfvjexliq/Build/Intermediates.noindex/ArchiveIntermediates/wecasa/IntermediateBuildFilesPath/wecasa.build/Release-iphoneos/OneSignalNotificationServiceExtension.build/Objects-normal/armv7/Binary folder is empty, it does not contain a OneSignalNotificationServiceExtension file.

I have the same issue

So...

This was a really hard one to trace down, I had to recreate a new RN 064.1 project to really find the fix to my issues. I am using schemes in my projects and I was applying fixes so that it'll build properly on M1.

Since the project has updated to using the new OneSignalXCFramework instead of the old fat framework, I decided to update the NSE to use that too in Podfile.

Was facing a ton of issues where the module was not found, including this one during build a release build or building to the simulator or a device

Turns out the part that was screwing with my code and causing the whole issue to not work is this following section in the Podfile

installer.pods_project.build_configurations.each do |config|
    config.build_settings["EXCLUDED_ARCHS[iphonesimulator=*]"] = "arm64"
end

In the end I had to only apply it to debug builds and not release builds. I'm not an iOS dev, so I don't know the intricacies on how excluding a simulator from an architecture would cause Pods to not be detected for the NSE but that was my issue.

Removing the entire block was what fixed it for me. Seems like it's not needed anymore for my project at least.

Was this page helpful?
0 / 5 - 0 ratings