ArtSabintsev / Siren

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

Error Country code #339

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hello , I got 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.

how can I change the country code sir ? my app is available only in France.. please help

thanks

ArtSabintsev commented 4 years ago

Hi, you seem to have figured this out, but here's the answer in case you haven't: https://github.com/ArtSabintsev/Siren/blob/master/Example/Example/AppDelegate.swift#L229

ghost commented 4 years ago

Hey sir, it's still not working I waited 3 days .. the app doesn't ask me to update :( please help me.

thanks this is my code in AppDelegate :

`
var window: UIWindow?

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    window?.makeKeyAndVisible()

    let siren = Siren.shared
    siren.rulesManager = RulesManager(globalRules: .critical, showAlertAfterCurrentVersionHasBeenReleasedForDays: 1)
    siren.apiManager = APIManager(countryCode: "FR")
    siren.apiManager = APIManager(countryCode: "IL")

    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)
             }
         }`
ArtSabintsev commented 4 years ago

Hi - Please use one country code, and please try using this in didBecomeActive.

Alternatively, try the sample project attached to this repo and see if it works there.

What error do you get in the console (make sure you have the debugEnabled flag set to true).

ghost commented 4 years ago

Hey, just tested in didBecomeActive :

  let siren = Siren.shared
    siren.rulesManager = RulesManager(globalRules: .critical, showAlertAfterCurrentVersionHasBeenReleasedForDays: 0)
        siren.apiManager = APIManager(countryCode: "IL")

    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)
             }
         }

I put an older version and still not working (debug) the only message I got from siren is : 020-06-26 00:07:53.518453+0300 DLS[11570:277606] Unbalanced calls to begin/end appearance transitions for <Siren.SirenViewController: 0x7f99cc045c80>.

ArtSabintsev commented 4 years ago

Hey,

ghost commented 4 years ago

Hey sir,

1) 11.4 2) pod 'Siren', :git => 'https://github.com/ArtSabintsev/Siren.git', :branch => 'swift5.0' # Swift 5.0

3) Bundle Identifier : com.David.TheFinalProject

ArtSabintsev commented 4 years ago

Hi,

Next, I ran com.David.TheFinalProject through the example app, changing the country code to IL and changing the version to 0.0.1 (see screenshot).

Everything worked as expected.

Here is what the console spit out:

AlertAction  appStore
Localization  Localization(appName: "Example", forceLanguage: nil)
Model  Model(appID: 1511310390, currentVersionReleaseDate: "2020-06-22T09:50:10Z", minimumOSVersion: "13.0", releaseNotes: Optional("- Bugs fixes."), version: "1.5.3")
UpdateType  major
Screen Shot 2020-06-26 at 9 11 44 AM
ghost commented 4 years ago

Thank sir , so the problem was with the pod : `pod 'Siren', :git => 'https://github.com/ArtSabintsev/Siren.git', :branch => 'swift5.0' # Swift 5.0

`

God bless you , stay safe. 🥇

ArtSabintsev commented 4 years ago

you too - thanks!