I'm following the SwiftyDropbox documentation for my project, and have gotten as far as having my app switch to authenticating via web login thru safari but it just hangs there.
If I build on an actual device and have the Dropbox app, I log in without a problem but I want the safari / web login to work as well.
I've named my app the same in Xcode and Dropbox.
I'm using Alamofire (4.5.1) SwiftyDropbox (4.6.0), Xcode 9.4.1 Swift 4. Deployment target 10.1
Keychain sharing is on.
I don't see anything in output to show me where I'm going wrong:
2018-08-17 10:45:08.792346-0500 Pic Droper[9957:299305] -canOpenURL: failed for URL: "dbapi-8-emm://1/connect" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
2018-08-17 10:45:08.958285-0500 Pic Droper[9957:299305] [MC] System group container for systemgroup.com.apple.configurationprofiles path is /Users/15slim/Library/Developer/CoreSimulator/Devices/ABA24F85-62A1-4656-AE95-25BF8E735546/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-08-17 10:45:08.959279-0500 Pic Droper[9957:299305] [MC] Reading from private effective user settings.
2018-08-17 10:45:09.018774-0500 Pic Droper[9957:299305] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
2018-08-17 10:45:23.442747-0500 Pic Droper[9957:299305] [App] if we're in the real pre-commit handler we can't actually add any new fences due to CA restriction
Podfile:
# Uncomment the next line to define a global platform for your project
platform :ios, '10.1'
target 'Pic Droper' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for Pic Droper
pod 'SwiftyDropbox'
end
In my app delegate I have the following with my actual api key replaced:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
DropboxClientsManager.setupWithAppKey("api-key-replaced")
return true
}
// 2. Handle redirect back into SDK
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
if let authResult = DropboxClientsManager.handleRedirectURL(url) {
switch authResult {
case .success:
print("Success! User is logged into Dropbox.")
case .cancel:
print("Authorization flow was manually canceled by user!")
case .error(_, let description):
print("\nError In app delegate: \(description)\n")
}
}
return true
}In my view controller I'm calling my auth this way:
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(true)
authDropbox()
}
// 1. Begin the authorization flow
func authDropbox() {
DropboxClientsManager.authorizeFromController(
UIApplication.shared,
controller: self,
openURL: { (url: URL) -> Void in
UIApplication.shared.open(url, options: [:], completionHandler: { (finished) in
if finished {print("finished")}
})
})
}Any ideas where I am going wrong?
Thanks so much - Wayne