Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database.swift/QueryParameters case Keys ([AnyObject]) does not compile in linux #8

Closed
tkhuran opened this issue Apr 18, 2016 · 6 comments

Comments

@tkhuran
Copy link

tkhuran commented Apr 18, 2016

error: value of type 'String' does not conform to expected element type 'AnyObject'

if os(Linux)

case Keys ([Any])
#else
case Keys ([AnyObject])
#endif

if os(Linux)

case EndKey (Any)
#else
case EndKey (AnyObject)
#endif

if os(Linux)

case StartKey (Any)
#else
case StartKey (AnyObject)
#endif

public func queryByView(view: String, ofDesign design: String, usingParameters params: [Database.QueryParameters], callback: (JSON?, NSError?) -> ()) {
var paramString = ""
#if os(Linux)
var keys: [Any]?
#else
var keys: [AnyObject]?
#endif

// other code goes here.
}

@shmuelk
Copy link
Collaborator

shmuelk commented Apr 19, 2016

I just built both the master and develop branches of Kitura-CouchDB on Linux. Both built and ran our tests flawlessly.

What version of Swift were you using? We currently support the 03/24 DEVELOPMENT drop of Swift 3.0

@tkhuran
Copy link
Author

tkhuran commented Apr 19, 2016

Yes, it builds inside the package, but you will get the errors when you try to use the .Key option.

Example:
database.queryByView("sortedByDate", ofDesign: "photos", usingParameters: [.Keys("key")]) { (document, error) in
// your code goes here
}

$ swift build -Xcc -fblocks
Compiling Swift Module 'LoggerAPI' (1 sources)
Compiling Swift Module 'Socket' (3 sources)
Compiling Swift Module 'SwiftyJSON' (2 sources)
Compiling Swift Module 'KituraTemplateEngine' (1 sources)
Compiling Swift Module 'KituraSys' (4 sources)
Compiling Swift Module 'HeliumLogger' (1 sources)
Compiling Swift Module 'KituraNet' (12 sources)
Compiling Swift Module 'SwiftRedis' (3 sources)
Compiling Swift Module 'Kitura' (10 sources)
Compiling Swift Module 'CouchDB' (4 sources)
Compiling Swift Module 'CouchDBSample' (1 sources)
Compiling Swift Module 'Credentials' (3 sources)
Compiling Swift Module 'CredentialsFacebookToken' (1 sources)
Compiling Swift Module 'CredentialsGoogleToken' (1 sources)
Linking .build/debug/CouchDBSample
Compiling Swift Module 'KituraBluePicserver' (4 sources)
/vagrant/Kitura-Apps/Kitura-BluePic/KituraBluePic-server/KituraBluePic-server/Photos.swift:37:85: error: cannot convert value of type 'String' to expected argument type '[AnyObject]'
database.queryByView("sortedByDate", ofDesign: "photos", usingParameters: [.Keys("true")]) { (document, error) in
^~~
:0: error: build had 1 command failures
error: exit(1): /home/vagrant/swift-DEVELOPMENT-SNAPSHOT-2016-03-24-a-ubuntu15.10/usr/bin/swift-build-tool -f /vagrant/Kitura-Apps/Kitura-BluePic/KituraBluePic-server/.build/debug.yaml default

@samwarfield
Copy link
Contributor

I am noticing this same issue using 03/24 DEVELOPMENT...

samwarfield added a commit to samwarfield/Kitura-CouchDB that referenced this issue Apr 28, 2016
irar2 added a commit that referenced this issue May 10, 2016
@shmuelk
Copy link
Collaborator

shmuelk commented Jun 5, 2016

@tkhuran I have been reviewing our open issues. I think we fixed this one in the prior commit. Can you please verify that this issue has been dealt with.

Thanks.

@tkhuran
Copy link
Author

tkhuran commented Jun 6, 2016

yes, this looks great now. Thanks!

@shmuelk
Copy link
Collaborator

shmuelk commented Jun 7, 2016

Your welcome

@shmuelk shmuelk closed this as completed Jun 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants