[GH-ISSUE #31] Serious compile issues #16

Closed
opened 2026-03-03 16:44:49 +03:00 by kerem · 7 comments
Owner

Originally created by @TarangKhanna on GitHub (Mar 8, 2015).
Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/31

The error is: unknown>:0: error: could not build Objective-C module 'OAuthSwift'
It works and suddenly it gives this error on build. I have tried this on 3 different laptops and the solution to clean build and delete derived data does not work all the time. Sometimes it shows one error(aforementioned) or it shows 21 errors
We spent over 4 hours with apple engineers on this in a hackathon with no progress.
Thank you for your work!

Originally created by @TarangKhanna on GitHub (Mar 8, 2015). Original GitHub issue: https://github.com/OAuthSwift/OAuthSwift/issues/31 The error is: unknown>:0: error: could not build Objective-C module 'OAuthSwift' It works and suddenly it gives this error on build. I have tried this on 3 different laptops and the solution to clean build and delete derived data does not work all the time. Sometimes it shows one error(aforementioned) or it shows 21 errors We spent over 4 hours with apple engineers on this in a hackathon with no progress. Thank you for your work!
kerem closed this issue 2026-03-03 16:44:49 +03:00
Author
Owner

@danshev commented on GitHub (Mar 15, 2015):

I believe related:

When I open the Demo in the newest version of xCode 6.2 (6C131e), I also get a lot of compile errors. Many are in the OAuth1 and OAuth2 due to the use of as!. When I remove the exclamation, the errors go away, except for a few:

Cannot downcast from 'UIViewController?' to non-@objc protocol type 'WebViewProtocol'

on the line:

if let webView = self.webViewController as WebViewProtocol {
<!-- gh-comment-id:81257467 --> @danshev commented on GitHub (Mar 15, 2015): I believe related: When I open the Demo in the newest version of xCode 6.2 (6C131e), I also get a lot of compile errors. Many are in the `OAuth1` and `OAuth2` due to the use of `as!`. When I remove the exclamation, the errors go away, except for a few: `Cannot downcast from 'UIViewController?' to non-@objc protocol type 'WebViewProtocol'` on the line: ``` if let webView = self.webViewController as WebViewProtocol { ```
Author
Owner

@Chrisell commented on GitHub (Mar 22, 2015):

Same issues here. Xcode Version 6.2 (6C131e) as well. I'm assuming the master build has been upgraded for Xcode6.3/iOS 8.3, hence the errors?

<!-- gh-comment-id:84476416 --> @Chrisell commented on GitHub (Mar 22, 2015): Same issues here. Xcode Version 6.2 (6C131e) as well. I'm assuming the master build has been upgraded for Xcode6.3/iOS 8.3, hence the errors?
Author
Owner

@ramki1979 commented on GitHub (Apr 6, 2015):

How to build this with 6.1.1, I am getting the following errors for length & size methods in String+OAuthSwift.swift

'String' is not convertible to 'Range<I>'

Update: Use https://github.com/WazzeZ/OAuthSwift fork for xcode 6.1 and 6.2

<!-- gh-comment-id:89917992 --> @ramki1979 commented on GitHub (Apr 6, 2015): How to build this with 6.1.1, I am getting the following errors for <b>length</b> & <b>size</b> methods in String+OAuthSwift.swift ``` swift 'String' is not convertible to 'Range<I>' ``` Update: Use https://github.com/WazzeZ/OAuthSwift fork for xcode 6.1 and 6.2
Author
Owner

@gabriel-jones commented on GitHub (Apr 6, 2015):

SUPPORT FOR BEFORE SWIFT 1.2

There are a few main types of errors. First, the down casting he does looks like this:
as! String
Which will make an error. What you have to do is write this:
as String!


Next error is what danshev said:
if let webView = self.webViewController as? WebViewProtocol
Has an error. Easiest way to fix this is to go to OAuthWebViewController.swift and find this piece of code on line 13:
protocol WebViewProtocol
and change it to:
@objc protocol WebViewProtocol


Next error is what ramki1979 said: there are some string errors in some files. One you can fix is this:
if count(queryString.utf16) == 0
Just change it to a property, not a function:
if queryString.utf16Count == 0

Bascially, if you ever see
count(stringName.utf16)
Just change it to
stringName.utf16Count

Also another example under String+OAuthSwift.swift you will find this:
func length()->Int{ return count(self) }

which should just return:
return self.utf16Count


Hope I helped you guys. Tell me if I missed anything!

<!-- gh-comment-id:90116833 --> @gabriel-jones commented on GitHub (Apr 6, 2015): SUPPORT FOR **BEFORE** SWIFT 1.2 There are a few main types of errors. First, the down casting he does looks like this: `as! String` Which will make an error. What you have to do is write this: `as String!` --- Next error is what danshev said: `if let webView = self.webViewController as? WebViewProtocol` Has an error. Easiest way to fix this is to go to `OAuthWebViewController.swift` and find this piece of code on line 13: `protocol WebViewProtocol` and change it to: `@objc protocol WebViewProtocol` --- Next error is what ramki1979 said: there are some string errors in some files. One you can fix is this: `if count(queryString.utf16) == 0` Just change it to a property, not a function: `if queryString.utf16Count == 0` Bascially, if you ever see `count(stringName.utf16)` Just change it to `stringName.utf16Count` Also another example under `String+OAuthSwift.swift` you will find this: `func length()->Int{ return count(self) }` which should just return: `return self.utf16Count` --- Hope I helped you guys. Tell me if I missed anything!
Author
Owner

@ejpusa-zz commented on GitHub (Apr 11, 2015):

Ok, almost@ Down to 1 error, tried a number of permutations, still bugs out. Thanks for all your help gabriel-jones.
screen shot 2015-04-11 at 4 07 53 pm

<!-- gh-comment-id:91920603 --> @ejpusa-zz commented on GitHub (Apr 11, 2015): Ok, almost@ Down to 1 error, tried a number of permutations, still bugs out. Thanks for all your help gabriel-jones. ![screen shot 2015-04-11 at 4 07 53 pm](https://cloud.githubusercontent.com/assets/1279819/7103091/3ece784e-e065-11e4-9644-e02f7e735000.png)
Author
Owner

@ejpusa-zz commented on GitHub (Apr 11, 2015):

Got it! Thanks. Looks clean. Wow, lots of crazy code, what books do you read? This code seems pretty hardcore, how do you keep up with it? Blogs, sites, coders you follow? :-)

screen shot 2015-04-11 at 4 13 59 pm

<!-- gh-comment-id:91920876 --> @ejpusa-zz commented on GitHub (Apr 11, 2015): Got it! Thanks. Looks clean. Wow, lots of crazy code, what books do you read? This code seems pretty hardcore, how do you keep up with it? Blogs, sites, coders you follow? :-) ![screen shot 2015-04-11 at 4 13 59 pm](https://cloud.githubusercontent.com/assets/1279819/7103112/cf14154e-e065-11e4-9bb1-1c285a15fac2.png)
Author
Owner

@phimage commented on GitHub (Sep 29, 2015):

@TarangKhanna please close this old github issue
(only you or project owner can do it)

<!-- gh-comment-id:144117412 --> @phimage commented on GitHub (Sep 29, 2015): @TarangKhanna please close this old github issue (only you or project owner can do it)
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#16
No description provided.