1

I'm pretty new with EOS programming and I'm trying to run simple broadcast transaction. I'm using following code:

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.
    case .success:
        // Handle success.
    }
}

Unfortunately at the end I'm receiving following error:

Error was encountered in RpcProvider. The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

I'm running nodes with following parameters:

nodeos -e -p eosio \
--plugin eosio::producer_plugin \
--plugin eosio::producer_api_plugin \
--plugin eosio::chain_api_plugin \
--plugin eosio::http_plugin \
--plugin eosio::history_plugin \
--plugin eosio::history_api_plugin \
--filter-on="*" \
--access-control-allow-origin='*' \
--contracts-console \
--http-validate-host=false \
--verbose-http-errors

Can someone suggest me where I'm wrong and how to run this test connecting to my http://localhost:8888?

3
  • 1
    I found the solution - I added in info.plist following: <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> </dict>
    – Boni
    Jul 11, 2021 at 5:13
  • can you please update your question with the OS you are using? and where is the location of the "info.plist" file? and if you found this solution somewhere else maybe link it here? and if you found it by yourself can you please explain what was your thought process that leaded you to this solution?
    – ovi
    Aug 27, 2021 at 9:21
  • I'm using Xcode 12.5 on Mac OS BigSur. Every OSX (or IOS) app have info.plist file generated by the Xcode. It can be found into your project.
    – Boni
    Aug 27, 2021 at 9:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.