sakshya73
sakshya73

Reputation: 7172

dyld: Library not loaded: @rpath/OneSignal.framework/OneSignal

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. :)

Upvotes: 8

Views: 4092

Answers (4)

maxfloden
maxfloden

Reputation: 325

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

Upvotes: 0

Alistor
Alistor

Reputation: 149

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.

Upvotes: 0

kk4
kk4

Reputation: 138

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!!

Upvotes: 1

sakshya73
sakshya73

Reputation: 7172

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.

Upvotes: 9

Related Questions