[Interest] iOS8: Qt 5.3.2 / QML , cannot get UIView from QQuickWindow anymore

Nils Heidorn nils_heidorn at gmx.de
Thu Sep 25 16:11:54 CEST 2014


Holy cr*p !

I am very sorry for wasting everybodys (and especially Richrds) time.
The crash that i experienced from using the UIActivityController did 
*not* derive from uiview beeing nil.

In fact after Richard was so sure of his thing i used qDebug() instead 
of relying on Xcode 6 debugger.
And, voila: uiview AND rootcontroller were displayed as "nil" in the 
Xcode debugger but they were != 0, in favt they were perfectly fine like 
with Xcode 5 & iOS7 !
And as the UIActivityController changed a bit for iOS8 & iPads THAT was 
my problem leading to a crash where i suspected the 
uiview/rootcontroller beeing nil was causing the crash.

JFYI, THIS was my real problem:
http://stackoverflow.com/questions/25644054/uiactivityviewcontroller-crashing-on-ios8-ipads


I am so sorry, i shouldn't trust ANY version of Xcode and my sorry brain :-)

A "Hooray" to console debugging :-)


Nils

Am 25.09.2014 14:45, schrieb Gustavsen Richard:
> Hmm. I tested getting the UIView from QQuickWindow in my own app, and it works here with Qt-5.3. Check if the window you get is a top level window (QWindow::isTopLevel()). Otherwise, follow parent to the top level before getting the view. If that doesn't work out, check if you can trim down your example and post a bug report so we can take a look at it.
>
> -Richard
> ________________________________________
> Fra: interest-bounces+richard.gustavsen=digia.com at qt-project.org [interest-bounces+richard.gustavsen=digia.com at qt-project.org] på vegne av Nils Heidorn [nils_heidorn at gmx.de]
> Sendt: 25. september 2014 11:28
> Til: interest at qt-project.org
> Emne: Re: [Interest] iOS8: Qt 5.3.2 / QML , cannot get UIView from QQuickWindow anymore
>
> Hi Richard,
> sadly the iOS version does matter.
> Maybe i explained it wrong.
> The lines i posted work perfectly well on iOS6 & 7.
> But in iOS8 the uiview is "nil".
> ( window() still delivers a valid QQuickWindow, so thats okay )
>
> I AM mixing Qt with native API as is needed for several tasks.
> The lines are a near 100% copy of Qt sample code to get hold of the
> native API root viewcontroller.
>
> In a broader perspective, what i have to do using native API is to share
> an image (to Facebook / Twitter / Picasa / Camera Roll ....).
> And for that you have to add some ".mm" files and to SHOW the share
> dialog you have to animate it over the root viewcontroller.
> And THAT is what i have to retrieve somehow.
>
> But thats probably too much Detail.
> The core is:
> "QGuiApplication::platformNativeInterface()->nativeResourceForWindow"
> does not seem to work anymore given the same input parameters as in iOS6
> / 7 :-(
>
> I tried your casting from winId() to uiview but that does not result in
> a valid uiview, accessing it in any way crashes the app.
>
> Please let me know if i am not understanding your explanation and sorry
> for my English, i am not a native english speaker...
>
> Nils
>
>
> Am 25.09.2014 11:04, schrieb Gustavsen Richard:
>> The iOS version should not matter in this case (with respect to how this is implemented in Qt). But since you try to get the view, you are mixing Qt with native APIs. Do you call UIApplicationMain yourself? Perhaps you try to grab the view at a point before the window is fully created? You can check if reinterpret_cast<UIView *>(window()->winId()) returns the view. Otherwise you must be doing something very strange...
>>
>> -Richard
>> ________________________________________
>> Fra: interest-bounces+richard.gustavsen=digia.com at qt-project.org [interest-bounces+richard.gustavsen=digia.com at qt-project.org] på vegne av Nils Heidorn [nils_heidorn at gmx.de]
>> Sendt: 25. september 2014 09:43
>> Til: interest at qt-project.org
>> Emne: [Interest] iOS8: Qt 5.3.2 / QML , cannot get UIView from QQuickWindow anymore
>>
>> Hi !
>>
>> I got a problem since upgrading my iPad to iOS 8 (had to, customer wants
>> me to continue developing on iOS8 NOW).
>>
>> On iOS 7.x i was used to get the current uiview like this:
>>
>> UIView *view = static_cast<UIView
>> *>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow("uiview",
>> window()));
>>
>>
>> or if i want to have it “ARC safe”:
>>
>> UIView *view = (__bridge UIView *)reinterpret_cast<void
>> *>(QGuiApplication::platformNativeInterface()->nativeResourceForWindow("uiview",
>> window()));
>>
>>
>> But on iOS8 this results in “view = nil” :-(
>>
>> I need the uiview in order to get the UIViewController (as most will):
>>
>> UIViewController *qtController = [[view window] rootViewController];
>>
>>
>> Sooo, do you know a way to get the uiview (or better the
>> UIViewController) on iOS 8 ?
>>
>> Greetings,
>>
>> Nils
>>
>>
>> _______________________________________________
>> Interest mailing list
>> Interest at qt-project.org
>> http://lists.qt-project.org/mailman/listinfo/interest
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest




More information about the Interest mailing list