superwall / Superwall-iOS

Remotely configure every aspect of your paywall and double your revenue.
https://superwall.com
MIT License
82 stars 22 forks source link

[BUG] Crash in scheduleNotification func #185

Closed seth35us closed 8 months ago

seth35us commented 8 months ago

New issue checklist

General information

Describe the bug

A clear and concise description of what the bug is. The more detail you can provide the faster our team will be able to triage and resolve the issue.

Crash on these lines of code in the NotificationScheduler:

let trigger = UNTimeIntervalNotificationTrigger( timeInterval: delay, repeats: false )

Steps to reproduce

Please also include a description of expected vs. actual behaviour

  1. Add paywall with FreeTrialReminder Notification set to default, which is none.
  2. Make a purchase on that paywall.
  3. Delay is set to an invalid value.

Other Information

e.g. stacktraces, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.

anglinb commented 8 months ago

Thanks for reporting this issue, we'll add a check there to make sure we don't pass invalid data. I imagine this happened in development, right? We speed up the time intervals when in dev so you can easily test

seth35us commented 8 months ago

No, it happened in production. The users got a crash as soon as they made a purchase. This was the first paywall I implemented that had reminder notifications turned on by default, and I didn’t notice it right away.

I disabled the paywall until I could figure out what happened.

I payed for several test purchases using Superwall to isolate the issue.

On Fri, Nov 17, 2023 at 1:41 PM Brian Anglin @.***> wrote:

Thanks for reporting this issue, we'll add a check there to make sure we don't pass invalid data. I imagine this happened in development, right? We speed up the time intervals when in dev so you can easily test

— Reply to this email directly, view it on GitHub https://github.com/superwall-me/Superwall-iOS/issues/185#issuecomment-1817078323, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHWUDRYPZYTVATHNJ3J4ZTYE7DYVAVCNFSM6AAAAAA7QIMAUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGA3TQMZSGM . You are receiving this because you authored the thread.Message ID: @.***>

yusuftor commented 8 months ago

Hey @seth35us, when you say this:

Add paywall with FreeTrialReminder Notification set to default, which is none.

Do you mean it's set like this, with no free trial reminder?

Screenshot 2023-11-20 at 19 28 47

Or do you mean like this, where it defaults to Day 1:

Screenshot 2023-11-20 at 19 31 50

Please can you provide a link to your paywall that you have issues with and a stack trace of the error so I can try and reproduce? Thanks!

seth35us commented 8 months ago

It was set to default to Day 1. It stopped crashing when I removed the free trial reminder.

Here is a link to the paywall: https://superwall.com/applications/1822/paywalls/13500/v3

On Mon, Nov 20, 2023 at 5:32 PM Yusuf Tör @.***> wrote:

Hey @seth35us https://github.com/seth35us, when you say this:

Add paywall with FreeTrialReminder Notification set to default, which is none.

Do you mean it's set like this, with no free trial reminder? [image: Screenshot 2023-11-20 at 19 28 47] https://user-images.githubusercontent.com/3296904/284425461-108013cd-55e6-4ef4-ba9e-44d0066e1305.png

Or do you mean like this, where it defaults to Day 1: [image: Screenshot 2023-11-20 at 19 31 50] https://user-images.githubusercontent.com/3296904/284425844-76bfb63d-0658-4465-a420-4da09f80d87a.png

Please can you provide a link to your paywall that you have issues with and a stack trace of the error so I can try and reproduce? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/superwall-me/Superwall-iOS/issues/185#issuecomment-1820026341, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHWUDTNNXQD56IVB3WTBNTYFPZBZAVCNFSM6AAAAAA7QIMAUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRQGAZDMMZUGE . You are receiving this because you were mentioned.Message ID: @.***>

seth35us commented 8 months ago

Here is a stack trace.

Crashlytics - Stack trace # Application: com.astrumcomputing.cleaner

Platform: apple # Version: 1.0.21 (22) # Issue: e361d922cb4d1552b548178694260835 # Session: ddb554257349405ab3df3aaeaf5ef5bd_DNE_0_v2 # Date: Wed Nov 15 2023 08:39:11 GMT-0700 (Mountain Standard Time) Fatal Exception: NSInternalInconsistencyException 0 CoreFoundation 0xec870 __exceptionPreprocess 1 libobjc.A.dylib 0x2bc00 objc_exception_throw 2 Foundation 0x6b6d18 _userInfoForFileAndLine 3 UserNotifications 0x82a0 -[UNTimeIntervalNotificationTrigger initWithTimeInterval:repeats:] 4 UserNotifications 0x8180 +[UNTimeIntervalNotificationTrigger triggerWithTimeInterval:repeats:] 5 SuperwallKit-BCC3FC367400DPackageProduct 0x22148c (1) suspend resume partial function for specialized static NotificationScheduler.scheduleNotification(:factory:notificationCenter:) + 67 (NotificationScheduler.swift:67) 6 SuperwallKit_-BCC3FC367400DPackageProduct 0x221849 (1) await resume partial function for closure #1 in closure #1 in static NotificationScheduler.scheduleNotifications(:factory:notificationCenter:) 7 SuperwallKit_-BCC3FC367400DPackageProduct 0x2211e5 (1) await resume partial function for partial apply for closure #1 in closure #1 in static NotificationScheduler.scheduleNotifications(:factory:notificationCenter:) () 8 SuperwallKit_-BCC3FC367400D_PackageProduct 0x220505 (1) await resume partial function for specialized thunk for @escaping @calleeguaranteed @Sendable @async () -> @.*** A) () 9 SuperwallKit-BCC3FC367400D_PackageProduct 0xc009 (1) await resume partial function for partial apply for specialized thunk for @escaping @callee_guaranteed @Sendable @async () -> @.** A) 10 libswift_Concurrency.dylib 0x49ac5 completeTaskWithClosure(swift::AsyncContext, swift::SwiftError*) com.apple.main-thread 0 libsystem_kernel.dylib 0x11d8 mach_msg2_trap + 8 1 libsystem_kernel.dylib 0xf70 mach_msg2_internal + 80 2 libsystem_kernel.dylib 0xe88 mach_msg_overwrite + 436 3 libsystem_kernel.dylib 0xcc8 mach_msg + 24 4 CoreFoundation 0x35d0c CFRunLoopServiceMachPort + 160 5 CoreFoundation 0x33c04 CFRunLoopRun + 1208 6 CoreFoundation 0x33668 CFRunLoopRunSpecific + 608 7 GraphicsServices 0x35ec GSEventRunModal + 164 8 UIKitCore 0x22c2b4 -[UIApplication _run] + 888 9 UIKitCore 0x22b8f0 UIApplicationMain + 340 10 SwiftUI 0x11620fc OUTLINED_FUNCTION_31 + 604 11 SwiftUI 0x1161f40 OUTLINED_FUNCTION_31 + 160 12 SwiftUI 0xdd3868 OUTLINED_FUNCTION_26 + 2196 13 CleanerPlus 0x7a738 main

On Mon, Nov 20, 2023 at 10:43 PM Seth Starr @.***> wrote:

It was set to default to Day 1. It stopped crashing when I removed the free trial reminder.

Here is a link to the paywall: https://superwall.com/applications/1822/paywalls/13500/v3

On Mon, Nov 20, 2023 at 5:32 PM Yusuf Tör @.***> wrote:

Hey @seth35us https://github.com/seth35us, when you say this:

Add paywall with FreeTrialReminder Notification set to default, which is none.

Do you mean it's set like this, with no free trial reminder? [image: Screenshot 2023-11-20 at 19 28 47] https://user-images.githubusercontent.com/3296904/284425461-108013cd-55e6-4ef4-ba9e-44d0066e1305.png

Or do you mean like this, where it defaults to Day 1: [image: Screenshot 2023-11-20 at 19 31 50] https://user-images.githubusercontent.com/3296904/284425844-76bfb63d-0658-4465-a420-4da09f80d87a.png

Please can you provide a link to your paywall that you have issues with and a stack trace of the error so I can try and reproduce? Thanks!

— Reply to this email directly, view it on GitHub https://github.com/superwall-me/Superwall-iOS/issues/185#issuecomment-1820026341, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEHWUDTNNXQD56IVB3WTBNTYFPZBZAVCNFSM6AAAAAA7QIMAUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMRQGAZDMMZUGE . You are receiving this because you were mentioned.Message ID: @.***>

yusuftor commented 8 months ago

Thank you! I couldn't reproduce the crash using your paywall but it does look like there may have been a notification delay <= 0 passed down in the Superwall configuration which could cause that crash. We'll look into what caused this bug but I'm adding a guard against that for the next release of the SDK. Thank you for reporting!