OneSignal / OneSignal-Flutter-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your flutter app with OneSignal
https://www.onesignal.com
Other
625 stars 214 forks source link

[Bug]: Facing AppId is null or format is invalid in Flutter iOS Only. Working in Android. AppID is not Null in Init Code. #781

Closed asgharas closed 1 year ago

asgharas commented 1 year ago

What happened?

When I install my Flutter app on an iOS device, I always enconuter Error with message AppId is null or format is invalid. Although the AppID is not null/empty/of wrong format in the flutter init code. Works fine on Android.

Before you ask, I have:

Steps to reproduce?

1. Follow the FLutter SDK guide on OneSignal's Docs.
2. Run the app on iOS Device.

What did you expect to happen?

I expected the app to not crash.

OneSignal Flutter SDK version

onesignal_flutter: ^5.0.2

Which platform(s) are affected?

Relevant log output

(lldb) 2023-11-01 03:01:30.132503+0500 Runner[805:59021] [SceneConfiguration] Info.plist contained no UIScene configuration dictionary (looking for configuration named "(no name)")
[VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(37)] Using the Impeller rendering backend.
Warning: Unable to create restoration in progress marker file
database path: /var/containers/Bundle/Application/E0930B29-65A5-4F98-8058-4ED3BF68EBD6/Runner.app/Frameworks/flutter_downloader.framework/FlutterDownloaderDatabase.bundle/download_tasks.sql
AllFilesDownloadedMessage: All files have been downloaded
FATAL: OneSignal AppId: (null) - AppId is null or format is invalid, stopping initialization.
Example usage: 'b2f7f966-d8cc-11e4-bed1-df8f05be55ba'
fopen failed for data file: errno = 2 (No such file or directory)
Errors found! Invalidating cache...
Connecting to VM Service at ws://127.0.0.1:61746/KNPSXVjZXvc=/ws
startBackgroundIsolate
[VERBOSE-2:FlutterDarwinContextMetalImpeller.mm(37)] Using the Impeller rendering backend.
*** Assertion failure in -[FlutterDownloaderPlugin startBackgroundIsolate:], FlutterDownloaderPlugin.m:152
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'failed to set registerPlugins'
*** First throw call stack:
(0x191041e48 0x18a3178d8 0x18b90694c 0x102616c5c 0x10261ca8c 0x10261fe44 0x105af3f0c 0x105558e1c 0x1986534b4 0x198654fdc 0x1986637f4 0x198663444 0x1910d26d8 0x1910b403c 0x1910b8ec0 0x1cb10f368 0x1935ae86c 0x1935ae4d0 0x1020f86b8 0x1af8da960)
libc++abi: terminating with uncaught exception of type NSException
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00000001ce9b3160 libsystem_kernel.dylib`__pthread_kill + 8
libsystem_kernel.dylib`:
->  0x1ce9b3160 <+8>:  b.lo   0x1ce9b3180               ; <+40>
    0x1ce9b3164 <+12>: pacibsp
    0x1ce9b3168 <+16>: stp    x29, x30, [sp, #-0x10]!
    0x1ce9b316c <+20>: mov    x29, sp
Target 0: (Runner) stopped.
Lost connection to device.

Code of Conduct

asgharas commented 1 year ago

I had mistakenly moved the OneSignal init code to after the runApp code. P.S: I was the DUMB guy.