Skip to content

App crash and 500 error when using authorizeFromControllerV2 #450

@gstanzione

Description

@gstanzione

Problem Description

When using SwiftyDropbox version 10.2.3 in an iOS app (minimum deployment target: iOS 13.0, UIKit, Swift), I encountered issues with DropboxClientsManager.authorizeFromControllerV2 regarding the includeGrantedScopes parameter in scopeRequest.

Reproduction Steps

Case 1: includeGrantedScopes: true

DropboxClientsManager.authorizeFromControllerV2(
    UIApplication.shared,
    controller: viewController,
    loadingStatusDelegate: loadingDelegate,
    openURL: { url in
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    },
    scopeRequest: .init(scopeType: .user, scopes: [], includeGrantedScopes: true)
)

This configuration results in a web error:

Image

Case 2: includeGrantedScopes: false

DropboxClientsManager.authorizeFromControllerV2(
    UIApplication.shared,
    controller: viewController,
    loadingStatusDelegate: loadingDelegate,
    openURL: { url in
        UIApplication.shared.open(url, options: [:], completionHandler: nil)
    },
    scopeRequest: .init(scopeType: .user, scopes: [], includeGrantedScopes: false)
)

This causes a crash with the following error:

*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<SwiftyDropbox.LoadingViewController 0x15607a400> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key loadingImageView.'

Environment

  • SwiftyDropbox version: 10.2.3
  • iOS version: 13.0+
  • Swift: 5.0
  • UIKit used

Expected Behavior

  • Both usages should not cause server errors or application crashes.

Actual Behavior

  • Usage with includeGrantedScopes: true results in a 500 error (see screenshot attached).
  • Usage with includeGrantedScopes: false crashes the app due to an NSUnknownKeyException related to loadingImageView in LoadingViewController.

Additional Notes

  • The issues are consistently reproducible with the steps above.
  • Please advise if there are recommended workarounds or if additional debug info is needed.
  • if I use the deprecated APIs everything works fine:
DropboxClientsManager.authorizeFromController(
     UIApplication.shared, controller: viewController
) { url in
     UIApplication.shared.open(url, options: [:], completionHandler: nil)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions