LCApplication
Objective-C
@interface LCApplication : NSObject
// MARK: ID, Key and Server URL
/// Setup ID, Key and Server URL of the application.
/// @param applicationId The applicaiton id for your LeanCloud application.
/// @param clientKey The client key for your LeanCloud application.
/// @param serverURLString The server url for your LeanCloud application.
+ (void)setApplicationId:(nonnull NSString *)applicationId
clientKey:(nonnull NSString *)clientKey
serverURLString:(nonnull NSString *)serverURLString;
/*!
Sets the applicationId and clientKey of your application.
@param applicationId The applicaiton id for your LeanCloud application.
@param clientKey The client key for your LeanCloud application.
*/
+ (void)setApplicationId:(nonnull NSString *)applicationId
clientKey:(nonnull NSString *)clientKey;
/**
* get Application Id
*
* @return Application Id
*/
+ (NSString *)getApplicationId;
/**
* get Client Key
*
* @return Client Key
*/
+ (NSString *)getClientKey;
/**
Custom server URL for specific service module.
@param URLString The URL string of service module.
@param serviceModule The service module which you want to customize.
*/
+ (void)setServerURLString:(nullable NSString *)URLString
forServiceModule:(LCServiceModule)serviceModule;
// MARK: Last Modify
+ (void)setLastModifyEnabled:(BOOL)enabled;
+ (BOOL)getLastModifyEnabled;
+ (void)clearLastModifyCache;
// MARK: HTTP Request Timeout Interval
/**
* Get the timeout interval for network requests. Default is 60 seconds.
*
* @return timeout interval
*/
+ (NSTimeInterval)networkTimeoutInterval;
/**
* Set the timeout interval for network request.
*
* @param time timeout interval(seconds)
*/
+ (void)setNetworkTimeoutInterval:(NSTimeInterval)time;
// MARK: Log
/*!
* 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 LCLogger's methods to control which domains' log should be output.
*/
+ (void)setAllLogsEnabled:(BOOL)enabled;
/// Set log level.
/// @param level The level of log.
+ (void)setLogLevel:(LCLogLevel)level;
/// Get log level.
+ (LCLogLevel)logLevel;
// MARK: Schedule work
/**
* get the query cache expired days
*
* @return the query cache expired days
*/
+ (NSInteger)queryCacheExpiredDays;
/**
* set Query Cache Expired Days, default is 30 days
*
* @param days the days you want to set
*/
+ (void)setQueryCacheExpiredDays:(NSInteger)days;
/**
* get the file cache expired days
*
* @return the file cache expired days
*/
+ (NSInteger)fileCacheExpiredDays;
/**
* set File Cache Expired Days, default is 30 days
*
* @param days the days you want to set
*/
+ (void)setFileCacheExpiredDays:(NSInteger)days;
// MARK: SMS
+ (void)verifySmsCode:(NSString *)code
mobilePhoneNumber:(NSString *)phoneNumber
callback:(LCBooleanResultBlock)callback;
// MARK: Date
/// Get current server date synchronously.
/// @param error Pointer to `NSError *`.
+ (nullable NSDate *)getServerDate:(NSError **)error;
/// Get current server date synchronously.
/// @param error Pointer to `NSError *`.
+ (nullable NSDate *)getServerDateAndThrowsWithError:(NSError **)error;
/// Get current server date asynchronously.
/// @param block Result callback.
+ (void)getServerDateWithBlock:(void (^)(NSDate * _Nullable date, NSError * _Nullable error))block;
// MARK: Misc
+ (instancetype)defaultApplication;
+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
@property (nonatomic, readonly) NSString *identifier;
@property (nonatomic, readonly) NSString *key;
@property (nonatomic, readonly, nullable) NSString *serverURLString;
@property (nonatomic, copy, nullable) NSString *RTMServer;
- (void)setWithIdentifier:(NSString *)identifier key:(NSString *)key;
@end
Swift
class LCApplication : NSObject
Undocumented
-
Setup ID, Key and Server URL of the application.
Declaration
Objective-C
+ (void)setApplicationId:(nonnull NSString *)applicationId clientKey:(nonnull NSString *)clientKey serverURLString:(nonnull NSString *)serverURLString;Swift
class func setApplicationId(_ applicationId: String, clientKey: String, serverURLString: String)Parameters
applicationIdThe applicaiton id for your LeanCloud application.
clientKeyThe client key for your LeanCloud application.
serverURLStringThe server url for your LeanCloud application.
-
Undocumented
Declaration
Objective-C
+ (void)setApplicationId:(nonnull NSString *)applicationId clientKey:(nonnull NSString *)clientKey;Swift
class func setApplicationId(_ applicationId: String, clientKey: String) -
get Application Id
Declaration
Objective-C
+ (nonnull NSString *)getApplicationId;Swift
class func getId() -> StringReturn Value
Application Id
-
get Client Key
Declaration
Objective-C
+ (nonnull NSString *)getClientKey;Swift
class func getClientKey() -> StringReturn Value
Client Key
-
Custom server URL for specific service module.
Declaration
Objective-C
+ (void)setServerURLString:(nullable NSString *)URLString forServiceModule:(LCServiceModule)serviceModule;Swift
class func setServerURLString(_ URLString: String?, for serviceModule: LCServiceModule)Parameters
URLStringThe URL string of service module.
serviceModuleThe service module which you want to customize.
-
Undocumented
Declaration
Objective-C
+ (void)setLastModifyEnabled:(BOOL)enabled;Swift
class func setLastModifyEnabled(_ enabled: Bool) -
Undocumented
Declaration
Objective-C
+ (BOOL)getLastModifyEnabled;Swift
class func getLastModifyEnabled() -> Bool -
Undocumented
Declaration
Objective-C
+ (void)clearLastModifyCache;Swift
class func clearLastModifyCache() -
Get the timeout interval for network requests. Default is 60 seconds.
Declaration
Objective-C
+ (NSTimeInterval)networkTimeoutInterval;Swift
class func networkTimeoutInterval() -> TimeIntervalReturn Value
timeout interval
-
Set the timeout interval for network request.
Declaration
Objective-C
+ (void)setNetworkTimeoutInterval:(NSTimeInterval)time;Swift
class func setNetworkTimeoutInterval(_ time: TimeInterval)Parameters
timetimeout interval(seconds)
-
Undocumented
Declaration
Objective-C
+ (void)setAllLogsEnabled:(BOOL)enabled;Swift
class func setAllLogsEnabled(_ enabled: Bool) -
Set log level.
Declaration
Objective-C
+ (void)setLogLevel:(LCLogLevel)level;Swift
class func setLogLevel(_ level: LCLogLevel)Parameters
levelThe level of log.
-
Get log level.
-
get the query cache expired days
Declaration
Objective-C
+ (NSInteger)queryCacheExpiredDays;Swift
class func queryCacheExpiredDays() -> IntReturn Value
the query cache expired days
-
set Query Cache Expired Days, default is 30 days
Declaration
Objective-C
+ (void)setQueryCacheExpiredDays:(NSInteger)days;Swift
class func setQueryCacheExpiredDays(_ days: Int)Parameters
daysthe days you want to set
-
get the file cache expired days
Declaration
Objective-C
+ (NSInteger)fileCacheExpiredDays;Swift
class func fileCacheExpiredDays() -> IntReturn Value
the file cache expired days
-
set File Cache Expired Days, default is 30 days
Declaration
Objective-C
+ (void)setFileCacheExpiredDays:(NSInteger)days;Swift
class func setFileCacheExpiredDays(_ days: Int)Parameters
daysthe days you want to set
-
Undocumented
Declaration
Objective-C
+ (void)verifySmsCode:(NSString *)code mobilePhoneNumber:(NSString *)phoneNumber callback:(LCBooleanResultBlock)callback;Swift
class func verifySmsCode(_ code: String, mobilePhoneNumber phoneNumber: String, callback: @escaping LCBooleanResultBlock) -
Get current server date synchronously.
Declaration
Objective-C
+ (nullable NSDate *)getServerDate:(NSError *_Nullable *_Nullable)error;Swift
class func getServerDate() throws -> DateParameters
errorPointer to
NSError *. -
Get current server date synchronously.
Declaration
Objective-C
+ (nullable NSDate *)getServerDateAndThrowsWithError: (NSError *_Nullable *_Nullable)error;Swift
class func getServerDateAndThrows() throws -> DateParameters
errorPointer to
NSError *. -
Get current server date asynchronously.
Declaration
Objective-C
+ (void)getServerDateWithBlock:(nonnull void (^)(NSDate *_Nullable, NSError *_Nullable))block;Swift
class func serverDate() async throws -> DateParameters
blockResult callback.
-
Undocumented
Declaration
Objective-C
+ (instancetype)defaultApplication;Swift
class func `default`() -> Self -
Unavailable
Undocumented
Declaration
Objective-C
+ (instancetype)new NS_UNAVAILABLE; -
Unavailable
Undocumented
Declaration
Objective-C
- (instancetype)init NS_UNAVAILABLE; -
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSString *identifierSwift
var identifier: String { get } -
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly) NSString *keySwift
var key: String { get } -
Undocumented
Declaration
Objective-C
@property (nonatomic, readonly, nullable) NSString *serverURLStringSwift
var serverURLString: String? { get } -
Undocumented
Declaration
Objective-C
@property (nonatomic, copy, nullable) NSString *RTMServerSwift
var rtmServer: String? { get set } -
Undocumented
Declaration
Objective-C
- (void)setWithIdentifier:(NSString *)identifier key:(NSString *)key;Swift
func setWithIdentifier(_ identifier: String, key: String)
View on GitHub
Install in Dash
LCApplication Class Reference