Type unavailable?



  • I've been developing an android app and things have been going well. The app is fairly mature now so I decided to try targeting an iOS device. The project builds and deploys to my iPhone simulator but I get several qml errors at run time in the debug stream as soon as it loads. I later tried deploying to a real iPad, windows desktop and mac desktop and I get the same errors on all three platforms. The errors are as follows:

    QFSFileEngine::open: No file name specified
    qrc:/Devices.qml:179:9: Type Button unavailable
    qrc://button.qml: No file name specified
    QFSFileEngine::open: No file name specified
    QQmlApplicationEngine failed to load component
    qrc:/Devices.qml:179 Type Button unavailable
    qrc://button.qml:-1 No file name specified
    

    I checked that Button.qml is in the same directory as all of the other qml files and is listed in qml.qrc. What else might cause this?



  • Button unavailable is clear case of the type not found while running. It may be simulator build issue. Can you check your program work perfectly on desktop or android setup on MAC ? Which version of Qt are you using ?



  • I tried 5.9.2 and 5.8.0. I can try it for desktop when I get a chance (though it wasn't intended for desktop at all).

    What would be the prognosis if it either works or has the same issue on one of the other platforms?



  • OK I deployed it to desktop and I get the same problem.



  • And just deployed to an actual ipad and also same problem.



  • This is still killing me. I created a fresh "hello world" app on the mac and it works fine. I compared the .pro file between the working app and my app and couldn't recognize any differences that seem meaningful.



  • Hi!

    So the project was working fine on Windows, the Button.qml (custom qml type?) is there in the app bundle, but it is not found on macOs / iOS when running the app?

    Can you check whether the import path and type name in your QML code, as well as the setup in your QRC file is 100% correct (path names, upper-lowercase mismatch, etc ....)?

    Sounds like the issue could be related to something like that.

    Best,
    GTDev



  • Yes, Button.qml is a custom type. I cloned the whole repo over to the mac using git.

    In the .pro file, the QML_IMPORT_PATH has nothing assigned. I assume this means that it should only look in the base directory, which is where all of the files are, including Button.qml. I saw something in documentation about unix systems being case sensitive, but my naming follows it's recommendation, which is to capitalize the first letter. It is capitalized the same way in both the .qml file that calls it and in the name of Button.qml itself. I spent some time playing with different combinations of capitalization last night without any success.

    I'm wondering if there is something in my .pro file that was not generated on the windows version of Creator since it is unable to target iOS but is necessary in order to do so on the mac. For example, the rules for deployment (below) doesn't appear to have anything for iOS but maybe it falls under the unix rule?

    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    

    There are also some variables defined in the .pro file which appear to only reference android and there is no equivalent for iOS. For example, the following.

    DISTFILES += \
        android/AndroidManifest.xml \
        android/gradle/wrapper/gradle-wrapper.jar \
        android/gradlew \
        android/res/values/libs.xml \
        android/build.gradle \
        android/gradle/wrapper/gradle-wrapper.properties \
        android/gradlew.bat
    
    ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
    


  • What's the easiest way to print out the import path?

    According to http://doc.qt.io/qt-5/qtqml-syntax-imports.html, the import path always includes the current file directory. Since I have all of my source files in the same directory together, I don't see how it could be missed.



  • Interesting... I just tried targeting desktop from the windows machine and found this problem in that case as well. So perhaps the windows/mac aspect was a red herring. Why does this work for Android but for nothing else?



  • Well after trying all sorts of different things to try to solve this issue, I finally solved it by renaming Button to something else. Go figure...

    Then, of course, I ran into the next issue, which is that the bluetooth doesn't connect on iOS. I'm about ready to throw this macbook out the window.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.