dyld: Library not loaded: @rpath/OneSignal.framework/OneSignal
Asked Answered
S

4

8

Trying to integrate one signal in my react native app.

I followed all the instructions mentioned in the docs https://documentation.onesignal.com/docs/react-native-sdk-setup.

The build for the app gets succeeded but I get an error while attaching the app to the device.

Xcode opens a thread with a title dyld__abort_with_payload.

Here's the image of it. enter image description here

And when I look into the errors. The Errors look like this.

dyld: Library not loaded: @rpath/OneSignal.framework/OneSignal
  Referenced from: /Users/sakshyaarora/Library/Developer/CoreSimulator/Devices/357B8E50-B8A6-4F9D-AE06-40DD8004351E/data/Containers/Bundle/Application/242BEDF6-76CD-4516-BF58-C86C43F6C4D4/Test.app/Test
  Reason: image not found
dyld: launch, loading dependent libraries
DYLD_SHARED_CACHE_DIR=/Users/sakshyaarora/Library/Developer/CoreSimulator/Caches/dyld/20F71/com.apple.CoreSimulator.SimRuntime.iOS-14-5.18E182
DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot
DYLD_LIBRARY_PATH=/Users/sakshyaarora/Library/Developer/Xcode/DerivedData/Test-djshtsdmeowdbaebqzmujevyppyj/Build/Products/Debug-iphonesimulator:/Users/sakshyaarora/Sites/projects/Test/Builds/iOS/build/Debug/-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection
DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applica

It's been hours since I am trying this out. Any help would be appreciated.

Thanks in advance. :)

Sapor answered 6/7, 2021 at 15:15 Comment(2)
did you ended up fixing this? I'm having the same issue.Ironwork
Yes, I was able to fix this issue but the solution was very weird...that's why I didn't post it in the answer...I'll update the answer in some time maybe it can help.Sapor
S
9

The solution I got is really very weird and it just came out while trying and was able to resolve this issue for me. So if anyone here is getting the same error can try this.

Steps

Open Xcode -> Select your app in the Targets -> Go to General Tab -> Frameworks, Libraries and Embedded Content.

Click on + . Search for OneSignal in it and add OneSignal.xcframework.

enter image description here

Here comes the weird part.

After OneSignal.xcframework is added. Just remove this OneSignal.xcframework by selecting and clicking -.

Now just build your app again. Your app should run now.

Sapor answered 22/7, 2021 at 6:12 Comment(3)
As I can see, this weird manipulation adds "@executable_path/Frameworks" to the Linking -> Runpath Search PathIlluviation
Yes, it was correct - after adding paths app starts normally!Illuviation
I was able to solve this issue in your way but adding "OneSignalCore" & "OneSignalOutcomes" and keeping it on the framework list as "Embed & Sign". Also, move this pods from OneSignalNotificationServiceExtension to the app main target. More here github.com/OneSignal/react-native-onesignal/issues/1459Sheryllshetland
E
1

If you are facing the same issue in Flutter or React-Native Then you should try to create a OneSignalNotificationServiceExtension in the Targets and add this extension in Frameworks, Libraries and Embedded Content section of Target>General.

You can follow the following steps:

  1. Open Runner.xcworkspace from the iOS folder of your project
  2. Click on "+" icon to add a Target and search for Notification Service Extension

enter image description here

  1. Create a new Notification Service Extension for OneSignal, select your team and keep the rest as default.

  2. In the next step go to General Tab > Frameworks,Libraries and Embedded Content and add "OneSignalCore.xcframework", "OneSignalOutcomes.xcframework" by clicking the "+" icon and keep it on the framework list as "Embed & Sign", also add the newly created Notification Service Extension as shown in the below screenshot.

enter image description here

  1. Next Step is to add and remove(yes that's right) the "OneSignal.xcframework" (please be careful with the name, this one is just onesignal...), so you have to add OneSignal.xcframework in General Tab > Frameworks,Libraries and Embedded Content by clicking the "+" icon and then remove it by selecting this list item and clicking the "-" icon.

After doing these steps you can simply clean your project and run it, it should work!!

Escaut answered 14/2, 2023 at 10:19 Comment(0)
R
0

Thanks to @sakshya73 for his helpful response. After completing the task, I encountered the same error again. However, I managed to resolve it by navigating to the iOS directory and executing

  • pod cache clean --all
  • pod deintegrate
  • pod install

After performing these steps, I attempted to build again, and this time, it was successful.

Reboant answered 14/2 at 5:28 Comment(0)
K
0

I got error: Library not loaded: @rpath/OneSignal.framework/Versions/A/OneSignal when using the OneSignal Cordova plugin.

When I built my Ionic Cordova project I also got this warning which I ignored: target overrides the 'LD_RUNPATH_SEARCH_PATHS' build setting defined in 'Pods/Target Support Files/Pods-Interante/Pods-Interante.release.xcconfig'. This can lead to problems with the CocoaPods installation.

However it turns out the fix in my situation was in fact related to the LD_RUNPATH_SEARCH_PATHS warning.

Solution was to in Xcode change Target - > Building Settings- > Linking - General -> Runpath Search Paths to $(inherited) (was previously set to @executable_path/Frameworks)

Thanks to nosTa in this post.

Hope this helps someone

Katabolism answered 10/9 at 10:25 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.