SDKsiOS
Create an image message from a local path
Create an image message from an absolute path with OpenIM iOS SDK.
Invoke createImageMessageFromFullPath: on OIMMessageInfo to construct an image message from an absolute file path in the local application sandbox. The SDK automatically extracts image dimensions and performs object storage uploads during dispatch:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
imagePath | NSString * | Yes | Absolute path to the image file within the application sandbox. |
Code example
OIMMessageInfo *message =
[OIMMessageInfo createImageMessageFromFullPath:imageURL.path];Return value
Returns an initialized OIMMessageInfo model with its content type set to image.
State changes after the call
- Local memory instantiation: This method builds an in-memory model without writing to the database or uploading files immediately.
- Subsequent dispatch: Call Send a message to initiate built-in media uploading and message dispatch. If the image is already hosted externally, use Create an image message from a URL.
Was this page helpful?