尝试将
one signal
集成到我的 React Native 应用程序中。
我遵循了文档中提到的所有说明 https://documentation.onesignal.com/docs/react-native-sdk-setup。
应用程序的构建成功,但在将应用程序附加到设备时出现错误。
Xcode 打开一个标题为
dyld__abort_with_payload
的线程。
当我调查错误时。错误看起来像这样。
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
我尝试这个已经好几个小时了。任何帮助将不胜感激。
提前致谢。 :)
如果您在 Flutter 或 React-Native 中遇到同样的问题 然后您应该尝试在目标中创建一个
OneSignalNotificationServiceExtension
并将此扩展添加到 Frameworks, Libraries and Embedded Content
的 Target>General
部分。
您可以按照以下步骤操作:
Runner.xcworkspace
Notification Service Extension
为 OneSignal 创建一个新的
Notification Service Extension
,选择您的团队,其余保持默认。
在下一步中,转到
General Tab > Frameworks,Libraries and Embedded Content
并通过单击“+”图标添加“OneSignalCore.xcframework”、“OneSignalOutcomes.xcframework”,并将其保留在框架列表中作为“嵌入并签名”,也添加新创建的Notification Service Extension
,如下面的屏幕截图所示。
OneSignal.xcframework
中添加
General Tab > Frameworks,Libraries and Embedded Content
单击“+”图标,然后选择此列表项并单击“-”图标将其删除。
完成这些步骤后,您可以简单地清理您的项目并运行它,它应该可以工作!!
感谢@sakshya73 的有用回复。 完成任务后,我又遇到了同样的错误。但是,我设法通过导航到 iOS 目录并执行来解决它
执行完这些步骤后,我再次尝试构建,这次成功了。