[GH-ISSUE #528] Build Error under Swift Package Manager in Xcode 11 Beta #348

Closed
opened 2026-03-03 16:47:56 +03:00 by kerem · 4 comments
Owner

Originally created by @paulhimes on GitHub (Jun 15, 2019).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/528

Description:

When the library is imported into an Xcode 11 Beta project using the new built-in swift package manager, it fails to compile with the following errors in OAuthSiftHTTPRequest.swift:

.../SourcePackages/checkouts/OAuthSwift/Sources/OAuthSwiftHTTPRequest.swift:99:21: Use of unresolved identifier 'UIApplication'

.../SourcePackages/checkouts/OAuthSwift/Sources/OAuthSwiftHTTPRequest.swift:109:9: Use of unresolved identifier 'UIApplication'

The relevant code snippet:

            #if os(iOS)
                #if !OAUTH_APP_EXTENSIONS
                    UIApplication.shared.isNetworkActivityIndicatorVisible = self.config.sessionFactory.isNetworkActivityIndicatorVisible
                #endif
            #endif
        }
    }

    /// Function called when receiving data from server.
    public static func completionHandler(completionHandler completion: CompletionHandler?, request: URLRequest, data: Data?, resp: URLResponse?, error: Error?) {
        #if os(iOS)
        #if !OAUTH_APP_EXTENSIONS
        UIApplication.shared.isNetworkActivityIndicatorVisible = false
        #endif
        #endif

OAuth Provider? (Twitter, Github, ..):

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

  • iOS :
  • OSX :
  • TVOS :
  • WatchOS :

Installation method:

  • Carthage
  • CocoaPods
  • Manually
  • Swift Package Manager (Xcode 11 Beta)

Library version:

  • head
  • v1.2.1
  • v1.2 (Swift 4.0)
  • v1.0.0
  • v0.6
  • other: (Please fill in the version you are using.)

Xcode version:

  • 11.0 (Swift 5.0)

  • 9.3 (Swift 4.1)

  • 9.0 (Swift 4.0)

  • 9.0 (Swift 3.2)

  • 8.x (Swift 3.x)

  • 8.0 (Swift 2.3)

  • 7.3.1

  • other: (Please fill in the version you are using.)

  • objective c

Originally created by @paulhimes on GitHub (Jun 15, 2019). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/528 ### Description: When the library is imported into an Xcode 11 Beta project using the new built-in swift package manager, it fails to compile with the following errors in OAuthSiftHTTPRequest.swift: .../SourcePackages/checkouts/OAuthSwift/Sources/OAuthSwiftHTTPRequest.swift:99:21: Use of unresolved identifier 'UIApplication' .../SourcePackages/checkouts/OAuthSwift/Sources/OAuthSwiftHTTPRequest.swift:109:9: Use of unresolved identifier 'UIApplication' The relevant code snippet: ``` #if os(iOS) #if !OAUTH_APP_EXTENSIONS UIApplication.shared.isNetworkActivityIndicatorVisible = self.config.sessionFactory.isNetworkActivityIndicatorVisible #endif #endif } } /// Function called when receiving data from server. public static func completionHandler(completionHandler completion: CompletionHandler?, request: URLRequest, data: Data?, resp: URLResponse?, error: Error?) { #if os(iOS) #if !OAUTH_APP_EXTENSIONS UIApplication.shared.isNetworkActivityIndicatorVisible = false #endif #endif ``` ### OAuth Provider? (Twitter, Github, ..): ### OAuth Version: - [ ] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [ ] CocoaPods - [ ] Manually - [x] Swift Package Manager (Xcode 11 Beta) ### Library version: - [x] head - [ ] v1.2.1 - [ ] v1.2 (Swift 4.0) - [ ] v1.0.0 - [ ] v0.6 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [x] 11.0 (Swift 5.0) - [ ] 9.3 (Swift 4.1) - [ ] 9.0 (Swift 4.0) - [ ] 9.0 (Swift 3.2) - [ ] 8.x (Swift 3.x) - [ ] 8.0 (Swift 2.3) - [ ] 7.3.1 - [ ] other: (Please fill in the version you are using.) - [ ] objective c
kerem closed this issue 2026-03-03 16:47:57 +03:00
Author
Owner

@phimage commented on GitHub (Jun 17, 2019):

Just to check, on Mojave or Catalina beta?
I have. It tested yet

Then this error exist when OauthSwift is used has app extension without the compilation flag set

<!-- gh-comment-id:502563480 --> @phimage commented on GitHub (Jun 17, 2019): Just to check, on Mojave or Catalina beta? I have. It tested yet Then this error exist when OauthSwift is used has app extension without the compilation flag set
Author
Owner

@paulhimes commented on GitHub (Jun 17, 2019):

This was on Mojave. The app has no extensions.

<!-- gh-comment-id:502656861 --> @paulhimes commented on GitHub (Jun 17, 2019): This was on Mojave. The app has no extensions.
Author
Owner

@phimage commented on GitHub (Jun 19, 2019):

I add a missing import of UIKit
compilator is more strict I think

There is also some issue on macOS in OAuthWebViewController
It seems to have some issue to check swift version to make version compatible code

#if swift(>=5.1)
p.presentViewControllerAsSheet(self) // renamed 
#else
p.presentAsSheet(self)
#endif
<!-- gh-comment-id:503602076 --> @phimage commented on GitHub (Jun 19, 2019): I add a missing import of `UIKit` compilator is more strict I think There is also some issue on macOS in `OAuthWebViewController` It seems to have some issue to check swift version to make version compatible code ```swift #if swift(>=5.1) p.presentViewControllerAsSheet(self) // renamed #else p.presentAsSheet(self) #endif ```
Author
Owner

@paulhimes commented on GitHub (Jun 21, 2019):

Your changes fixed the problem for me. Thanks!

<!-- gh-comment-id:504411168 --> @paulhimes commented on GitHub (Jun 21, 2019): Your changes fixed the problem for me. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/OAuthSwift#348
No description provided.