AVOSCloud Class Reference

Inherits from NSObject
Declared in AVOSCloud.h

Overview

AVOSCloud is the main Class for AVOSCloud SDK

Other Methods

+ setSSLPinningEnabled:

A switch of SSL Pinning for all LeanCloud’s HTTPS Requests. Default is False.

+ (void)setSSLPinningEnabled:(BOOL)enabled

Parameters

enabled

Set whatever you want if you master SSL & SSL Pinning.

Discussion

A switch of SSL Pinning for all LeanCloud’s HTTPS Requests. Default is False.

Declared In

AVOSCloud.h

+ setAllLogsEnabled:

Enable logs of all levels and domains. When define DEBUG macro, it’s enabled, otherwise, it’s not enabled. This is recommended. But you can set it NO, and call AVLogger’s methods to control which domains' log should be output.

+ (void)setAllLogsEnabled:(BOOL)enabled

Discussion

Enable logs of all levels and domains. When define DEBUG macro, it’s enabled, otherwise, it’s not enabled. This is recommended. But you can set it NO, and call AVLogger’s methods to control which domains' log should be output.

Declared In

AVOSCloud.h

+ setVerbosePolicy:

设置SDK信息显示

+ (void)setVerbosePolicy:(AVVerbosePolicy)verbosePolicy

Parameters

verbosePolicy

SDK信息显示策略,kAVVerboseShow为显示, kAVVerboseNone为不显示,kAVVerboseAuto在DEBUG时显示

Discussion

设置SDK信息显示

Declared In

AVOSCloud.h

Connecting to LeanCloud

+ setApplicationId:clientKey:

Sets the applicationId and clientKey of your application.

+ (void)setApplicationId:(NSString *)applicationId clientKey:(NSString *)clientKey

Parameters

applicationId

The applicaiton id for your LeanCloud application.

clientKey

The client key for your LeanCloud application.

Discussion

Sets the applicationId and clientKey of your application.

Declared In

AVOSCloud.h

+ getApplicationId

get Application Id

+ (NSString *)getApplicationId

Return Value

Application Id

Discussion

get Application Id

Declared In

AVOSCloud.h

+ getClientKey

get Client Key

+ (NSString *)getClientKey

Return Value

Client Key

Discussion

get Client Key

Declared In

AVOSCloud.h

+ setLastModifyEnabled:

开启LastModify支持, 减少流量消耗。默认关闭。

+ (void)setLastModifyEnabled:(BOOL)enabled

Parameters

enabled

开启 @attention 该方法并不会修改任何AVQuery的缓存策略,缓存策略以当前AVQuery的设置为准。该方法仅在进行网络请求时生效。如果想发挥该函数的最大作用,建议在查询时,将缓存策略选择为kAVCachePolicyNetworkOnly

Discussion

开启LastModify支持, 减少流量消耗。默认关闭。

Declared In

AVOSCloud.h

+ getLastModifyEnabled

获取是否开启LastModify支持

+ (BOOL)getLastModifyEnabled

Discussion

获取是否开启LastModify支持

Declared In

AVOSCloud.h

+ clearLastModifyCache

清空LastModify缓存

+ (void)clearLastModifyCache

Discussion

清空LastModify缓存

Declared In

AVOSCloud.h

+ setStorageType:

Set third party file storage service. If uses China server, you can use QCloud or Qiniu, the default is Qiniu, if uses US server, the default is AWS S3.

+ (void)setStorageType:(AVStorageType)type

Parameters

type

Qiniu, QCloud or AWS S3.

Discussion

Set third party file storage service. If uses China server, you can use QCloud or Qiniu, the default is Qiniu, if uses US server, the default is AWS S3.

Declared In

AVOSCloud.h

+ setServiceRegion:

Use specified region. If not specified, AVServiceRegionCN will be used.

+ (void)setServiceRegion:(AVServiceRegion)region

Discussion

Use specified region. If not specified, AVServiceRegionCN will be used.

Declared In

AVOSCloud.h

+ setServerURLString:forServiceModule:

Custom server URL for specific service module.

+ (void)setServerURLString:(NSString *)URLString forServiceModule:(AVServiceModule)serviceModule

Parameters

URLString

The URL string of service module.

serviceModule

The service module which you want to customize.

Discussion

Custom server URL for specific service module.

Declared In

AVOSCloud.h

+ networkTimeoutInterval

Get the timeout interval for network requests. Default is kAVDefaultNetworkTimeoutInterval (10 seconds)

+ (NSTimeInterval)networkTimeoutInterval

Return Value

timeout interval

Discussion

Get the timeout interval for network requests. Default is kAVDefaultNetworkTimeoutInterval (10 seconds)

Declared In

AVOSCloud.h

+ setNetworkTimeoutInterval:

Set the timeout interval for network request.

+ (void)setNetworkTimeoutInterval:(NSTimeInterval)time

Parameters

time

timeout interval(seconds)

Discussion

Set the timeout interval for network request.

Declared In

AVOSCloud.h

+ setLogLevel:

+ (void)setLogLevel:(AVLogLevel)level

+ logLevel

+ (AVLogLevel)logLevel

+ queryCacheExpiredDays

get the query cache expired days

+ (NSInteger)queryCacheExpiredDays

Return Value

the query cache expired days

Discussion

get the query cache expired days

Declared In

AVOSCloud.h

+ setQueryCacheExpiredDays:

set Query Cache Expired Days, default is 30 days

+ (void)setQueryCacheExpiredDays:(NSInteger)days

Parameters

days

the days you want to set

Discussion

set Query Cache Expired Days, default is 30 days

Declared In

AVOSCloud.h

+ fileCacheExpiredDays

get the file cache expired days

+ (NSInteger)fileCacheExpiredDays

Return Value

the file cache expired days

Discussion

get the file cache expired days

Declared In

AVOSCloud.h

+ setFileCacheExpiredDays:

set File Cache Expired Days, default is 30 days

+ (void)setFileCacheExpiredDays:(NSInteger)days

Parameters

days

the days you want to set

Discussion

set File Cache Expired Days, default is 30 days

Declared In

AVOSCloud.h

+ verifySmsCode:mobilePhoneNumber:callback:

验证短信验证码,需要开启手机短信验证 API 选项。 发送验证码给服务器进行验证。

+ (void)verifySmsCode:(NSString *)code mobilePhoneNumber:(NSString *)phoneNumber callback:(AVBooleanResultBlock)callback

Parameters

code

6位手机验证码

phoneNumber

11位电话号码

callback

回调结果

Discussion

验证短信验证码,需要开启手机短信验证 API 选项。 发送验证码给服务器进行验证。

Declared In

AVOSCloud.h

+ getServerDate:

获取服务端时间。

+ (nullable NSDate *)getServerDate:(NSError **)error

Discussion

获取服务端时间。

Declared In

AVOSCloud.h

+ getServerDateAndThrowsWithError:

An alias of [AVOSCloud getServerDate:] methods that supports Swift exception. @seealso [AVPush getServerDate:]

+ (nullable NSDate *)getServerDateAndThrowsWithError:(NSError **)error

Discussion

An alias of [AVOSCloud getServerDate:] methods that supports Swift exception. @seealso [AVPush getServerDate:]

Declared In

AVOSCloud.h

+ setTimeZoneForSecondsFromGMT:

Set a time zone offset from Greenwich Mean Time by a given number of seconds.

+ (void)setTimeZoneForSecondsFromGMT:(NSInteger)seconds

Parameters

seconds

Default is 0.

Discussion

Set a time zone offset from Greenwich Mean Time by a given number of seconds.

Declared In

AVOSCloud.h

+ getServerDateWithBlock:

异步地获取服务端时间。

+ (void)getServerDateWithBlock:(void ( ^ ) ( NSDate *_Nullable date , NSError *_Nullable error ))block

Parameters

block

回调结果。

Discussion

异步地获取服务端时间。

Declared In

AVOSCloud.h

+ registerForRemoteNotification

Register remote notification with all types (badge, alert, sound) and empty categories.

+ (void)registerForRemoteNotification

Discussion

Register remote notification with all types (badge, alert, sound) and empty categories.

Declared In

AVOSCloud.h

+ registerForRemoteNotificationTypes:categories:

Register remote notification with types.

+ (void)registerForRemoteNotificationTypes:(NSUInteger)types categories:(nullable NSSet *)categories

Parameters

types

Notification types.

categories

A set of UIUserNotificationCategory objects that define the groups of actions a notification may include. NOTE: categories only supported by iOS 8 and later. If application run below iOS 8, categories will be ignored.

Discussion

Register remote notification with types.

Declared In

AVOSCloud.h

+ handleRemoteNotificationsWithDeviceToken:

Handle device token registered from APNs. This method should be called in [UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:].

+ (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken

Parameters

deviceToken

Device token issued by APNs.

Discussion

Handle device token registered from APNs. This method should be called in [UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:].

Declared In

AVOSCloud.h

+ handleRemoteNotificationsWithDeviceToken:teamId:

Handle device token registered from APNs, with a team ID. This method should be called in [UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:].

+ (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken teamId:(NSString *_Nullable)teamId

Parameters

deviceToken

Device token issued by APNs.

teamId

Team ID.

Discussion

Handle device token registered from APNs, with a team ID. This method should be called in [UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:].

Declared In

AVOSCloud.h

+ handleRemoteNotificationsWithDeviceToken:constructingInstallationWithBlock:

Handle device token registered from APNs. This method should be called in [UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:].

+ (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken constructingInstallationWithBlock:(void ( ^ _Nullable ) ( AVInstallation *currentInstallation ))block

Parameters

deviceToken

Device token issued by APNs.

block

Constructing block of [AVInstallation defaultInstallation].

Discussion

Handle device token registered from APNs. This method should be called in [UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:].

Declared In

AVOSCloud.h

+ handleRemoteNotificationsWithDeviceToken:teamId:constructingInstallationWithBlock:

Handle device token registered from APNs, with a team ID. This method should be called in [UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:].

+ (void)handleRemoteNotificationsWithDeviceToken:(NSData *)deviceToken teamId:(NSString *_Nullable)teamId constructingInstallationWithBlock:(void ( ^ _Nullable ) ( AVInstallation *))block

Parameters

deviceToken

Device token issued by APNs.

teamId

Team ID.

block

Constructing block of [AVInstallation defaultInstallation].

Discussion

Handle device token registered from APNs, with a team ID. This method should be called in [UIApplication application:didRegisterForRemoteNotificationsWithDeviceToken:].

Declared In

AVOSCloud.h

AVDeprecated Methods

+ requestSmsCodeWithPhoneNumber:callback:

请求短信验证码,需要开启手机短信验证 API 选项。 发送短信到指定的手机上,发送短信到指定的手机上,获取6位数字验证码。

+ (void)requestSmsCodeWithPhoneNumber:(NSString *)phoneNumber callback:(AVBooleanResultBlock)callback

Parameters

phoneNumber

11位电话号码

callback

回调结果

Discussion

请求短信验证码,需要开启手机短信验证 API 选项。 发送短信到指定的手机上,发送短信到指定的手机上,获取6位数字验证码。

Declared In

AVOSCloud.h

+ requestSmsCodeWithPhoneNumber:appName:operation:timeToLive:callback:

请求短信验证码,需要开启手机短信验证 API 选项。 发送短信到指定的手机上,获取6位数字验证码。

+ (void)requestSmsCodeWithPhoneNumber:(NSString *)phoneNumber appName:(nullable NSString *)appName operation:(nullable NSString *)operation timeToLive:(NSUInteger)ttl callback:(AVBooleanResultBlock)callback

Parameters

phoneNumber

11位电话号码

appName

应用名称,传nil为默认值您的应用名称

operation

操作名称,传nil为默认值"短信认证"

ttl

短信过期时间,单位分钟,传0为默认值10分钟

callback

回调结果

Discussion

请求短信验证码,需要开启手机短信验证 API 选项。 发送短信到指定的手机上,获取6位数字验证码。

Declared In

AVOSCloud.h

+ requestSmsCodeWithPhoneNumber:templateName:variables:callback:

请求短信验证码,需要开启手机短信验证 API 选项。 发送短信到指定的手机上,获取6位数字验证码。

+ (void)requestSmsCodeWithPhoneNumber:(NSString *)phoneNumber templateName:(nullable NSString *)templateName variables:(nullable NSDictionary *)variables callback:(AVBooleanResultBlock)callback

Parameters

phoneNumber

11位电话号码

templateName

模板名称,传nil为默认模板

variables

模板中使用的变量

callback

回调结果

Discussion

请求短信验证码,需要开启手机短信验证 API 选项。 发送短信到指定的手机上,获取6位数字验证码。

Declared In

AVOSCloud.h

+ requestVoiceCodeWithPhoneNumber:IDD:callback:

请求语音短信验证码,需要开启手机短信验证 API 选项 发送语音短信到指定手机上

+ (void)requestVoiceCodeWithPhoneNumber:(NSString *)phoneNumber IDD:(nullable NSString *)IDD callback:(AVBooleanResultBlock)callback

Parameters

phoneNumber

11 位电话号码

IDD

号码的所在地国家代码,如果传 nil,默认为 “+86”

callback

回调结果

Discussion

请求语音短信验证码,需要开启手机短信验证 API 选项 发送语音短信到指定手机上

Declared In

AVOSCloud.h