Глюон: Настройки iOS не работают на iOS - PullRequest
0 голосов
/ 07 июня 2018

Служба настроек Gluon не работает на нашем устройстве iOS.

Сначала мы реализовали просмотр с настройками, где мы читаем настройки из предыдущего сохраненного файла с помощью BufferedReader.Это работало нормально на Android, но вылетало на iOS.

PresentationModel:

  public void readSettings(String fileName) {
    if (!Objects.equals(null, checkFileExistence(directory, fileName, false))) {
      settingsFile = checkFileExistence(directory, fileName, false);
      // read line per line
      try {
        BufferedReader br = new BufferedReader(new FileReader(settingsFile));
        setFirstName(br.readLine());
        setLastName(br.readLine());
        setAdress(br.readLine());
        setPlace(br.readLine());
        setPhoneNumber(br.readLine());
        setMailAdress(br.readLine());
        setPersonalInformation(Boolean.valueOf(br.readLine()));
        setConsultant(Boolean.valueOf(br.readLine()));
        // close BufferedReader
        br.close();
      } catch (IOException e) {
        throw new IllegalArgumentException(e);
      }
    }
  }

Просмотр:

public void addBindings() {
    firstNameTxt.textProperty().bindBidirectional(pm.firstNameProperty());
    lastNameTxt.textProperty().bindBidirectional(pm.lastNameProperty());
    adressTxt.textProperty().bindBidirectional(pm.adressProperty());
    placeTxt.textProperty().bindBidirectional(pm.placeProperty());
    phoneNumberTxt.textProperty().bindBidirectional(pm.phoneNumberProperty());
    mailAdressTxt.textProperty().bindBidirectional(pm.mailAdressProperty());
    personalInformationSwitch.selectedProperty()
        .bindBidirectional(pm.personalInformationProperty());
    consultantSwitch.selectedProperty().bindBidirectional(pm.consultantProperty());
  }

После этого мы открыли Сервис настроек.

Мы сохранили ключи со значениями в массивах:

private String[] settingsKeys = {"firstName", "lastName", "adress", "place",
          "phoneNumber", "mailAdress"};

      private Property[] settingsProperties = {firstName, lastName, adress, place, phoneNumber,
          mailAdress};

И прочитали их так:

public void readSettingsService() {
    if (!com.gluonhq.charm.down.Platform.isDesktop()) {
      Services.get(SettingsService.class).ifPresent(service -> {
        // read all strings
        for (int i = 0; i < settingsKeys.length; i++) {
          settingsProperties[i].setValue(service.retrieve(settingsKeys[i]));
        }

        personalInformation.setValue(Boolean.valueOf(service.retrieve("personalInfo")));
        consultant.setValue(Boolean.valueOf(service.retrieve("consultant")));
      });
    }   }

Привязки в представлении остаются прежними.Опять же, это прекрасно работает на Android, но вылетает на iOS.

Еще одна вещь, которую мы попробовали, - это сначала установить начальные значения в Textinputfields и затем привязать их к значениям настроек.Это также не работает на iOS.

Дело в том, что наши решения работают на Android, но приложение всегда вылетает на iOS.Есть ли способ решить эту проблему?

Спасибо за помощь.

--- EDIT ---

iOS stacktrace при открытии настроек (этоничего не регистрировалось в логах устройства):

2018-06-07 10:33:45.628332+0200 BodenDok[4508:1079080] firstName not found
2018-06-07 10:33:45.628688+0200 BodenDok[4508:1079080] lastName not found
2018-06-07 10:33:45.628847+0200 BodenDok[4508:1079080] adress not found
2018-06-07 10:33:45.628975+0200 BodenDok[4508:1079080] place not found
2018-06-07 10:33:45.629061+0200 BodenDok[4508:1079080] phoneNumber not found
2018-06-07 10:33:45.629136+0200 BodenDok[4508:1079080] mailAdress not found
2018-06-07 10:33:45.629340+0200 BodenDok[4508:1079080] Done retreiving personalInfo
2018-06-07 10:33:45.629495+0200 BodenDok[4508:1079080] Done retreiving consultant
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.scene.control.skin.resources.controls_de_CH'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.scene.control.skin.resources.controls_de_CH</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.scene.control.skin.resources.controls_de'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.scene.control.skin.resources.controls_de</pattern></forceLinkClasses> to your robovm.xml file to link it in.
[WARN] java.lang.Class: Class.forName() failed to load 'com.sun.javafx.scene.control.skin.resources.controls'. Use the -forcelinkclasses command line option or add <forceLinkClasses><pattern>com.sun.javafx.scene.control.skin.resources.controls</pattern></forceLinkClasses> to your robovm.xml file to link it in.
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-min-height' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-min-width' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-pref-width' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-pref-height' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-min-height' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-min-width' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-pref-width' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-pref-height' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
setSwapInterval(1)
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-min-height' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-min-width' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-pref-width' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-pref-height' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-min-height' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-min-width' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-pref-width' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
Jun 7, 2018 10:33:45 AM java.util.logging.LoggingProxyImpl log
WARNING: Could not resolve 'default' while resolving lookups for '-fx-pref-height' from rule '*.bottom-nav>*.button' in stylesheet jar:file:/private/var/containers/Bundle/Application/EC6EB215-8FEF-4EF5-8FA5-A4A7CBD26C31/BodenDok.app/lib/classes43.jar!/ch/fhnw/style.css
setSwapInterval(0)
setSwapInterval(1)
ES2ResourceFactory: Prism - createStockShader: FillRoundRect_LinearGradient_PAD.frag
ES2ResourceFactory: Prism - createStockShader: DrawRoundRect_Color.frag
PPSRenderer: scenario.effect - createShader: LinearConvolveShadow_64
Growing pool ES2 Vram Pool target to 101,466,116
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
setSwapInterval(1)
setSwapInterval(0)
AppLauncher failed with an exception:
java.lang.RuntimeException: The app crashed: Terminated due to signal 11. Check the device logs in Xcode (Window->Devices) for more info.
  at org.robovm.libimobiledevice.util.AppLauncher.pipeStdOut(AppLauncher.java:829)
  at org.robovm.libimobiledevice.util.AppLauncher.launchInternal(AppLauncher.java:734)
  at org.robovm.libimobiledevice.util.AppLauncher.launch(AppLauncher.java:1052)
  at org.robovm.compiler.target.ios.AppLauncherProcess$1.run(AppLauncherProcess.java:67)

build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.3.10'
    }
}

apply plugin: 'org.javafxports.jfxmobile'
apply plugin: 'checkstyle'

ext.checkstyleVersion    = '8.3'

repositories {
    jcenter()
    maven {
        url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
    }
}

mainClassName = 'MainClassname'

dependencies {
    compile 'com.gluonhq:charm:5.0.0'
    // https://mvnrepository.com/artifact/org.controlsfx/controlsfx
    compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.14'

    testCompile 'junit:junit:4.12'
}

jfxmobile {
    downConfig {
        version = '3.8.0'
        // Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
        plugins 'compass', 'display', 'lifecycle', 'local-notifications', 'magnetometer', 'pictures', 'position', 'runtime-args', 'settings', 'share', 'statusbar', 'storage'
    }
    android {
        manifest = 'src/android/AndroidManifest.xml'
        compileSdkVersion = 25
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
        forceLinkClasses = [
                'com.gluonhq.**.*',
                'javax.annotations.**.*',
                'javax.inject.**.*',
                'javax.json.**.*',
                'org.glassfish.json.**.*'
        ]
    }
}
...