简体   繁体   中英

UIApplicationShortcutItem share without opening app

The majority of my apps have a share button their quick actions. These share buttons open up the UIActivityViewController without having to launch the app. I have found out how to share my app using the method:

    func application(_ application: UIApplication, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
    }

I would like to display the UIActivityViewController without opening up the app.

The OS adds the sharing menu item automatically to all apps downloaded from the App Store. Note that it doesn't add it to apps installed via Xcode or any third party distribution systems such as Buddybuild.

(Edit: the TestFlight version of your app will have "Send Beta Feedback" menu item instead of "Share...")

To address your question directly though, no, it is not possible (as of iOS 10 - may be possible in the future, who knows) for an app to present a view controller directly on the home screen. If it was possible, that would be a big security issue, because an app should not be able to access anything outside its own main window.

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