Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage in an app extension #410

Open
igorkulman opened this issue Mar 8, 2024 · 1 comment
Open

Usage in an app extension #410

igorkulman opened this issue Mar 8, 2024 · 1 comment

Comments

@igorkulman
Copy link

I want to use SwiftyDropbox not only in an iOS app but also in an app extension. The problem is the auth method require passing UIApplication.shared which is not available in the extension. Is there a way around it?

Checking the code I see the UIApplication.shared is basically only used in MobileSharedApplication to find the root VC when a VC is not explicitly provided. So maybe if in addition to public init(sharedApplication: UIApplication, controller: UIViewController?, openURL: @escaping ((URL) -> Void)) there was also a public init(controller: UIViewController, openURL: @escaping ((URL) -> Void)) it could work as well in an app extension.

@greg-db
Copy link
Contributor

greg-db commented Mar 8, 2024

Thanks for the post. SwiftyDropbox doesn't currently support running the app authorization flow from an extension. You'll need to have the user initially process the authorization flow from the main app, after which you can perform API calls from the extensions. Note that to create an authorized client in the extension you'll need to enable Keychain Sharing between the extension and the app. There are a few options for this are outlined here.

I'll pass this along as a feature request for support for processing that from an extension, but I can't promise if or when that might be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants