dimanche 3 novembre 2019

Pass data from .cpp file to Objective c ViewController

I have a class called Client which is written in C++, It receives the message from the server and whenever the message is received i want to show the alert to users that what text has received? Simply need to notify the message to controllers. I have searched many blocks i can't find any example. Can anyone please give me a sample code to pass data?

In .cpp file this function will be triggered when the message is received

void Client::processMessage(CMsg *message) {
    assert(message);

    Log("<- %s", message->HumanReadableDescription().c_str());
    Log("received message = %s",message->HumanReadableDescription().c_str());

    string text = receivedMeassage.substr(0, 4);
    if (text == "Text") {
        Log("Code entered");
        long position = receivedMeassage.find(":");
        string sub = receivedMeassage.substr(position+1);
        currentMessage = sub;
        receievedMessages = currentMessage;
        Log(sub);
    }
    Log(receivedMeassage);
}

If the text is received i want to show popup to the users.

Aucun commentaire:

Enregistrer un commentaire