Skip to content
This repository was archived by the owner on Feb 5, 2026. It is now read-only.
This repository was archived by the owner on Feb 5, 2026. It is now read-only.

Usage in swift raises exception #132

@mradke

Description

@mradke

I am trying to connect to a local owncloud instance with swift using this library.
The app example you are providing is working fine with my local setup. I have successfully imported the libownCloudiOS.a library and header files as per the Readme instructions.

Now when I try to invoke the readFolder method, an exception is raised:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString encodeString:]: unrecognized selector sent to instance

The function provoking this error looks like:

let com = OCCommunication()
com.setCredentialsWithUser("admin", andPassword: "password")

var path = "http://cloud.local.dev/remote.php/webdav/"
path = path.stringByRemovingPercentEncoding!
print(path)

com.readFolder(path, withUserSessionToken: UtilsFramework.getUserSessionToken(), onCommunication: com, successRequest: { (response: NSHTTPURLResponse!, items: [AnyObject]!, token: String!, redirectServer:String!) in
        print("success")
                }, failureRequest: { (response: NSHTTPURLResponse!, error: NSError!, token: String!, redirectServer: String!) in
        print("failure")
    })
}

Am I missing some arcane "this does not work in swift/objc that way" gotchas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions