ArtSabintsev / Siren

Notify users when a new version of your app is available and prompt them to upgrade.
http://sabintsev.com/
MIT License
4.25k stars 407 forks source link

Siren automatically dismisses an alert dialog #337

Closed pepukrit closed 4 years ago

pepukrit commented 4 years ago

I have read this issue#311 and switched back to use version 5.2.1 in order to solve a problem. However, that doesn't seem to fix the problem.

My application uses Swift 5. The problem is that after Siren prompts to update a new version, it automatically disappears in less than 1 second. I traced back to find the root cause by commenting some code that seems to cause refreshing/reloading and reinstalling the application in order to analyse if this does really involves with my application. If it does, Push notifications dialog should be dismiss too. However, the Push notifications dialog doesn't dismiss. And after I click to dismiss the push notifications dialog, Siren dialog is shown but automatically dismissed. Thus, I guess this might involve with the version of Siren.

Below is my code:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

    FirebaseApp.configure()
    AppDelegate.window = UIWindow(frame: UIScreen.main.bounds)
    AppDelegate.window?.rootViewController = UIStoryboard(name: "LaunchScreen", bundle: nil).instantiateInitialViewController()
    AppDelegate.window?.makeKeyAndVisible()
    Messaging.messaging().delegate = self
    application.registerForRemoteNotifications()
    let siren = Siren.shared
    siren.rulesManager = RulesManager(globalRules: Rules(promptFrequency: .immediately, forAlertType: .skip), showAlertAfterCurrentVersionHasBeenReleasedForDays: 0)
    siren.apiManager = APIManager(countryCode: "th")
    siren.presentationManager = PresentationManager(forceLanguageLocalization: .english)
    siren.wail { results in
        switch results {
        case .success(let updateResults):
            print("AlertAction ", updateResults.alertAction)
            print("Localization ", updateResults.localization)
            print("Model ", updateResults.model)
            print("UpdateType ", updateResults.updateType)
        case .failure(let error):
            print(error.localizedDescription)
        }
    }
    return true
}
ArtSabintsev commented 4 years ago

Hi,

That is an old version of the SDK - at the time it was the newest version, I think.

Please use the latest version of the app, which is 5.4.0 at this time.

pepukrit commented 4 years ago

Hello :) It seems like version 5.4.0 isn't compatible with iOS11.3. An error log prints dyld: lazy symbol binding failed: Symbol not found: _$s5Siren19PresentationManagerCMa

ArtSabintsev commented 4 years ago

Ah, that is weird. I may need to update the min version to iOS 12. I do not provide support to old versions of this SDK - just no time at this point in my life.

ArtSabintsev commented 4 years ago

So the sample app is set to iOS 8.

Screen Shot 2020-06-12 at 12 31 34 PM
pepukrit commented 4 years ago

Thanks you so much for helping me :) Now, I'm able to use your awesome lib.

One thing to point out is that after Siren updated to 5.4.3, I cloned your project to play around. I set Example app to be iOS deployment target = 11.3, and it works. So, I jump in my project to try again. At first, the problem still existed. So, I've tried to comment some codes out.

Only window.makeKeyAndVisible and Siren are kept.

The very weird thing is that the problem still exists. So, I try to change my version from 2.1 to 2.0 (Production version is 2.2), and it works like a charm. I am be like "Hmm? Seriously?". And, I try to swap it to 2.1 again; and it works somehow. To conclude, it seems like this weird behaviour might occur because my project version 2.1 had been set before I updated pod old version to a new version. The solution is to change version again.

ArtSabintsev commented 4 years ago

Thanks for following up! Glad you figured it out!