[Interest] [ iOS ] How implement didFinishLaunchingWithOptions to open file associated with MyWidgetApp from another app?

Edward Sutton edward.sutton at subsite.com
Tue Jun 2 14:29:29 CEST 2015


Thank you Ben,

Categories works!

I do not understand how.  No header file and it somehow works without having to initialize it to the instance of UIApplication.

I put a breakpoint in openURL.  When I open an email attachment, my app is launched, and the breakpoint is hit.  Magic.


#include <UIKit/UIKit.h>

#include "qiosapplicationdelegate.h"
#import "cmsapplicationdelegate.h"

@implementation QIOSApplicationDelegate (CmsApplicationDelegate)

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
                                       sourceApplication:(NSString *)sourceApplication
                                              annotation:(id)annotation
{
    Q_UNUSED(application);
    Q_UNUSED(annotation);

    NSLog(@"sourceApplication: %@",sourceApplication);
    NSLog(@"url: %@",url);
    return YES;
}
@end

I added an INCLUDEPATH to my project file.

ios {
    QTBASE=$$clean_path($$QMAKE_QMAKE/../../..)/Src/qtbase
    INCLUDEPATH += $$QTBASE/src/plugins/platforms/ios

Thank you Ben!

-Ed

On Jun 1, 2015, at 11:00 PM, Ben Lau <xbenlau at gmail.com<mailto:xbenlau at gmail.com>> wrote:


Objective-C provides a feature called category which could override any class even you don't have the header file. So you just need to override the openUrl of QIOSApplicationDelegate.

Example code to override didFinishLaunchingWithOptions
quickios/appdelegate.mm at master · benlau/quickios<https://github.com/benlau/quickios/blob/master/examples/quickiosexample/appdelegate.mm>

On 2 June 2015 at 05:12, Edward Sutton <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>> wrote:
Thank you for the links Robert.


How would you hook into the application openURL from a Qt widget app?



- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    // handle the URL here
}

“Open in MyApp” now shows when email attachment.  My app launches.  I think I just need to figure out how to implement  application openURL for a Qt widget app.

Thank you very much for your time,

-Ed

File: Info.plist



<key>UTExportedTypeDeclarations</key>

    <array>

        <dict>

            <key>UTTypeConformsTo</key>

            <array>

                <string>public.text</string>

                <string>public.xml</string>

            </array>

            <key>UTTypeDescription</key>

            <string>My App Report File</string>

            <key>UTTypeIdentifier</key>

            <string>com.acme.myrf</string>

            <key>UTTypeTagSpecification</key>

            <dict>

                <key>public.filename-extension</key>

                <string>myrf</string>

                <key>public.mime-type</key>

                <string>public.text</string>

            </dict>

        </dict>

    </array>

    <key>CFBundleDocumentTypes</key>

    <array>

        <dict>

            <key>CFBundleTypeIconFiles</key>

            <array>

                <string>Icon.png</string>

            </array>

            <key>CFBundleTypeName</key>

            <string>My App Report File</string>

            <key>CFBundleTypeRole</key>

            <string>Editor</string>

            <key>LSHandlerRank</key>

            <string>Owner</string>

            <key>LSItemContentTypes</key>

            <array>

                <string>com.acme.myrf</string>

                <string>public.text</string>

            </array>

        </dict>

    </array>




On Jun 1, 2015, at 11:05 AM, Robert Iakobashvili <coroberti at gmail.com<mailto:coroberti at gmail.com>> wrote:

On Mon, Jun 1, 2015 at 6:29 PM, Edward Sutton <edward.sutton at subsite.com<mailto:edward.sutton at subsite.com>> wrote:
For example, the user receives a "report.myapp" file in Apple Mail app as a
file attachment.

When user opens the file attachment, how do you offer "Open in MyWIdgetApp”
as one of the choices?  Has anyone figured out how to do this or found an
example?

Hi Ed,

Not sure if I fully understand your question but as an attempt:

http://www.infragistics.com/community/blogs/stevez/archive/2013/03/05/ios-tips-and-tricks-associate-a-file-type-with-your-app-part-2.aspx

Take care

Regards,
Robert
_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest

This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

_______________________________________________
Interest mailing list
Interest at qt-project.org<mailto:Interest at qt-project.org>
http://lists.qt-project.org/mailman/listinfo/interest



This email and any files transmitted with it from The Charles Machine Works, Inc. are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender. Our company accepts no liability for the contents of this email, or for the consequences of any actions taken on the basis of the information provided, unless that information is subsequently confirmed in writing. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company. Finally, the recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150602/4c2136d9/attachment.html>


More information about the Interest mailing list