Skip to content

iOS crash on scheduleNotification OnApplicationFocus #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
yaKashif opened this issue Mar 14, 2019 · 0 comments
Open

iOS crash on scheduleNotification OnApplicationFocus #125

yaKashif opened this issue Mar 14, 2019 · 0 comments

Comments

@yaKashif
Copy link

yaKashif commented Mar 14, 2019

Thank you for this amazing library!

Issue:
App crashes if notification is scheduled when focused out or in on iOS.

public void OnApplicationFocus(bool hasFocus)
    {
        if(!hasFocus)
        {
                LocalNotification.SendNotification(....);
        }
    }
2019-03-14 06:54:49.214033+0500 appname[2468:1178803] Uncaught exception: NSInvalidArgumentException: *** +[NSString stringWithUTF8String:]: NULL cString
(
	0   CoreFoundation                      0x000000021c748edc <redacted> + 252
	1   libobjc.A.dylib                     0x000000021b919a40 objc_exception_throw + 56
	2   CoreFoundation                      0x000000021c64f594 <redacted> + 0
	3   Foundation                          0x000000021d0c3584 <redacted> + 92
	4   appname  			        0x00000001029f5fd8 scheduleNotification + 160
	5   appname                 		0x0000000103b66134 LocalNotification_scheduleNotification_m1D87FF490C547FDCFE9CAC0B800BA52A1D6D92E0 + 88
	6   appname                 		0x0000000103b65afc LocalNotification_SendNotification_m3A2C472D8829D79D92127D504778661B1E35FCB4 + 356
	7   appname                 		0x0000000103b687c4 LocalNotificationsManager_sendNotification_mE8B033347EDBCA808E53995CEA28D0CB28441841 + 288
	8   appname                 		0x0000000103b684f4 LocalNotificationsManager_DailyNotifications_m5DDDA1FB81255E27DD101CA2CC14386CDC6D8E69 + 4684
	9   appname				0x0000000103b2a5c0 GameDirector_OnApplicationFocus_mCA479C26545706BECFCDC3F3C207A0918A6E1B6C + 240
	10  appname				0x0000000102964768 _Z113RuntimeInvoker_TrueVoid_t22962CB4C05B1D89B55A6E1139F0E87A90987017_SByte_t9070AEA2966184235653CB9B4D33B149CDA831DFPFvvEPK10MethodInfoPvPS4_ + 72
	11  appname				0x0000000103a2b514 _ZN6il2cpp2vm7Runtime6InvokeEPK10MethodInfoPvPS5_PP15Il2CppException + 108
	12  appname				0x000000010332d53c _Z23scripting_method_invoke18ScriptingMethodPtr18ScriptingObjectPtrR18ScriptingArgumentsP21ScriptingExceptionPtrb + 100
	13  appname				0x0000000103337be0 _ZN19ScriptingInvocation6InvokeEP21ScriptingExceptionPtrb + 92
	14  appname				0x0000000103344d2c _ZN13MonoBehaviour19HandleNotificationsEPviR11MessageData + 476
	15  appname				0x0000000102de72b0 _ZN14MessageHandler13HandleMessageEPvjRK17MessageIdentifierR11MessageData + 100
	16  appname				0x0000000102de7208 _ZN10GameObject14SendMessageAnyERK17MessageIdentifierR11MessageData + 296
	17  appname				0x0000000103107f40 _Z21SendMessageToEveryoneRK17MessageIdentifier11MessageData + 216
	18  appname				0x0000000103121e14 _Z14SetPlayerFocusbb + 140
	19  appname				0x000000010246f3f0 -[UnityAppController applicationWillResignActive:] + 84
	20  appname				0x0000000103a9d310 -[OneSignalAppDelegate oneSignalApplicationWillResignActive:] + 172
	21  UIKitCore                           0x000000024964cc14 <redacted> + 868
	22  UIKitCore                           0x0000000248ef49b0 <redacted> + 1168
	23  UIKitCore                           0x0000000248ef555c _performActionsWithDelayForTransitionContext + 112
	24  UIKitCore                           0x0000000248ef44b4 <redacted> + 248
	25  UIKitCore                           0x0000000248ef93a0 <redacted> + 368
	26  UIKitCore                           0x000000024923ee60 <redacted> + 468
	27  FrontBoardServices                  0x000000021f1806e4 <redacted> + 228
	28  libdispatch.dylib                   0x000000021c182484 <redacted> + 16
	29  libdispatch.dylib                   0x000000021c125e10 <redacted> + 224
	30  FrontBoardServices                  0x000000021f1bea9c <redacted> + 40
	31  FrontBoardServices                  0x000000021f1be728 <redacted> + 416
	32  FrontBoardServices                  0x000000021f1bed44 <redacted> + 56
	33  CoreFoundation                      0x000000021c6d91f0 <redacted> + 24
	34  CoreFoundation                      0x000000021c6d9170 <redacted> + 88
	35  CoreFoundation                      0x000000021c6d8a54 <redacted> + 176
	36  CoreFoundation                      0x000000021c6d3920 <redacted> + 1040
	37  CoreFoundation                      0x000000021c6d31f0 CFRunLoopRunSpecific + 436
	38  GraphicsServices                    0x000000021e94c584 GSEventRunModal + 100
	39  UIKitCore                           0x00000002496574c0 UIApplicationMain + 212
	40  appname				0x0000000102447504 main + 212
	41  libdyld.dylib                       0x000000021c192bb4 <redacted> + 4
)

Even if I change the !hasFocus to hasFocus it still crashes.

public void OnApplicationFocus(bool hasFocus)
{
   if(hasFocus)
   {
       LocalNotification.SendNotification(....);
   }
 }

IOS 12.1.4
Unity 2018.1, 2018.3
Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant