Skip to content
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

Alert not displaying #331

Closed
rigaldamez opened this issue Apr 22, 2020 · 16 comments
Closed

Alert not displaying #331

rigaldamez opened this issue Apr 22, 2020 · 16 comments
Labels

Comments

@rigaldamez
Copy link

rigaldamez commented Apr 22, 2020

I have just installed Siren version 5.4.0 using pod 'Siren' in my pod file.

I have an app version 1.5 which was last published in the appStore approx 2 months ago.

The version details in my xcode project file are:

Version: 0.0.5
Build: 1

(AppStore published version: 1.5)

When testing I change to Version 0.0.1 then build/run the app and no alert pops up.

I am testing using the provided sample in my AppDelegate.swift file

import Siren

var window: UIWindow?

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

window?.makeKeyAndVisible()
defaultExampleUsingCompletionHandler()

//...other code eg; Firebase, Facebook initialisation code, present login VC if currentUser == nil

}
private extension AppDelegate {

    // The simplest implementation of Siren.
    // All default rules are implemented and the
    // results of the completion handler are ignored.
    func defaultExample() {
        Siren.shared.wail()
    }

    // The simplest implementation of Siren.
    // All default rules are implemented and the
    // results of the completion handler are returned or an error is returned.
    func defaultExampleUsingCompletionHandler() {
        
        print("defaultExampleUsingCompletionHandler")
        
        Siren.shared.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)
            }
        }
    }
    
}//end extension

@ArtSabintsev
Copy link
Owner

ArtSabintsev commented Apr 23, 2020

Hi, could you provide me with your bundle identifier so I can test this in the sample app? Also, feel free to edit the example xcode project that's in this repo and see if works for you there as that's what I plan to do with your bundle ID once you provide it.

Thanks!

Edit: here's how you do it - https://github.com/ArtSabintsev/Siren#testing-siren-locally

@rigaldamez
Copy link
Author

rigaldamez commented Apr 23, 2020

I downloaded the sample project, tried to build and run but got tens of errors :/

@ArtSabintsev
Copy link
Owner

What version of Xcode are you using?

@rigaldamez
Copy link
Author

I'm using the following;

Xcode: 11.2.1
ios Deployment Target: 13.0
Swift: 5.0

@ArtSabintsev
Copy link
Owner

ArtSabintsev commented Apr 24, 2020

Ah, that may be why. Please upgrade to the latest version of Xcode, 11.4.1 and follow up here if it fixes the issue or not.

Thanks!

@rigaldamez
Copy link
Author

rigaldamez commented Apr 24, 2020

I just updated to Xcode 14.4.1 and it's still not displaying the Alert.

I see defaultExampleUsingCompletionHandler debug line being printed out to the console so the code reached the function but not alert

@ArtSabintsev
Copy link
Owner

ok, per the log:

[Siren Error] Error retrieving App Store data as the JSON results were empty. Is your app available in the US? If not, change the `countryCode` variable to fix this error.

Is your app available in the US App Store? If not, please do the following:

let siren = Siren.shared
siren.apiManager = APIManager(countryCode: "RU")

See this example for more information:

/// An example on how to change the App Store region that your app in which your app is available.
// This should only be used if your app is not available in the US App Store.
// This example function illustrates how this can be done by checking against the Russian App Store.
func appStoreCountryChangeExample() {
let siren = Siren.shared
siren.apiManager = APIManager(countryCode: "RU")
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)
}
}
}

Does this help?

@rigaldamez
Copy link
Author

Yep! this has worked.

Changing it to the correct countryCode worked. thanks for your assistance and for providing such a useful library :)

@rigaldamez
Copy link
Author

rigaldamez commented Apr 26, 2020

just a quick follow-up, I have changed the version to 1.5 in Xcode , made it globalRules: .annoying

Should the alert still pop-up even though the version in my project matches the version published in the AppStore (I expect not to show alert since the version matches)?

@rigaldamez rigaldamez reopened this Apr 26, 2020
@ArtSabintsev
Copy link
Owner

ArtSabintsev commented Apr 26, 2020

hey - happy to help! Glad it worked!

It should not still pop up if the versions are matching exactly; meaning 1.5 is in the app store. Is the version in the app store 1.5 or 1.5.0? If it's 1.5.0, then it may still pop up. Maybe I have a unit test for it - I don't recall.

@ArtSabintsev
Copy link
Owner

I looked at the unit tests, and I test that case. It shouldn't happen. What country code are you using, so I ca replicate this on my end for your app.

@rigaldamez
Copy link
Author

AppStore is version 1.5

Xcode is Build 1, Version 0.0.5

Country code: AU

@ArtSabintsev
Copy link
Owner

I don't see this issue using the bundle ID that's in the example app (which references the App Store Connect app) and the latest version at this time (1.4.2).

What's your bundle ID again?

@rigaldamez
Copy link
Author

rigaldamez commented Apr 26, 2020

My bundle is: com.rigaldamez.vipeeps

current AppStore version 1.5

I have tried the following...

Testing with Xcode is Build 1, Version 0.0.5 and a lower Version 0.0.4 I get the same results.

When I set to .persistent the alert does not show
When I set to .annoying the alert shows every time app becomes active even though the version matches the one in the AppStore

@ArtSabintsev
Copy link
Owner

I did the following just now in Xcode 11.4.1 and Siren v5.4.0 using Swift 5.0 (probably 5.2, since you cant set that directly to my knowledge).

bundleID: com.rigaldamez.vipeeps
version: 1.5
build: 1 (this doesn't matter)
countryCode: "AU"
alertType: .annoying

With 1.4, I saw the alert. With 1.5 I did not. I did this with many different numbers and was not able to reproduce this issue.

I can't reproduce this on my end with the sample project. Everything seems to work as expected on my end.

@ArtSabintsev
Copy link
Owner

Closing this issue due to lack of follow up and as I cannot reproduce this issue on my end.

Repository owner locked as resolved and limited conversation to collaborators May 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants