box / box/box-ios-sdk

macOS support?

Open
#702 8 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Swift
Stars
130
Forks
111
Avg merge
17h 58m
Merged PRs (30d)
13

Description

* [X] I've read, understood, and done my best to follow the [*CONTRIBUTING guidelines](https://github.com/box/box-swift-sdk/blob/master/CONTRIBUTING.md).

## What did you do?

I attempted to integrate a macOS app with the Box SDK.

## What did you expect to happen?

I realize that the name of the SDK is `box-ios-sdk`, but `osx` is listed as one of the supported platforms. As such, I expected the SDK to work with a Mac app.

![Screen Shot 2020-01-31 at 11 03 40 AM](https://user-images.githubusercontent.com/606159/73554237-5e964900-4419-11ea-928e-74095d6687dc.png)

## What happened instead?

The project links against the SDK without error, but then things start failing silently. I attempted using sample code to authenticate via OAuth and the call never returns. In looking at `obtainAuthorizationCodeFromWebSession`, I discovered that the code simply bails if not iOS. This is a silent fail without any console log if running on another platform.

```
func obtainAuthorizationCodeFromWebSession(completion: @escaping Callback) {
let authorizeURL = makeAuthorizeURL(state: nonce)
#if os(iOS)
... iOS goodness here...
#endif
}
```

My preference would be for the SDK to work with Mac (like [Dropbox](https://github.com/dropbox/SwiftyDropbox) does). If Box chooses to not go that direction, the code should be updated to log a console message and/or return an error in the callback and documentation should be updated so others don't spend time going down this same path.

## BoxSDK Environment

**BoxSDK version:**
3.1.1

**Xcode version:**
11.3.1

**Swift version:**
5

**Platform(s) running BoxSDK:**
macOS

**macOS version running Xcode:**
10.15.2

## Demo Project
[clouduploader.zip](https://github.com/box/box-ios-sdk/files/4140356/clouduploader.zip)
Client secrets and IDs scrubbed from the above for both Box and Dropbox.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing obtainAuthorizationCodeFromWebSession and its #if os(iOS) branch, then reproduce the silent OAuth failure using the linked demo project on macOS. The issue needs a project decision first: support macOS authentication, or define and document an explicit error path for unsupported platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
desktop
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.