iOS小集iOS精选面试题

iOS其他应用打开

2020-06-20  本文已影响0人  开发技术支持

1.infoplist配置

<key>CFBundleDocumentTypes</key>

    <array>

        <dict>

            <key>CFBundleTypeName</key>

            <string>com.myapp.common-data</string>

            <key>LSItemContentTypes</key>

            <array>

                <string>com.microsoft.powerpoint.ppt</string>

                <string>public.item</string>

                <string>com.microsoft.word.doc</string>

                <string>com.adobe.pdf</string>

                <string>com.microsoft.excel.xls</string>

                <string>public.image</string>

                <string>public.content</string>

                <string>public.composite-content</string>

                <string>public.archive</string>

                <string>public.audio</string>

                <string>public.movie</string>

                <string>public.text</string>

                <string>public.data</string>

            </array>

        </dict>

    </array>

2.List展示上面的配置

3.调用

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options{

    if(self.window) {

        //------------- 其他应用打开文件 -------------

        [LTBackupManager uploadOtherAPPFileWithUrl:url token:@"69db6b33-e78f-4269-8815-019b65ac942a"];

    }

    return YES;

}

- (BOOL)application:(UIApplication*)applicationopenURL:(NSURL*)urlsourceApplication:(nullableNSString*)sourceApplicationannotation:(id)annotation{

    if(self.window) {

        //------------- 其他应用打开文件 -------------

        [LTBackupManager uploadOtherAPPFileWithUrl:url token:@"69db6b33-e78f-4269-8815-019b65ac942a"];

    }

    return YES;

}

上一篇下一篇

猜你喜欢

热点阅读