codenameone / CodenameOne

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.
https://www.codenameone.com/
Other
1.71k stars 408 forks source link

Ios 15.5 issue requesting connection with mobile connection instead of wifi #3699

Open DurankGts opened 1 year ago

DurankGts commented 1 year ago

I have found a problem trying to connect to google api using mobile connection instead wifi. in ios: 15.5 . using ios 16.4.1 don't fail. I check in the real device iphone 13 pro max ios 15.5.

with wi-fi image

with mobile data image

test case. just execute the method ssueRequestingDataIos() in you star() app test case.

//----------------------------------------------------------
//ISSUE:21-04-23 11:21AM
//----------------------------------------------------------
private void issueRequestingDataIos() {

         Form hi = new Form("issueRequestingInIos15.5", new BorderLayout());
         hi.setName("formRequestPermission");
         hi.setUIID("MyForm");
         hi.setSafeArea(true);
         hi.setFormBottomPaddingEditingMode(true);
         hi.setScrollableY(false);

        Button rp = new Button("Request","ecs_btnSos2");
        rp.addActionListener(new ActionListener() {
             @Override
             public void actionPerformed(ActionEvent evt) {
                 requestDataFromInternet();
             }
         });
        hi.add(BorderLayout.CENTER, FlowLayout.encloseCenterMiddle(rp));
        hi.show();

    }
    //----------------------------------------------------------
    public static void requestDataFromInternet() {

        try {
            ConnectionRequest req = new ConnectionRequest() {
                @Override
                protected void handleErrorResponseCode(int code, String message) {
                    if (code == 400) {
                        //Do what you want here

                    } 
                    Dialog.show("Error: " + code, message+"\n"+" Do you want to continue", "YES","NOT");
                }
                @Override
                protected void buildRequestBody(OutputStream os) throws IOException {
                    super.buildRequestBody(os); //To change body of generated methods, choose Tools | Templates.
                }
                @Override
                protected void readResponse(InputStream input) throws IOException {
                    //super.readResponse(input); //To change body of generated methods, choose Tools | Templates.

                    try {
                        String dataFromServer = Util.readToString(input, "UTF-8");

                        JSONObject data = new JSONObject(dataFromServer);
                        System.out.println("response:" + data.toString());

                        Dialog.show("Data", data.toString(), "CONTINUE", "NOT");
                    } catch (IOException e) {
                        System.out.println("Error1:" + e.toString());
                    } catch (JSONException e) {
                        System.out.println("Error2:" + e.toString());
                    }
                }
            };
            req.setUrl("https://maps.googleapis.com/maps/api/geocode/json");
            req.setPost(false);
            req.addArgument("key", "use your google key please to test");
            req.addArgument("latlng", "18.47940305,-69.93038722");
            req.addArgument("language", "es");
            req.setFailSilently(false);
            req.setReadResponseForErrors(true);
            req.addResponseListener(new ActionListener<NetworkEvent>() {
                @Override
                public void actionPerformed(NetworkEvent evt) {
                   System.out.println("Error25:" + evt.getMessage());
                }
            });
            NetworkManager.getInstance().addToQueueAndWait(req);
        } catch (Exception e) {
            System.out.println("Error" + e.toString());
        }
    //----------------------------------------------------------
DurankGts commented 1 year ago

please check you support mail with more details

DurankGts commented 1 year ago

any solution about this issue?

shai-almog commented 1 year ago

Was this resolved?

DurankGts commented 1 year ago

not, the problem it continue failing in ios 15.5 compiled yesterday at 18:22 hour in dominican republic

DurankGts commented 1 year ago

hi again. this issue is ocurring now in ios 16.6.1. You can use the same test case up. I don't know why you aren't solved this issue that is very critical.

shai-almog commented 1 year ago

This sounds like a problem with your mobile provider. It's not something we can debug without a test case or something to go on.

DurankGts commented 1 year ago

I don't know what happens but my app failed the connection in mobile data. I attached up a test case that I tested in ios 15.5. Yesterday my app fail testing in ios 16.6.1 but when I compile again the app doesn'fail. I check my provider and I had connection. I simple can't understand why fail my compiled app althought internet connection.

DurankGts commented 1 year ago

the app is failing again using mobile data. Please use the test case up. I'm completely sure that theres some problems

DurankGts commented 1 year ago

I change my internet provider and the app fail again

shai-almog commented 1 year ago

I don't have an older iOS device lying around to try that. If it works on a newer device but fails on that device I can't think of another reason other than a problem in the device or its ISP configuration. Assuming that's the case, even if I had an older device around I wouldn't be able to reproduce this.

I can send you down the path of debugging with wireshark to prove that but I think it would be a waste of your time.