xcodereact-nativepush-notificationreact-native-onesignal

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


Solution

  • 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.