I am trying to run the simple example in EOSIOSwift git repo (https://github.com/EOSIO/eosio-swift), but it does not work.

The example is like this:

let transaction = EosioTransaction()
transaction.rpcProvider = EosioRpcProvider(endpoint: URL(string: "http://localhost:8888")!)
transaction.serializationProvider = EosioAbieosSerializationProvider()
transaction.signatureProvider = try EosioSoftkeySignatureProvider(privateKeys: ["yourPrivateKey"])

/// Actions can now be added to the transaction, which can, in turn, be signed and broadcast:

let action = try EosioTransaction.Action(
    account: EosioName("eosio.token"),
    name: EosioName("transfer"),
    authorization: [EosioTransaction.Action.Authorization(
        actor: EosioName("useraaaaaaaa"),
        permission: EosioName("active"))
    data: Transfer(
        from: EosioName("useraaaaaaaa"),
        to: EosioName("useraaaaaaab"),
        quantity: "42.0000 SYS",
        memo: "")

transaction.add(action: action)

transaction.signAndBroadcast { (result) in
    switch result {
    case .failure (let error):
        // Handle error.
        print("ERROR SIGN/SEND Tx", error, "Reason", error.reason)
    case .success:
        // Handle success.
        print("signed Tx.")

When I run the code above I get from

print("ERROR SIGN/SEND Tx", error, "Reason", error.reason)

the following message:

ERROR SIGN/SEND Tx There was an unexpected error. Reason self does not exist

2 Answers 2


Hmmm, the error isn't very descriptive. Are you defining the Transfer separately? That should be a struct. Example:

struct Transfer: Codable {
    var from: EosioName
    var to: EosioName
    var quantity: String
    var memo: String

Other than that, we use this library extensively and haven't run into this issue. I recommend checking out the iOS Example App to test out a working example: https://github.com/EOSIO/eosio-swift-ios-example-app

That could serve as a working baseline for you.


The problem was that the Transaction object would leave scope before the event loop would call the sign function, hence the self does not exist.

Maybe the error message could be extended with self does not exist. object left scope. Consider instantiating object outside the current scope.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.