Weird problem with foreign users.

I have an iOS app that uses JSON to contact our server where we have a web app using HandleSpecialURL to return a yes or no to determine membership status.

It seems foreign users, at least some including Canada, the valid response never gets to them. I’m in Mexico and I turned off my vpn and it worked for me, but I had a Canadian user try it and it showed in the log as successful, however the app either didn’t get a yes response ir a corrupted one.

I send back the string of “yes” or “no”.

Does anybody have any clue as to why this is happening?

Thanks

Canada, yes, but Qubec ?

In other words, are-you asking his first name ? Can it be Andr, Josphine or a family name with a non ASCII character ?

Are you accepting UTF-8 characters ?

Could you be getting an exception on the server?

I created a table that records the last name and the member number. It does a query to determine yes or no to the question are they a member.

The JSON string looks like this: {“ValidTo”:“01\/31\/2023”,“IsValid”:“Yes”}

The code in the iOS app reads results like this: App.gbIsMember = dtStatus.Value(“IsValid”) = “Yes”

If true it unlocks the app.

I would think if there were an exception it wouldn’t write to the table.

It’s only the last name that gets sent.

isn’t your app localised and returns a “Oui” instead of a “Yes” , automagically by the operating system ?

[quote=477742:@Richard Albrecht]I created a table that records the last name and the member number. It does a query to determine yes or no to the question are they a member.

The JSON string looks like this: {“ValidTo”:“01\/31\/2023”,“IsValid”:“Yes”}

The code in the iOS app reads results like this: App.gbIsMember = dtStatus.Value(“IsValid”) = “Yes”

If true it unlocks the app.

I would think if there were an exception it wouldn’t write to the table.

It’s only the last name that gets sent.[/quote]
What are you doing with that date on the client side? If you are parsing a date like 1/31/2023 could be that on non-US systems that it is being interpreted as: Day/month/year, which could lead to an exception.

You may want to use a SQL date format to remove ambiguity.

App is not localized.

There seems to be no exception as it writes to db. Even if they server returns true they are receiving it as no according to the log.
Here’s the code on the server:

lsSql = "SELECT Now() as Today, tblmembership.MemberSince, tblPeople.MemStatus, tblmembership.ValidTo FROM tblmembership " + _
"JOIN tblpeople ON tblmembership.PersonID = tblpeople.PersonID " + _
"WHERE tblpeople.MemberNumber = " + json.Value("MembershipNumber")  + _
" and tblpeople.LastName = '" + json.Value("Lastname") + "'"

rs = sesDB.SQLSelect(lsSql)


If sesDB.CheckDBError then 
  LogAction(json.Value("MembershipNumber"), json.Value("Lastname"), sesDB.ErrorMessage, False)
  Return False
end

If (rs.Field("MemStatus").StringValue = "Active Member" or _
  rs.Field("MemStatus").StringValue  = "Sent To VPM 1" or rs.Field("MemStatus").StringValue  = "Sent To VPM 2" or _
  rs.Field("MemStatus").StringValue  = "Back From VPM" ) then
  if rs.Field("Today").DateValue <= rs.Field("ValidTo").DateValue Then
    mdResult.Value("ValidTo") = rs.Field("ValidTo").DateValue.ShortDate
    LogAction(json.Value("MembershipNumber"), json.Value("Lastname"), "", True)
    mdResult.Value("IsValid") = "Yes"
    
  else
    mdResult.Value("IsValid") = "No"
    LogAction(json.Value("MembershipNumber"), json.Value("Lastname"), "", False)
    
  end
else
  mdResult.Value("IsValid") = "No"
  LogAction(json.Value("MembershipNumber"), json.Value("Lastname"), "", False)
  
end

Had someone in the Philippines and it worked.
I’m in Mexico and I turned or VPN and it works.

The plot thickens…

I changed my VPN to Canada and t o Egypt and I was able to activate fine.

…probably because your date definition on your computer is still the same. change the localization parameters on your computer to use Canadian English or even Canadian french. that will change the date formatting. I would suspect that you will have the error.

as others have suggested, it could well be the date that is the issue. Changing the VPN does not change local computer parameters.

I really recommend to use SQLDate format everywhere: YYYY-MM-DD

How do I change the date definition on a iPad and mac?

You can’t change the date definition directly but changing the language & region should do that

On iPhone: Settings > General > Language & Region > Region > Select Canada

That must be it. How do I change that setting on my mac so I can inspect the results coming back.

I set my iPad to canada and it failed to activate. I set my mac to canada and in the iPhone simulator it activates. There are no Options in the simulator. And it must not be using the mac defaults.

You have the exact same Language & Region options in the simulator as on a real device.
The simulator does NOT use the Mac defaults.

There is no gear icon.

The standard “Settings.app” is on the Simulator, too…
Cmd-Shift-H (Home), and I’m sure you’ll find the Settings.app :wink:

Found it!

Exception on this line:

gdValidTo is a Xojo.Core.Date

App.gdValidTo = Date.FromText(lsValidto, Locale.Current)

The date is returned as 01/31/2023

The exception say: Date is not in an accepted format for parsing.

How can I correct this?

What is weird is that when set to US it still shows: 01/31/2023

That’s the same.