Gluon:SettingsService在iOS上崩溃

时间:2018-06-07 07:54:45

标签: ios settings gluon gluon-mobile

Gluon的SettingsService在我们的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());
  }

之后,我们发现了SettingsService。

我们使用数组中的值存储了键:

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堆栈跟踪(它没有在设备日志中记录任何内容):

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.**.*'
        ]
    }
}

0 个答案:

没有答案