简体   繁体   中英

How to testing Gluon app on iOS Simulator or Real Device?

The problem is related to my previous question when I try to execute the gluon application on iOS Device/simulator. It seem not working at all. It show me the following error:

  • launchIPadSimulator : It error Unable to find a matching device [arch=x86_64, family=iPhone, name=null, sdk=null]

Edited

  • launchIOSDevice : It error No provisioning profile and signing identity found that matches bundle ID

I also checking this question , but It doesn't help me. So the question is How to make it working?

Noted I am using macOS Mojave 10.14.3 and Xcode 10.2.1

Build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'org.javafxports:jfxmobile-plugin:1.3.16'
    }
}
// Apply the plugin
apply plugin: 'org.javafxports.jfxmobile'

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

mainClassName = 'fr.cashmag.GluonApplication'
ext.GLUON_VERSION="5.0.2"
ext.CHARM_DOWN="3.8.6"

dependencies {
    compile "com.gluonhq:charm:$GLUON_VERSION"
    compile "com.gluonhq:charm-down-plugin-orientation:$CHARM_DOWN"
}

jfxmobile {
    downConfig {
        version = '3.8.6'
        // Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
        plugins 'display', 'lifecycle', 'orientation', 'statusbar', 'storage'
    }
    android {
        manifest = 'src/android/AndroidManifest.xml'
    }
    ios {
        infoPList = file('src/ios/Default-Info.plist')
        forceLinkClasses = [
                'com.gluonhq.**.*',
                'javax.annotations.**.*',
                'javax.inject.**.*',
                'javax.json.**.*',
                'org.glassfish.json.**.*'
        ]
    }
}

iOS simulator

To solve the issue:

Unable to find a matching device [arch=x86_64, family=iPhone, name=null, sdk=null]

a possible solution is:

  • Include a gradle.properties file in the root of your project, and add:

     robovm.ipaArchs=x86_64

    (see documentation for more details).

  • Run ./gradlew --info createIpa , wait until the task ends. Review that your project contains the app under build/javafxports/ios/*.app .

  • Open Xcode, go to Xcode -> Open Developer Tool -> Simulator

  • When an iPhone/iPad device screen shows up, drag from Finder the *.app file. It will then install the app on the sim, and you will be able to run it by tapping on it.

Once the process is working you can revert the property to:

robovm.ipaArchs=arm64:thumbv7

in order to create the app for your device and for the Apple Store.

iOS device

To solve the issue:

No provisioning profile and signing identity found that matches bundle ID

you need to follow these steps, providing you are already enrolled in the Apple Developer program (otherwise you won't be able to distribute your app through the Apple Store):

  • Go to the Developer portal , go to Certificates, Identifiers & Profiles .
  • Go to Certificates , and make sure you have created a Development certificate (for testing). Later on you will need a Production certificate for distribution.
  • Assuming development now, download the certificate and install it (double click).
  • Go to Identifiers -> App IDs , and create a new app identifier. Provide a name and make sure you provide the exact Bundle ID from your app, the one listed in your Default-Info.plist file under the CFBundleIdentifier key.
  • Go to Devices and add your testing devices, providing the UDID of these devices (go to iTunes, plug your device, and click on device serial, it will reveal it, and ⌘+C to paste it).
  • Finally, go to Provisioning Profiles , and add a Development profile (later on you will need a Distribution one). Select iOS App Development , select the App ID you provided before, and when finished, download and install (double click).
  • Back to your project, you can add this to your build.gradle file:

     ios { ... iosSignIdentity = "iPhone Development: *** (^^^^)" iosProvisioningProfile = '$$$' }
  • Run ./gradlew --info launchIOSDevice , and review the console logging at the end of the process to check that the provisioning profile is used to sign the app.

Note that you will have to use the distribution provisioning profile in the same way to sign the app you will be submitting to the Apple Store.

EDIT

If you are not enrolled in the Developer program, you can also use the free provisioning profile, that will let you test on your own device.

For that, you have to follow these steps:

  • If you do not have an Apple ID you can use, you can create a new one here .
  • Open Xcode and go to Xcode -> Preferences -> Accounts
  • Add your Apple ID
  • Under Manage Certificates, add one for iOS Development.
  • Now create a new Xcode project, select a simple template like Single View App .
  • Make sure you set the exact same bundle identifier as the one on your project.
  • Connect your device and run the Xcode project. It will install a provisioning profile for that empty app on your device.
  • Quit Xcode and go back to your project, try to deploy it to the iOS device without setting the iosSignIdentity and iosProvisioningProfile ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM