[GH-ISSUE #676] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The provided scheme is not valid. A scheme should not include special characters such as ":" or "/".' #438

Closed
opened 2026-03-03 16:48:41 +03:00 by kerem · 1 comment
Owner

Originally created by @khsalman on GitHub (Sep 17, 2021).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/676

Description:

I am continuously receiving this "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The provided scheme is not valid. A scheme should not include special characters such as ":" or "/".'" error on iOS 14.5+ devices. Below iOS 14.5 everything was working perfect. It says I cannot make any callback url with using : and // But Fitbit's panel does not allow me to have a callback url without using ://
Please anyone can suggest me any solution?

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

OAuth Version:

  • Version 1
  • Version 2

OS (Please fill the version) :

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

Installation method:

  • Carthage
  • CocoaPods
  • Swift Package Manager
  • Manually

Library version:

  • head
  • v2.1.0
  • v2.0.0
  • v1.4.1
  • other: (Please fill in the version you are using.)

Xcode version:

  • 11.4 (Swift 5.2)

  • 11.x (Swift 5.1)

  • 10.x (Swift 5.0)

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

  • objective c

Originally created by @khsalman on GitHub (Sep 17, 2021). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/676 ### Description: I am continuously receiving this "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'The provided scheme is not valid. A scheme should not include special characters such as ":" or "/".'" error on iOS 14.5+ devices. Below iOS 14.5 everything was working perfect. It says I cannot make any callback url with using : and // But Fitbit's panel does not allow me to have a callback url without using :// Please anyone can suggest me any solution? ### OAuth Provider? (Twitter, Github, ..): ### OAuth Version: - [ ] Version 1 - [ ] Version 2 ### OS (Please fill the version) : - [x] iOS : - [ ] OSX : - [ ] TVOS : - [ ] WatchOS : ### Installation method: - [ ] Carthage - [x] CocoaPods - [ ] Swift Package Manager - [ ] Manually ### Library version: - [ ] head - [ ] v2.1.0 - [ ] v2.0.0 - [ ] v1.4.1 - [ ] other: (Please fill in the version you are using.) ### Xcode version: - [ ] 11.4 (Swift 5.2) - [ ] 11.x (Swift 5.1) - [ ] 10.x (Swift 5.0) - [x] other: (Please fill in the version you are using.) - [ ] objective c
kerem closed this issue 2026-03-03 16:48:41 +03:00
Author
Owner

@phatblat commented on GitHub (Sep 23, 2021):

My team ran into this issue as well. It's a change to the Apple ASWebAuthenticationSession behavior of the callbackURLScheme parameter; it should be a scheme and NOT a full URL. If you pass a full URL (containing a :) it will be emit a console warning about the invalid scheme on iOS 14.4 and lower, but it is a runtime exception on iOS 14.5+.

This OAuthSwift library did not change this behavior but before #654 you actually couldn't get OAuth errors returned unless you did pass a URL in the callbackURLScheme parameter. This was fixed in 2.2.

I would describe this as "expected behavior" now. Change your code to pass in only your app's custom scheme (not the full URL) in the callbackURLScheme parameter.

<!-- gh-comment-id:925442973 --> @phatblat commented on GitHub (Sep 23, 2021): My team ran into this issue as well. It's a change to the Apple [`ASWebAuthenticationSession`](https://developer.apple.com/documentation/authenticationservices/aswebauthenticationsession) behavior of the `callbackURLScheme` parameter; it should be a _scheme_ and **NOT** a full URL. If you pass a full URL (containing a `:`) it will be emit a console warning about the invalid scheme on iOS 14.4 and lower, but it is a runtime exception on iOS 14.5+. This OAuthSwift library did not change this behavior but before #654 you actually couldn't get OAuth errors returned unless you _did_ pass a URL in the `callbackURLScheme` parameter. This was fixed in 2.2. I would describe this as "expected behavior" now. Change your code to pass in only your app's [custom scheme](https://developer.apple.com/documentation/xcode/defining-a-custom-url-scheme-for-your-app) (not the full URL) in the `callbackURLScheme` parameter.
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#438
No description provided.