OneSignal-Flutter-SDK
OneSignal-Flutter-SDK copied to clipboard
[Bug]: Closes after building the App
What happened?
The application is built correctly. But when it opens after installing it on IOs it simply closes, still on the screen before the splash screen created, for no apparent reason. If I remove the OneSignal package everything works correctly.
Steps to reproduce?
1. Dependencies in the project, All packages are updated to the latest version.
# Networking
dio: ^5.3.3
http: ^1.1.0
socket_io_client: ^2.0.3+1
#Chat
chat_bubbles: ^1.5.0
# Localization
flutter_google_places_sdk: ^0.3.7
geolocator: ^10.1.0
google_maps_flutter: ^2.5.0
# onesignal
onesignal_flutter: ^5.0.2
# State Management
flutter_bloc: ^8.1.3
rxdart: ^0.27.7
# Dependency Injection
get_it: ^7.6.4
# General
equatable: ^2.0.5
google_fonts: ^6.1.0
cached_network_image: ^3.3.0
dartz: ^0.10.1
#rota
go_router: ^11.1.2
#Animações
lottie: ^2.6.0
#Camera and Images
camera: ^0.10.5+5
path_provider: ^2.1.1
path: ^1.8.3
# Renderizar arquivos SVG
flutter_svg: ^2.0.7
# Formatações
intl: any
mask_text_input_formatter: ^2.5.0
# Auth
google_sign_in: ^6.1.5
flutter_facebook_auth: ^6.0.2
sign_in_with_apple: ^5.0.0
# Firebase
firebase_core: ^2.17.0
firebase_auth: ^4.10.1
#image
image_cropper: ^5.0.0
image_picker: ^1.0.4
flutter_native_image: ^0.0.6+1
file_picker: ^5.5.0
# Animations
flutter_spinkit: ^5.2.0
multiselect_formfield: ^0.1.7
multi_select_flutter: ^4.1.3
cpf_cnpj_validator: ^2.0.0
brasil_fields: ^1.14.0
font_awesome_flutter: ^10.5.0
2 - My PodFile
# Uncomment this line to define a global platform for your project
platform :ios, '13.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
# Pods for Runner
pod 'AmazonChimeSDK-Bitcode', '~> 0.22.4'
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
xcconfig_path = config.base_configuration_reference.real_path
xcconfig = File.read(xcconfig_path)
xcconfig_mod = xcconfig.gsub(/DT_TOOLCHAIN_DIR/, "TOOLCHAIN_DIR")
File.open(xcconfig_path, "w") { |file| file << xcconfig_mod }
end
end
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
installer.pods_project.build_configurations.each do |config|
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
end
end
What did you expect to happen?
Run the application correctly.
OneSignal Flutter SDK version
onesignal_flutter: ^5.0.2
Which platform(s) are affected?
- [X] iOS
- [ ] Android
Relevant log output
Log xCode.
First throw call stack:
(
0 CoreFoundation 0x00000001176a928d __exceptionPreprocess + 242
1 libobjc.A.dylib 0x0000000115e92894 objc_exception_throw + 48
2 CoreFoundation 0x00000001176be3a3 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
3 CoreFoundation 0x00000001176ada20 ___forwarding___ + 1459
4 CoreFoundation 0x00000001176afc28 _CF_forwarding_prep_0 + 120
5 OneSignalNotifications 0x000000011139bb71 +[OSNotificationsManager registerForAPNsToken] + 147
6 OneSignalFramework 0x0000000113302677 +[OneSignal init] + 268
7 Runner 0x0000000104cee6b7 +[OneSignalPlugin registerWithRegistrar:] + 71
8 Runner 0x00000001044d4718 +[GeneratedPluginRegistrant registerWithRegistry:] + 1336
9 Runner 0x00000001044d4909 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 233
10 Runner 0x00000001044d4ba7 $s6Runner11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 183
11 UIKitCore 0x0000000137178e12 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 297
12 UIKitCore 0x000000013717abeb -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4253
13 UIKitCore 0x0000000137180762 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1241
14 UIKitCore 0x00000001364c864d -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
15 UIKitCore 0x0000000136ba3e1a _UIScenePerformActionsWithLifecycleActionMask + 87
16 UIKitCore 0x00000001364c91ab __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
17 UIKitCore 0x00000001364c8c0c -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 249
18 UIKitCore 0x00000001364c8ff4 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 813
19 UIKitCore 0x00000001364c8820 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 341
20 UIKitCore 0x00000001364d4da0 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_blo 21 UIKitCore 0x0000000136a56008 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 865
22 UIKitCore 0x0000000136bc243b _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 261
23 UIKitCore 0x00000001364d4a2f -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 347
24 UIKitCore 0x00000001362ad17f __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.610 + 877
25 UIKitCore 0x00000001362abb34 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 245
26 UIKitCore 0x00000001362acce7 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 252
27 UIKitCore 0x000000013717efb4 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 672
28 UIKitCore 0x0000000136a8af66 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 353
29 FrontBoardServices 0x00000001183b66ad -[FBSScene _callOutQueue_didCreateWithTransitionContext:completion:] + 406
30 FrontBoardServices 0x00000001183e87bb __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.254 + 279
31 FrontBoardServices 0x00000001183c6313 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 213
32 FrontBoardServices 0x00000001183e84b5 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 328
33 libdispatch.dylib 0x00000001173199f7 _dispatch_client_callout + 8
34 libdispatch.dylib 0x000000011731d389 _dispatch_block_invoke_direct + 507
35 FrontBoardServices 0x0000000118413e3d __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
36 FrontBoardServices 0x0000000118413d17 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 188
37 FrontBoardServices 0x0000000118413e65 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 19
38 CoreFoundation 0x0000000117605d0f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
39 CoreFoundation 0x0000000117605c51 __CFRunLoopDoSource0 + 157
40 CoreFoundation 0x000000011760544e __CFRunLoopDoSources0 + 215
41 CoreFoundation 0x00000001175ffb83 __CFRunLoopRun + 919
42 CoreFoundation 0x00000001175ff409 CFRunLoopRunSpecific + 557
43 GraphicsServices 0x000000011e85b187 GSEventRunModal + 137
44 UIKitCore 0x000000013717d3a2 -[UIApplication _run] + 972
45 UIKitCore 0x0000000137181e10 UIApplicationMain + 123
46 Runner 0x00000001044d4d0f main + 63
47 dyld 0x000000010e3023ee start_sim + 10
48 ??? 0x0000000205a643a6 0x0 + 8684716966
)
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Flutter 3.13.6 • channel stable • https://github.com/flutter/flutter.git Framework • revision ead455963c (7 days ago) • 2023-09-26 18:28:17 -0700 Engine • revision a794cf2681 Tools • Dart 3.1.3 • DevTools 2.25.0
Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel stable, 3.13.6, on macOS 14.0 23A344 darwin-arm64, locale pt-BR) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 15.0) [✓] Chrome - develop for the web [✓] Android Studio (version 2021.2) [✓] VS Code (version 1.82.3) [✓] Connected device (3 available) [✓] Network resources
cocoaPods: 1.13.0
@rodrigonepomuceno Thank you for reporting this looks like a crash in OneSignal's code to receive the apns push token. Are you using any other libraries that might care about the push token?
Hey @emawby. I found the problem.
When removing this reference below the info.plist it worked again, I believe it generates some conflict with the OneSignal package
<key>UIBackgroundModes</key>
<string>location</string>
@rodrigonepomuceno Interesting thank you for investigating I will continue trying to reproduce but I am not getting this crash when including location (and other) background modes