You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter项目iOS模拟器集成OneSignal启动失败求助

Flutter iOS模拟器OneSignalOutcomes.framework加载失败解决方法

问题描述

我在Flutter项目中集成了OneSignal,Android端调试及功能运行均正常。但在iOS模拟器中调试时,Xcode构建成功后应用无法启动;直接用Xcode构建后显示白屏,日志提示OneSignalOutcomes.framework加载失败。已按文档步骤完成iOS端配置(如在Podfile和Xcode中添加OneSignalNotificationServiceExtension)。

错误日志

Library not loaded: @rpath/OneSignalOutcomes.framework/OneSignalOutcomes
  Referenced from: <CF59B0E8-635A-39BE-B861-E005A88B49A4> /Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Runner
  Reason: tried: '/Users/umsi06/Library/Developer/Xcode/DerivedData/Runner-hhlxakmdkfjsdeebtbxarwjvblbf/Build/Products/Debug-iphonesimulator/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2)
Library not loaded: @rpath/OneSignalOutcomes.framework/OneSignalOutcomes
  Referenced from: <CF59B0E8-635A-39BE-B861-E005A88B49A4> /Users/umsi06/Library/Developer/CoreSimulator/Devices/BE7B5F40-22D0-40A0-A05E-8B9BEB3FC037/data/Containers/Bundle/Application/09B4A3F6-FB5B-4C01-8139-51FB1AD70204/Runner.app/Runner
  Reason: tried: '/Users/umsi06/Library/Developer/Xcode/DerivedData/Runner-hhlxakmdkfjsdeebtbxarwjvblbf/Build/Products/Debug-iphonesimulator/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2), '/usr/lib/swift/OneSignalOutcomes.framework/OneSignalOutcomes' (errno=2, not in dyld cache), '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/swi
dyld config: DYLD_SHARED_CACHE_DIR=/Users/umsi06/Library/Developer/CoreSimulator/Caches/dyld/22G90/com.apple.CoreSimulator.SimRuntime.iOS-16-2.20C52 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/umsi06/Library/Developer/Xcode/DerivedData/Runner-hhlxakmdkfjsdeebtbxarwjvblbf/Build/Products/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:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/usr/lib/libRPAC.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/umsi06/Library/Developer/Xcode/DerivedData/Runner-hhlxakmdkfjsdeebtbxarwjvblbf/Build/Products/Debug-iphonesimulator DYLD_FALLBACK_FRAMEWORK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks DYLD_FALLBACK_LIBRARY_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib

解决方法

1. 彻底清理构建缓存与Pods

依次执行以下命令清除旧构建残留:

flutter clean
cd ios
pod deintegrate
pod cache clean --all
rm Podfile.lock
rm -rf ~/Library/Developer/Xcode/DerivedData

完成后重新安装Pods:

pod install

重启Xcode后再尝试构建运行。

2. 调整Podfile架构配置

在Podfile的post_install区块中添加模拟器架构支持:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
    # 为所有target配置兼容模拟器的架构
    target.build_configurations.each do |config|
      config.build_settings['ARCHS[sdk=iphonesimulator*]'] = 'x86_64 arm64'
    end
  end
end

修改后重新执行pod install。

3. 验证Xcode构建设置

  • 打开Xcode,选中Runner target进入Build Settings:
    • 检查Framework Search Paths,确保包含$(inherited) $(PROJECT_DIR)/Pods/OneSignalOutcomes路径
    • 查看Embed Frameworks,确认OneSignalOutcomes.framework已添加且Code Sign On Copy选项已勾选
  • 同步检查OneSignalNotificationServiceExtension target的构建设置,确保其架构、框架路径与Runner一致,避免Extension依赖问题影响主App加载。

4. 确认OneSignal版本兼容性

检查pubspec.yaml中onesignal_flutter的版本,确保与iOS端Pod依赖版本匹配。可尝试升级到最新稳定版,或回退到已知兼容版本,之后执行flutter pub get和pod install。

5. 适配M系列芯片模拟器(适用M1/M2/M3设备)

  • 在Xcode选择模拟器时,勾选`Open using Rosetta
相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 14:12:13