I have successfully configured a Bluemix backend vehicle monitoring app described in this tutorial:
http://www.ibm.com/developerworks/library/mo-connectedcar-app/index.html.
I have configured and ran the tester app successfully. I have also successfully initiated BMSClient on iOS( after adding mobile access service to the backend app), using the following code:
BMSClient.sharedInstance.initialize(bluemixAppRoute: backendURL, bluemixAppGUID: backendGUID, bluemixRegion: BMSClient.Region.usSouth)
let mcaAuthManager = MCAAuthorizationManager.sharedInstance
mcaAuthManager.initialize(tenantId: tenantId)
BMSClient.sharedInstance.authorizationManager = mcaAuthManager
BMSClient.sharedInstance.authorizationManager = MCAAuthorizationManager.sharedInstance
Here is a snippet of how tester app updates the information:
var id = $("#prop_id").val();
var property = $("#property").val();
var value = $("#value").val();
var payload = {
id: id,
property: property,
value: value
};
var group = id.split("-")[0];
var num = id.split("-")[1];
var message = new Messaging.Message(JSON.stringify(payload));
message.destinationName = "iot-2/type/"+window.config.iot_deviceType+"/id/"+id.split("-")[0]+"/cmd/setProperty/fmt/json";
$("#statusMessage").html("Published command!<br><b>Topic: </b>" + message.destinationName + "<br><b>Payload: </b><pre>" + JSON.stringify(payload, null, 4) + "</pre>");
$("#statusMessage").css("display", "block");
client.send(message);
Now I want to update manage(update properties, and/or send message to) the simulated vehicles via iOS app. The thing is that I am unable to find an API to do this on iOS.
Do I need to develop a backend API also? If no, on iOS, how can I get an API to do this?
Also here are URLs:
Backend app: http://alvi-app.mybluemix.net/
Tester app URL to update properties: http://alvi-app.mybluemix.net/tester
You will need to develop a custom backend API to accept messages for updating properties, etc. sent from your iOS app.
You can send a REST request using the BMS Core libraries from your iOS app to your backend. Then you can have your backend process these requests to update properties, etc.
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-swift-core
The Core SDK has an example of a REST request in the README.