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
.
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. 🙂
2
Answers
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 addOneSignal.xcframework
.Here comes the weird part.
After
OneSignal.xcframework
is added. Just remove thisOneSignal.xcframework
by selecting and clicking -.Now just build your app again. Your app should run now.
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 inFrameworks, Libraries and Embedded Content
section ofTarget>General
.You can follow the following steps:
Runner.xcworkspace
from the iOS folder of your projectNotification Service Extension
Create a new
Notification Service Extension
for OneSignal, select your team and keep the rest as default.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 createdNotification Service Extension
as shown in the below screenshot.OneSignal.xcframework
inGeneral 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!!