SDKsiOS
Create a location message
Create a location message with OpenIM iOS SDK.
Invoke createLocationMessage:latitude:longitude: on OIMMessageInfo to construct a location message object containing geographical coordinates and a text description:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
description | NSString * | Yes | Location name or detailed address description text. |
latitude | double | Yes | Latitude coordinate value. |
longitude | double | Yes | Longitude coordinate value. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createLocationMessage:@"Pudong New Area, Shanghai"
latitude:31.2304
longitude:121.4737];Return value
Returns an initialized OIMMessageInfo model with its content type set to location.
State changes after the call
- Local memory instantiation: This method builds an in-memory message model without persisting records to local storage or making network requests.
- Coordinate system coordination: The SDK does not invoke system location services or perform coordinate conversions. Ensure that sender and receiver clients agree on a coordinate system convention (such as WGS-84 or GCJ-02).
- Subsequent dispatch: Call Send a message to deliver the location message.
Was this page helpful?