NIMResourceManager Protocol Reference

Conforms to NSObject
Declared in NIMResourceManagerProtocol.h

Overview

Resource management

– upload:progress:completion: required method

Upload a file

- (void)upload:(NSString *)filepath progress:(nullable NIMHttpProgressBlock)progress completion:(nullable NIMUploadCompleteBlock)completion

Parameters

filepath

File path

progress

progress Block

completion

upload Block

Discussion

Upload a file

Declared In

NIMResourceManagerProtocol.h

– upload:scene:progress:completion: required method

Upload a file

- (void)upload:(NSString *)filepath scene:(nonnull NSString *)scene progress:(nullable NIMHttpProgressBlock)progress completion:(nullable NIMUploadCompleteBlock)completion

Parameters

filepath

File path

scene

scenario

progress

progress Block

completion

upload Block

Discussion

Upload a file

Declared In

NIMResourceManagerProtocol.h

– upload:scene:md5:progress:completion: required method

Upload a file

- (void)upload:(NSString *_Nonnull)filepath scene:(nullable NSString *)scene md5:(nullable NSString *)md5 progress:(nullable NIMHttpProgressBlock)progress completion:(nullable NIMUploadCompleteBlock)completion

Parameters

filepath

File path

scene

scenario

md5

MD5 value of a file

progress

progress Block

completion

upload Block

Discussion

Upload a file

Declared In

NIMResourceManagerProtocol.h

– upload:extraInfo:progress:completion: required method

Upload a file

- (void)upload:(NSString *_Nonnull)filepath extraInfo:(nullable NIMResourceExtraInfo *)extraInfo progress:(nullable NIMHttpProgressBlock)progress completion:(nullable NIMUploadCompleteBlock)completion

Parameters

filepath

File path

extraInfo

Extra info

progress

progress Block

completion

upload Block

Discussion

Upload a file

Declared In

NIMResourceManagerProtocol.h

– download:filepath:progress:completion: required method

Download files

- (void)download:(NSString *)urlString filepath:(NSString *)filepath progress:(nullable NIMHttpProgressBlock)progress completion:(nullable NIMDownloadCompleteBlock)completion

Parameters

urlString

download URL

filepath

File path

progress

progress Block

completion

Block form completion

Discussion

Download files

Declared In

NIMResourceManagerProtocol.h

– download:filepath:extraInfo:progress:completion: required method

Download files

- (void)download:(NSString *)urlString filepath:(NSString *)filepath extraInfo:(NIMResourceExtraInfo *_Nullable)extraInfo progress:(NIMHttpProgressBlock _Nullable)progress completion:(NIMDownloadCompleteBlock _Nullable)completion

Parameters

urlString

download URL

filepath

File path

extraInfo

Extra info

progress

progress Block

completion

Block form completion

Discussion

Download files

Declared In

NIMResourceManagerProtocol.h

– download:filepath:type:extraInfo:progress:completion: required method

Download files

- (void)download:(NSString *)urlString filepath:(NSString *)filepath type:(NSInteger)type extraInfo:(NIMResourceExtraInfo *)info progress:(NIMHttpProgressBlock)progress completion:(NIMDownloadCompleteBlock)completion

Parameters

urlString

download URL

filepath

File path

type

FCS download type (special functionality, please contact technical support to activate the feature)

progress

progress Block

completion

Block form completion

extraInfo

Extra info

Discussion

Download files

Declared In

NIMResourceManagerProtocol.h

– cancelTask: required method

Cancel an upload or download task

- (void)cancelTask:(NSString *)filepath

Parameters

filepath

File path

Discussion

Cancel an upload or download task

If a file is uploaded or downloaded at the same time (this is unlikely in theory), ResourceManager will perform task merging. All upload/download tasks of a file can be cancelled

Declared In

NIMResourceManagerProtocol.h

– normalizeURLString: required method

Normalize a URL

- (NSString *)normalizeURLString:(NSString *)urlString

Parameters

urlString

URL

Discussion

Normalize a URL

According to the requirements of NIMSDK to normalize the URL. Calling this interface is equivalent to calling convertHttpToHttps: and convertURLToAcceleratedURL:

Declared In

NIMResourceManagerProtocol.h

– convertHttpToHttps: required method

Convert an HTTP URL to an HTTPS URL

- (NSString *)convertHttpToHttps:(NSString *)urlString

Parameters

urlString

HTTP URL

Discussion

Convert an HTTP URL to an HTTPS URL

The SDK will automatically process the HTTP URL in all messages except custom messages to ensure compliance with Apple’s requirements, but the SDK does not recognize where the specific attributes are in HTTP URLs in custom messages, so when downloading these files, the upper layer of the application must handle the logic. If the URL is an HTTPS address, return the string directly. If the URL is not recognized by CommsEase, it will directly return the address with HTTPS added.

Declared In

NIMResourceManagerProtocol.h

– convertURLToAcceleratedURL: required method

Convert a URL to accelerated CDN URL

- (NSString *)convertURLToAcceleratedURL:(NSString *)urlString

Parameters

urlString

original URL

Discussion

Convert a URL to accelerated CDN URL

The SDK will automatically process the URLs in all messages except custom messages to ensure compliance with Apple’s requirements, but the SDK does not recognize where the specific attributes are in URLs in custom messages, so when downloading these files, the upper layer of the application must replace the original URLs with CDN addresses to accelerate data transfer.

Declared In

NIMResourceManagerProtocol.h

– imageThumbnailURL: required method

Convert a URL of a NOS image to a thumbnail URL

- (NSString *)imageThumbnailURL:(NSString *)urlString

Parameters

urlString

image URL

Discussion

Convert a URL of a NOS image to a thumbnail URL

Declared In

NIMResourceManagerProtocol.h

– videoThumbnailURL: required method

Convert a URL of a NOS video to a thumbnail URL

- (NSString *)videoThumbnailURL:(NSString *)urlString

Parameters

urlString

video URL

Discussion

Convert a URL of a NOS video to a thumbnail URL

Declared In

NIMResourceManagerProtocol.h

– searchResourceFiles:completion: required method

Search resource files

- (void)searchResourceFiles:(NIMResourceQueryOption *)option completion:(NIMResourceSearchHandler)completion

Parameters

option

search option

completion

Completion callback

Discussion

Search resource files

Declared In

NIMResourceManagerProtocol.h

– removeResourceFiles:completion: required method

Delete cache resource files

- (void)removeResourceFiles:(NIMResourceQueryOption *)option completion:(NIMResourceDeleteHandler)completion

Parameters

option

search option

completion

Completion callback

Discussion

Delete cache resource files

Declared In

NIMResourceManagerProtocol.h

– fetchNOSURLWithURL:completion: required method

Obtain the original URL with a short URL

- (void)fetchNOSURLWithURL:(NSString *)shortCode completion:(NIMFetchURLCompletion)completion

Parameters

shortCode

Short URL

completion

Callback for operation completion

Discussion

Obtain the original URL with a short URL

If security setting is configured for files stored in NOS, the URL for uploading the file is a short link and cannot be downloaded directly. The original URL can be obtained using this interface

Declared In

NIMResourceManagerProtocol.h

– fetchNOSURLWithURL:roomId:completion: required method

Obtain the original URL with a short URL

- (void)fetchNOSURLWithURL:(NSString *)shortCode roomId:(NSString *_Nullable)roomId completion:(NIMFetchURLCompletion)completion

Parameters

shortCode

Short URL

roomId

chat room ID

completion

Callback for completing update

Discussion

Obtain the original URL with a short URL

If security setting is configured for files stored in NOS, the URL for uploading the file is a short link and cannot be downloaded directly. The original URL can be obtained using this interface

Declared In

NIMResourceManagerProtocol.h