Skip to content

[iOS] EXC_BAD_ACCESS client.Call("ident.login") #24

@aogilvie

Description

@aogilvie

Sample code:

mage::RPC client("game", "localhost:2000");

    //
    // MAGE works with JSON-RPC: so
    // we create variables for the request's
    // parameters as well as for the response
    //
    Json::Value auth;
    Json::Value user;

    //
    // When logging in, you will need to submit:
    //
    // 1. An engine name, provided to you by the server-side developer
    // 2. A username
    // 3. A password
    //
    auth["engineName"] = "cms";
    auth["credentials"]["username"] = "username";
    auth["credentials"]["password"] = "password";

    //
    // Login will return you a user and a session. We take the
    // session and set it as our own.
    //
    // Note: It is possible that you need to call a different login
    // method. If it is the case, you should still expect to receive
    // the same data structure as with the standard ident module.
    //
    try {
        user = client.Call("ident.login", auth);

    } catch (mage::MageRPCError e) {
        cerr << "Could not login, an RPC error has occurred: "  << e.what() << " (code " << e.code() << ")" << endl;
// CRASH HERE EXC_BAD_ACCESS ********
        return;
    } catch (mage::MageErrorMessage e) {
        cerr << "Login failed: "  << e.code() << endl;
        return;
    }

I see the correct error log Could not login, an RPC error has occurred: MAGE RPC error: Client connector error: : Could not connect to http://localhost:2000/game/jsonrpc (code -32003) the straight after app crashes with EXC_BAD_ACCESS.

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