How to send data between iPhone and Electron using function call

Will this work for sending a function call with data from iPhone to Electron, and Electron sends back integer?

APPLE SIDE:
NSURLSessionDataTask *task = [myPhoton callFunction:@“digitalWrite” withArguments:@[@">>>>>> MY STRING OF UP TO 63 BYTES HERE <<<<<<<",@1] completion:^(NSNumber *resultCode, NSError *error) {
if (!error)
{
resultCode = >>>>>> 32 bit integer returned from Electron function <<<<<<<<<<
}
}];
int64_t bytesToReceive = task.countOfBytesExpectedToReceive;
// …do something with bytesToReceive <<<<<<<<<<<<< I DON’T UNDERSTAND THIS.

ELECTRON SIDE:
int my_function(String my_input_data_from_iPhone)
{
unsigned my_32bit_ output_data;
// process my_input_data_from_iPhone, and generate my_32bit_ output_data

return my_32bit_ output_data;
}

Can Electron particle.function return long long (64 bits) or just int (32 bits)?

Yes, you should be able to do what you propose for sending data of up to 63 bytes to the Electron, and get back a 32 bit integer. I’m pretty sure you can’t send a 64 bit one. If you need to get more data back to your Apple app, then you could put the data in a particle.variable (up to a 622 byte string), and read that from your app after you get the return int from the function (which would indicate that the data has been sent to the Electron and processed however you need).

You don’t need to use the countOfBytesExpectedToReceive method; I’ve never used it in any of my completion handlers.