IMSDK
IM features a comprehensive suite of solutions including global access, one-to-one chat, group chat, message push, profile and relationship chain hosting, and account authentication. It also provides complete app access and backend management APIs.
V2TIMFileElem

Instance Methods

(void) - getUrl:
 
(void) - downloadFile:progress:succ:fail:
 
(V2TIMElem *) - nextElem
 
(void) - appendElem:
 

Properties

NSString * path
 
NSString * uuid
 
NSString * filename
 
int fileSize
 

Method Documentation

◆ getUrl:()

- (void) getUrl: (void(^)(NSString *url))  urlCallBack

Get the file download URL.

◆ downloadFile:progress:succ:fail:()

- (void) downloadFile: (NSString *)  path
progress: (V2TIMDownLoadProgress)  progress
succ: (V2TIMSucc)  succ
fail: (V2TIMFail)  fail 

Download a file

The downloadFile API downloads files from the server each time. If cache or storage is required, you can use UUIDs as keys for external storage. The IM SDK does not store resource files.

Parameters
pathFile save path, which must be specified externally

◆ nextElem()

- (V2TIMElem *) nextElem

Get the next Elem. If your message has multiple Elems, you can get the next Elem object from the current Elem. If the return value is nil, it means the Elem acquisition is over. For detailed usage, please refer to the document Message sending and receiving

◆ appendElem:()

- (void) appendElem: (V2TIMElem *)  elem

Add the next element
To configure multiple elements, after creating a Message object, you can add the next element via the element object of Message. The following is the sample code for creating V2TIMTextElem and V2TIMCustomElem:

    V2TIMMessage *msg = [[V2TIMManager sharedInstance] createTextMessage:"text"];
    V2TIMCustomElem *customElem = [[V2TIMCustomElem alloc] init];
    customElem.data = ["自定义消息" dataUsingEncoding:NSUTF8StringEncoding];
    [msg.textElem appendElem:customElem];
Attention
  • This API can be called only by elements of a Message object created via createMessage.
  • This API can be used to add V2TIMTextElem, V2TIMCustomElem, V2TIMFaceElem, or V2TIMLocationElem.

Property Documentation

◆ path

- (NSString*) path
readnonatomicstrong

Path to the local file sent(valid only for the message sender)

◆ uuid

- (NSString*) uuid
readnonatomicstrong

File ID which is an internal ID and can be used as an external cache key.

◆ filename

- (NSString*) filename
readnonatomicstrong

File name.

◆ fileSize

- (int) fileSize
readnonatomicassign

File size.