Classes

The following classes are available globally.

  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCACL : NSObject <NSCopying>

    Swift

    class LCACL : NSObject, NSCopying
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCRole : LCObject

    Swift

    class LCRole : LCObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCCaptchaDigest : LCDynamicObject
    
    /**
     A nonce used to verify captcha.
     */
    @property (nonatomic, copy, readonly) NSString *nonce;
    
    /**
     URL string of captcha image.
     */
    @property (nonatomic, copy, readonly) NSString *URLString;
    
    @end

    Swift

    class LCCaptchaDigest : LCDynamicObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCCaptchaRequestOptions : LCDynamicObject
    
    /**
     Width of captcha image, in pixels.
    
     Defaults to 85. Minimum is 85, maximum is 200.
     */
    @property (nonatomic, assign) NSInteger width;
    
    /**
     Height of captcha image, in pixels.
    
     Defaults to 30. Minimum is 30, maximum is 100.
     */
    @property (nonatomic, assign) NSInteger height;
    
    @end

    Swift

    class LCCaptchaRequestOptions : LCDynamicObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCCaptcha : NSObject
    
    /**
     Request a captcha.
    
     This method get a captcha digest from server.
     You can use the captcha digest to verify a captcha code that recognized by user.
    
     @param options  The options that configure the captcha.
     @param callback The callback of request.
     */
    + (void)requestCaptchaWithOptions:(nullable LCCaptchaRequestOptions *)options
                             callback:(LCCaptchaRequestCallback)callback;
    
    /**
     Verify a captcha code for captcha digest that you've requested before.
    
     @param captchaCode   The symbols user recognized from captcha image.
     @param captchaDigest The captcha digest that you've requested before.
     @param callback      The callback of request.
     */
    + (void)verifyCaptchaCode:(NSString *)captchaCode
             forCaptchaDigest:(LCCaptchaDigest *)captchaDigest
                     callback:(LCCaptchaVerificationCallback)callback;
    
    @end

    Swift

    class LCCaptcha : NSObject
  • Call the cloud code from client

    See more

    Declaration

    Objective-C

    @interface LCCloud : NSObject

    Swift

    class LCCloud : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCFile : NSObject <NSCoding>

    Swift

    class LCFile : NSObject, NSCoding
  • LCFile 查询类

    See more

    Declaration

    Objective-C

    @interface LCFileQuery : LCQuery

    Swift

    class LCFileQuery : LCQuery
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCGeoPoint : NSObject <NSCopying>

    Swift

    class LCGeoPoint : NSObject, NSCopying
  • Undocumented

    See more

    Declaration

    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

    See more

    Declaration

    Objective-C

    @interface LCLeaderboardStatistic : NSObject
    
    /// The name of the leaderboard.
    @property (nonatomic, readonly, nullable) NSString *name;
    /// The version of the leaderboard.
    @property (nonatomic, readonly) NSInteger version;
    /// The value of this statistic.
    @property (nonatomic, readonly) double value;
    /// If this statistic belongs to one user, this property is nonnull.
    @property (nonatomic, readonly, nullable) LCUser *user;
    /// If this statistic belongs to one object, this property is nonnull.
    @property (nonatomic, readonly, nullable) LCObject *object;
    /// If this statistic belongs to one entity, this property is nonnull.
    @property (nonatomic, readonly, nullable) NSString *entity;
    
    @end

    Swift

    class LCLeaderboardStatistic : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCLeaderboardRanking : NSObject
    
    /// The name of the leaderboard.
    @property (nonatomic, readonly, nullable) NSString *statisticName;
    /// The ranking on the leaderboard.
    @property (nonatomic, readonly) NSInteger rank;
    /// The value of the statistic.
    @property (nonatomic, readonly) double value;
    /// The statistics on the other leaderboards.
    @property (nonatomic, readonly, nullable) NSArray<LCLeaderboardStatistic *> *includedStatistics;
    /// If this ranking belongs to one user, this property is nonnull.
    @property (nonatomic, readonly, nullable) LCUser *user;
    /// If this ranking belongs to one object, this property is nonnull.
    @property (nonatomic, readonly, nullable) LCObject *object;
    /// If this ranking belongs to one entity, this property is nonnull.
    @property (nonatomic, readonly, nullable) NSString *entity;
    
    @end

    Swift

    class LCLeaderboardRanking : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCLeaderboardQueryOption : NSObject
    
    /// Select which key-value will be returned.
    @property (nonatomic, nullable) NSArray<NSString *> *selectKeys;
    /// Select which pointer's all value will be returned.
    @property (nonatomic, nullable) NSArray<NSString *> *includeKeys;
    
    @end

    Swift

    class LCLeaderboardQueryOption : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCLeaderboard : NSObject
    
    /// The name of this leaderboard.
    @property (nonatomic, readonly) NSString *statisticName;
    /// The start positon of the query, default is `0`.
    @property (nonatomic) NSInteger skip;
    /// The max results count of the query, default is `20`.
    @property (nonatomic) NSInteger limit;
    /// The statistics of the other leaderboards will be returned, default is `nil`.
    @property (nonatomic, nullable) NSArray<NSString *> *includeStatistics;
    /// The version of the leaderboard, default is `0`.
    @property (nonatomic) NSInteger version;
    /// Whether to return the count of this leaderboard, default is `false`.
    @property (nonatomic) BOOL returnCount;
    
    + (instancetype)new NS_UNAVAILABLE;
    - (instancetype)init NS_UNAVAILABLE;
    
    /// Initializing with a name.
    /// @param statisticName The name of the leaderboard.
    - (instancetype)initWithStatisticName:(NSString *)statisticName;
    
    // MARK: Update & Delete Statistics
    
    /// Update the statistics of the current user.
    /// @param statistics The statistics of the current user.
    /// @param callback Result callback.
    + (void)updateCurrentUserStatistics:(NSDictionary *)statistics
                               callback:(void (^)(NSArray<LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback;
    
    /// Delete the statistics of the current user on the leaderboards.
    /// @param statisticNames The name of the leaderboards.
    /// @param callback Result callback.
    + (void)deleteCurrentUserStatistics:(NSArray<NSString *> *)statisticNames
                               callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    // MARK: Get One Statistics
    
    /// Get the statistics of the user on the leaderboards.
    /// @param userId The object id of the user.
    /// @param statisticNames The name of the leaderboards.
    /// @param callback Result callback.
    + (void)getStatisticsWithUserId:(NSString *)userId
                     statisticNames:(NSArray<NSString *> * _Nullable)statisticNames
                           callback:(void (^)(NSArray<LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback;
    
    /// Get the statistics of the object on the leaderboards.
    /// @param objectId The object id of the object.
    /// @param statisticNames The name of the leaderboards.
    /// @param option The query option.
    /// @param callback Result callback.
    + (void)getStatisticsWithObjectId:(NSString *)objectId
                       statisticNames:(NSArray<NSString *> * _Nullable)statisticNames
                               option:(LCLeaderboardQueryOption * _Nullable)option
                             callback:(void (^)(NSArray<LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback;
    
    /// Get the statistics of the entity on the leaderboards.
    /// @param entity The string of the entity.
    /// @param statisticNames The name of the leaderboards.
    /// @param callback Result callback.
    + (void)getStatisticsWithEntity:(NSString *)entity
                     statisticNames:(NSArray<NSString *> * _Nullable)statisticNames
                           callback:(void (^)(NSArray<LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback;
    
    // MARK: Get Group Statistics
    
    /// Get the statistics of one group users on this leaderboard.
    /// @param userIds The object id array of the users.
    /// @param callback Result callback.
    - (void)getStatisticsWithUserIds:(NSArray<NSString *> *)userIds
                            callback:(void (^)(NSArray<LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback;
    
    /// Get the statistics of one group objects on this leaderboard.
    /// @param objectIds The object id array of the objects.
    /// @param option The query option.
    /// @param callback Result callback.
    - (void)getStatisticsWithObjectIds:(NSArray<NSString *> *)objectIds
                                option:(LCLeaderboardQueryOption * _Nullable)option
                              callback:(void (^)(NSArray<LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback;
    
    /// Get the statistics of one group entities on this leaderboard.
    /// @param entities The string array of the entities.
    /// @param callback Result callback.
    - (void)getStatisticsWithEntities:(NSArray<NSString *> *)entities
                             callback:(void (^)(NSArray<LCLeaderboardStatistic *> * _Nullable statistics, NSError * _Nullable error))callback;
    
    // MARK: Get Rankings
    
    /// Get rankings of the user on this leaderboard from top.
    /// @param option The query option.
    /// @param callback Result callback.
    - (void)getUserResultsWithOption:(LCLeaderboardQueryOption * _Nullable)option
                            callback:(void (^)(NSArray<LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback;
    
    /// Get rankings around one user on this leaderboard.
    /// @param userId The object id of the user.
    /// @param option The query option.
    /// @param callback Result callback.
    - (void)getUserResultsAroundUser:(NSString * _Nullable)userId
                              option:(LCLeaderboardQueryOption * _Nullable)option
                            callback:(void (^)(NSArray<LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback;
    
    /// Get rankings of the object on this leaderboard from top.
    /// @param option The query option.
    /// @param callback Result callback.
    - (void)getObjectResultsWithOption:(LCLeaderboardQueryOption * _Nullable)option
                              callback:(void (^)(NSArray<LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback;
    
    /// Get rankings around one object on this leaderboard.
    /// @param objectId The object id of the object.
    /// @param option The query option.
    /// @param callback Result callback.
    - (void)getObjectResultsAroundObject:(NSString * _Nullable)objectId
                                  option:(LCLeaderboardQueryOption * _Nullable)option
                                callback:(void (^)(NSArray<LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback;
    
    /// Get rankings of the entity on this leaderboard from top.
    /// @param callback Result callback.
    - (void)getEntityResultsWithCallback:(void (^)(NSArray<LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback;
    
    /// Get rankings around one entity on this leaderboard.
    /// @param entity The string of the entity.
    /// @param callback Result callback.
    - (void)getEntityResultsAroundEntity:(NSString * _Nullable)entity
                                callback:(void (^)(NSArray<LCLeaderboardRanking *> * _Nullable rankings, NSInteger count, NSError * _Nullable error))callback;
    
    @end

    Swift

    class LCLeaderboard : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCObject : NSObject <NSCoding>

    Swift

    class LCObject : NSObject, NSCoding
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCRelation : NSObject

    Swift

    class LCRelation : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCSaveOption : NSObject
    
    @property (nonatomic, assign) BOOL fetchWhenSave;
    @property (nonatomic, strong, nullable) LCQuery *query;
    
    @end

    Swift

    class LCSaveOption : NSObject
  • LeanCloud installation type.

    See more

    Declaration

    Objective-C

    @interface LCInstallation : LCObject

    Swift

    class LCInstallation : LCObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCPush : NSObject

    Swift

    class LCPush : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCCloudQueryResult : NSObject
    /**
     *  查询结果的 className
     */
    @property(nonatomic, copy, readonly) NSString *className;
    
    /**
     *  查询的结果 LCObject 对象列表
     */
    @property(nonatomic, strong, readonly) NSArray *results;
    
    /**
     *  查询 count 结果, 只有使用 select count(*) ... 时有效
     */
    @property(nonatomic, assign, readonly) NSUInteger count;
    
    @end

    Swift

    class LCCloudQueryResult : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCQuery : NSObject

    Swift

    class LCQuery : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCPaasClient : NSObject
    
    @property (nonatomic) LCApplication *application;
    @property (nonatomic, readonly, copy) NSString *apiVersion;
    @property (nonatomic) LCUser *currentUser;
    @property (nonatomic) LCACL *defaultACL;
    @property (nonatomic) BOOL currentUserAccessForDefaultACL;
    @property (nonatomic) NSTimeInterval timeoutInterval;
    @property (nonatomic) NSMutableDictionary *subclassTable;
    @property (nonatomic) BOOL productionMode;
    @property (nonatomic) BOOL isLastModifyEnabled;
    @property (nonatomic) NSLock *lock;
    @property (nonatomic) NSMapTable *requestTable;
    @property (nonatomic) LCURLSessionManager *sessionManager;
    @property (nonatomic) dispatch_queue_t completionQueue;
    @property (nonatomic) NSMutableSet *runningArchivedRequests;
    @property (atomic) NSMutableDictionary *lastModify;
    
    + (LCPaasClient *)sharedInstance;
    
    -(void)clearLastModifyCache;
    
    - (LCACL *)updatedDefaultACL;
    
    +(NSMutableDictionary *)batchMethod:(NSString *)method
                                   path:(NSString *)path
                                   body:(NSDictionary *)body
                             parameters:(NSDictionary *)parameters;
    
    +(void)updateBatchMethod:(NSString *)method
                        path:(NSString *)path
                        dict:(NSMutableDictionary *)dict;
    
    - (void)getObject:(NSString *)path
       withParameters:(NSDictionary *)parameters
                block:(LCIdResultBlock)block;
    
    - (void)getObject:(NSString *)path
       withParameters:(NSDictionary *)parameters
               policy:(LCCachePolicy)policy
          maxCacheAge:(NSTimeInterval)maxCacheAge
                block:(LCIdResultBlock)block;
    
    -(void)putObject:(NSString *)path
      withParameters:(NSDictionary *)parameters
        sessionToken:(NSString *)sessionToken
               block:(LCIdResultBlock)block;
    
    -(void)postBatchObject:(NSArray *)parameterArray block:(LCArrayResultBlock)block;
    -(void)postBatchObject:(NSArray *)parameterArray headerMap:(NSDictionary *)headerMap eventually:(BOOL)isEventually block:(LCArrayResultBlock)block;
    
    -(void)postBatchSaveObject:(NSArray *)parameterArray headerMap:(NSDictionary *)headerMap eventually:(BOOL)isEventually block:(LCIdResultBlock)block;
    
    - (void)postObject:(NSString *)path withParameters:(id)parameters block:(LCIdResultBlock)block;
    - (void)postObject:(NSString *)path withParameters:(id)parameters eventually:(BOOL)isEventually block:(LCIdResultBlock)block;
    
    -(void)deleteObject:(NSString *)path
         withParameters:(NSDictionary *)parameters
                  block:(LCIdResultBlock)block;
    
    - (void)deleteObject:(NSString *)path
          withParameters:(NSDictionary *)parameters
              eventually:(BOOL)isEventually
                   block:(LCIdResultBlock)block;
    
    - (NSString *)absoluteStringFromPath:(NSString *)path parameters:(NSDictionary *)parameters;
    
    -(BOOL)addSubclassMapEntry:(NSString *)parseClassName
                   classObject:(Class)object;
    -(Class)classFor:(NSString *)parseClassName;
    
    // offline
    // TODO: never called this yet!
    - (void)handleAllArchivedRequests;
    
    #pragma mark - Network Utils
    
    /*!
     * Get signature header field value.
     */
    - (NSString *)signatureHeaderFieldValue;
    
    - (NSMutableURLRequest *)requestWithPath:(NSString *)path
                                      method:(NSString *)method
                                     headers:(NSDictionary *)headers
                                  parameters:(id)parameters;
    
    - (void)performRequest:(NSURLRequest *)request
                   success:(void (^)(NSHTTPURLResponse *response, id responseObject))successBlock
                   failure:(void (^)(NSHTTPURLResponse *response, id responseObject, NSError *error))failureBlock;
    
    - (void)performRequest:(NSURLRequest *)request
                   success:(void (^)(NSHTTPURLResponse *response, id responseObject))successBlock
                   failure:(void (^)(NSHTTPURLResponse *response, id responseObject, NSError *error))failureBlock
                      wait:(BOOL)wait;
    
    @end

    Swift

    class LCPaasClient : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCShortMessageRequestOptions : LCDynamicObject
    
    /**
     Time to live of validation information, in minutes. Defaults to 10 minutes.
     */
    @property (nonatomic, assign) NSInteger TTL;
    
    /**
     The representation or form of short message.
     */
    @property (nonatomic, assign) LCShortMessageType type;
    
    /**
     Token used to validate short message request.
     */
    @property (nonatomic, copy, nullable) NSString *validationToken;
    
    /**
     Template name of text short message.
    
     @note If not specified, the default validation message will be requested.
     */
    @property (nonatomic, copy, nullable) NSString *templateName;
    
    /**
     A set of key value pairs that will fill in template placeholders.
    
     @note You should not use the placeholders listed here in your template:
     `mobilePhoneNumber`, `ttl`, `smsType`, `template` and `sign`.
     */
    @property (nonatomic, strong, nullable) NSDictionary *templateVariables;
    
    /**
     Signature name of text short message.
    
     It will be placed ahead of text short message.
     */
    @property (nonatomic, copy, nullable) NSString *signatureName;
    
    /**
     Application name showed in validation message.
    
     It fills the placeholder <code>{{name}}</code> in default validation message template.
     If not given, the application name in LeanCloud console will be used.
     */
    @property (nonatomic, copy, nullable) NSString *applicationName;
    
    /**
     The operation description showed in validation message.
    
     It fills the placeholder <code>{{op}}</code> in default validation message template.
     */
    @property (nonatomic, copy, nullable) NSString *operation;
    
    @end

    Swift

    class LCShortMessageRequestOptions : LCDynamicObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCSMS : NSObject
    
    /**
     Request a short message for a phone number.
    
     @param phoneNumber The phone number which the short message will sent to.
     @param options     The options that configure short message.
     @param callback    The callback of request.
     */
    + (void)requestShortMessageForPhoneNumber:(NSString *)phoneNumber
                                      options:(nullable LCShortMessageRequestOptions *)options
                                     callback:(LCBooleanResultBlock)callback;
    
    @end

    Swift

    class LCSMS : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCSearchQuery : NSObject
    
    /*!
     *  使用 queryString 构造一个 LCSearchQuery 对象
     *  @return LCSearchQuery 实例
     */
    + (instancetype)searchWithQueryString:(NSString *)queryString;
    
    /*!
     *  查询的 className,默认为 nil,即包括所有启用了应用内搜索的 Class
     */
    @property (nonatomic, copy, nullable) NSString *className;
    
    /*!
     The number of objects to skip before returning any.
     */
    @property (nonatomic, assign) NSInteger skip;
    
    /*!
     *  返回集合大小上限,默认值为100,最大为1000
     */
    @property (nonatomic, assign) NSInteger limit;
    
    /*!
     * 查询字符串,具体语法参考 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html#query-string-syntax
     */
    @property (nonatomic, copy, nullable) NSString *queryString;
    
    /*!
     *  查询的LCSearchSortBuilder,使用更丰富的排序选项
     */
    @property (nonatomic, strong, nullable) LCSearchSortBuilder *sortBuilder;
    
    /*!
     *  符合查询条件的记录条数
     */
    @property (nonatomic, assign, readonly) NSInteger hits;
    
    /*!
     *  当前页面的scroll id,用于分页,可选。
     #  @warning 如非特殊需求,请不要手动设置 sid。每次 findObjects 之后,SDK 会自动更新 sid。如果手动设置了错误的sid,将无法获取到搜索结果。
     *  有关scroll id,可以参考 http://www.elasticsearch.org/guide/en/elasticsearch/guide/current/scan-scroll.html
     */
    @property (nonatomic, copy, nullable) NSString *sid;
    
    /*!
     *  查询的字段列表,可选。
     */
    @property (nonatomic, strong, nullable) NSArray *fields;
    
    /*!
     *  返回结果的高亮语法,默认为 "*"
     *  语法规则可以参考 http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/search-request-highlighting.html#highlighting-settings
     */
    @property (nonatomic, copy, nullable) NSString *highlights;
    
    /*!
     * 缓存策略
     */
    @property (readwrite, assign) LCCachePolicy cachePolicy;
    
    /* !
     * 最多缓存时间,单位为秒,默认值 24*3600 秒
     */
    @property (readwrite, assign) NSTimeInterval maxCacheAge;
    
    /*!
     Make the query include LCObjects that have a reference stored at the provided key.
     This has an effect similar to a join.  You can use dot notation to specify which fields in
     the included object are also fetch.
    
     @param key The key to load child LCObjects for.
     */
    - (void)includeKey:(NSString *)key;
    
    #pragma mark - Find methods
    
    /*!
     *  根据查询条件获取结果对象
     *  @return LCObjects 数组
     */
    - (nullable NSArray *)findObjects;
    
    /*!
     *  根据查询条件获取结果对象,如果有 error,则设置一个 error
     *  @param error 指针
     *  @return LCObjects 数组
     */
    - (nullable NSArray *)findObjects:(NSError **)error;
    
    /*!
     An alias of `-[LCSearchQuery findObjects:]` methods that supports Swift exception.
     @seealso `-[LCSearchQuery findObjects:]`
     */
    - (nullable NSArray *)findObjectsAndThrowsWithError:(NSError **)error;
    
    /*!
     *  异步获取搜索结果,并回调block
     *  @param block 需要有这样的方法签名 (NSArray *objects, NSError *error)
     */
    - (void)findInBackground:(LCArrayResultBlock)block;
    
    #pragma mark - Sorting
    /*!
     搜索结果会根据关键字,按升序排序
     @param key 排序关键字
     */
    - (void)orderByAscending:(NSString *)key;
    
    /*!
     添加一个升序排序关键字。排序优先级由添加关键字的前后顺序决定。
     @param key 排序关键字
     */
    - (void)addAscendingOrder:(NSString *)key;
    
    /*!
     搜索结果会根据关键字,按降序排序
     @param key 排序关键字
     */
    - (void)orderByDescending:(NSString *)key;
    
    /*!
     添加一个降序排序关键字。关键字的排序优先级由添加关键字的前后顺序决定。
     @param key 排序关键字
     */
    - (void)addDescendingOrder:(NSString *)key;
    
    /*!
     根据 NSSortDescriptor 排序搜索结果
     @param sortDescriptor 排序描述符
     */
    - (void)orderBySortDescriptor:(NSSortDescriptor *)sortDescriptor;
    
    /*!
     根据 NSSortDescriptor 数组排序搜索结果
     @param sortDescriptors NSSortDescriptor 数组
     */
    - (void)orderBySortDescriptors:(NSArray *)sortDescriptors;
    
    @end

    Swift

    class LCSearchQuery : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCSearchSortBuilder : NSObject

    Swift

    class LCSearchSortBuilder : NSObject
  • 发送和获取状态更新和消息

    See more

    Declaration

    Objective-C

    @interface LCStatus : NSObject

    Swift

    class LCStatus : NSObject
  • 查询LCStatus

    See more

    Declaration

    Objective-C

    @interface LCStatusQuery : LCQuery

    Swift

    class LCStatusQuery : LCQuery
  • The request of becoming friends.

    See more

    Declaration

    Objective-C

    @interface LCFriendshipRequest : LCObject

    Swift

    class LCFriendshipRequest : LCObject
  • Friendship.

    See more

    Declaration

    Objective-C

    @interface LCFriendship : NSObject

    Swift

    class LCFriendship : NSObject
  • The options for the request of the short message.

    See more

    Declaration

    Objective-C

    @interface LCUserShortMessageRequestOptions : NSObject

    Swift

    class LCUserShortMessageRequestOptions : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCUserAuthDataLoginOption : NSObject
    
    /**
     Third platform.
     */
    @property (nonatomic, nullable) LeanCloudSocialPlatform platform;
    
    /**
     UnionId from the third platform.
     */
    @property (nonatomic, nullable) NSString *unionId;
    
    /**
     Set true to generate a platform-unionId signature.
     if a LCUser instance has a platform-unionId signature, then the platform and the unionId will be the highest priority in auth data matching.
     @Note must cooperate with platform & unionId.
     */
    @property (nonatomic) BOOL isMainAccount;
    
    /**
     Set true to check whether already exists a LCUser instance with the auth data.
     if not exists, return an error.
     */
    @property (nonatomic) BOOL failOnNotExist;
    
    @end

    Swift

    class LCUserAuthDataLoginOption : NSObject
  • User

    See more

    Declaration

    Objective-C

    @interface LCUser : LCObject <LCSubclassing>

    Swift

    class LCUser : LCObject, LCSubclassing
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCDynamicObject : NSObject
    
    - (nullable id)objectForKeyedSubscript:(NSString *)key;
    
    - (void)setObject:(nullable id)object forKeyedSubscript:(NSString *)key;
    
    @end

    Swift

    class LCDynamicObject : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCLogger : NSObject
    + (void)setAllLogsEnabled:(BOOL)enabled;
    + (void)setLoggerLevelMask:(NSUInteger)levelMask;
    + (void)addLoggerDomain:(NSString *)domain;
    + (void)removeLoggerDomain:(NSString *)domain;
    + (void)logFunc:(const char *)func line:(const int)line domain:(nullable NSString *)domain level:(LCLoggerLevel)level message:(NSString *)fmt, ... NS_FORMAT_FUNCTION(5, 6);
    + (BOOL)levelEnabled:(LCLoggerLevel)level;
    + (BOOL)containDomain:(NSString *)domain;
    @end

    Swift

    class LCLogger : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCUtils : NSObject
    
    // MARK: JSON String
    
    + (NSString * _Nullable)jsonStringFromDictionary:(NSDictionary *)dictionary;
    + (NSString * _Nullable)jsonStringFromArray:(NSArray *)array;
    + (NSString * _Nullable)jsonStringFromJSONObject:(id)JSONObject;
    
    // MARK: Call Block
    
    + (void)callBooleanResultBlock:(LCBooleanResultBlock)block error:(NSError * _Nullable)error;
    + (void)callIntegerResultBlock:(LCIntegerResultBlock)block number:(NSInteger)number error:(NSError * _Nullable)error;
    + (void)callStringResultBlock:(LCStringResultBlock)block string:(NSString * _Nullable)string error:(NSError * _Nullable)error;
    + (void)callDataResultBlock:(LCDataResultBlock)block data:(NSData * _Nullable)data error:(NSError * _Nullable)error;
    + (void)callArrayResultBlock:(LCArrayResultBlock)block array:(NSArray * _Nullable)array error:(NSError * _Nullable)error;
    + (void)callSetResultBlock:(LCSetResultBlock)block set:(NSSet * _Nullable)set error:(NSError * _Nullable)error;
    + (void)callDictionaryResultBlock:(LCDictionaryResultBlock)block dictionary:(NSDictionary * _Nullable)dictionary error:(NSError * _Nullable)error;
    + (void)callIdResultBlock:(LCIdResultBlock)block object:(id _Nullable)object error:(NSError * _Nullable)error;
    + (void)callProgressBlock:(LCProgressBlock)block percent:(NSInteger)percent;
    + (void)callObjectResultBlock:(LCObjectResultBlock)block object:(LCObject * _Nullable)object error:(NSError * _Nullable)error;
    + (void)callUserResultBlock:(LCUserResultBlock)block user:(LCUser * _Nullable)user error:(NSError * _Nullable)error;
    + (void)callFileResultBlock:(LCFileResultBlock)block file:(LCFile * _Nullable)file error:(NSError * _Nullable)error;
    + (void)callCloudQueryCallback:(LCCloudQueryCallback)block result:(LCCloudQueryResult * _Nullable)result error:(NSError * _Nullable)error;
    
    @end

    Swift

    class LCUtils : NSObject
  • The option of conversation creation.

    See more

    Declaration

    Objective-C

    @interface LCIMConversationCreationOption : NSObject

    Swift

    class LCIMConversationCreationOption : NSObject
  • IM Client.

    See more

    Declaration

    Objective-C

    @interface LCIMClient : NSObject

    Swift

    class LCIMClient : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMMessageIntervalBound : NSObject
    
    @property (nonatomic, copy, nullable) NSString *messageId;
    @property (nonatomic, assign) int64_t timestamp;
    @property (nonatomic, assign) BOOL closed;
    
    - (instancetype)initWithMessageId:(nullable NSString *)messageId
                            timestamp:(int64_t)timestamp
                               closed:(BOOL)closed;
    
    @end

    Swift

    class LCIMMessageIntervalBound : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMMessageInterval : NSObject
    
    @property (nonatomic, strong) LCIMMessageIntervalBound *startIntervalBound;
    @property (nonatomic, strong, nullable) LCIMMessageIntervalBound *endIntervalBound;
    
    - (instancetype)initWithStartIntervalBound:(LCIMMessageIntervalBound *)startIntervalBound
                              endIntervalBound:(nullable LCIMMessageIntervalBound *)endIntervalBound;
    
    @end

    Swift

    class LCIMMessageInterval : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMOperationFailure : NSObject
    
    @property (nonatomic, assign) NSInteger code;
    @property (nonatomic, strong, nullable) NSString *reason;
    @property (nonatomic, strong, nullable) NSArray<NSString *> *clientIds;
    
    @end

    Swift

    class LCIMOperationFailure : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMConversation : NSObject
    
    /**
     *  The ID of the client which the conversation belongs to.
     */
    @property (nonatomic, strong, readonly, nullable) NSString *clientId;
    
    /**
     *  The ID of the conversation.
     */
    @property (nonatomic, strong, readonly, nullable) NSString *conversationId;
    
    /**
     *  The clientId of the conversation creator.
     */
    @property (nonatomic, strong, readonly, nullable) NSString *creator;
    
    /// The creation time of the conversation.
    @property (nonatomic, strong, readonly, nullable) NSDate *createdAt;
    
    /// The last updating time of the conversation. When fields like name, members changes, this time will changes.
    @property (nonatomic, strong, readonly, nullable) NSDate *updatedAt;
    
    /**
     *  The last message in this conversation.
     *  @attention Getter method may query lastMessage from SQL, this may take a long time, be careful to use getter method in main thread.
     */
    @property (nonatomic, strong, readonly, nullable) LCIMMessage *lastMessage;
    
    /**
     *  The send timestamp of the last message in this conversation.
     */
    @property (nonatomic, strong, readonly, nullable) NSDate *lastMessageAt;
    
    /**
     *  The last timestamp your message read by other.
     */
    @property (nonatomic, strong, readonly, nullable) NSDate *lastReadAt;
    
    /**
     *  The last timestamp your message delivered to other.
     */
    @property (nonatomic, strong, readonly, nullable) NSDate *lastDeliveredAt;
    
    /**
     *  The count of unread messages in current conversation.
     */
    @property (nonatomic, assign, readonly) NSUInteger unreadMessagesCount;
    
    /**
     *  A flag indicates whether an unread message mentioned you.
     */
    @property (nonatomic, assign) BOOL unreadMessagesMentioned;
    
    /**
     *  The name of this conversation. Can be changed by update:callback: .
     */
    @property (nonatomic, strong, readonly, nullable) NSString *name;
    
    /**
     *  The ids of the clients who join the conversation. Can be changed by addMembersWithClientIds:callback: or removeMembersWithClientIds:callback: .
     */
    @property (nonatomic, strong, readonly, nullable) NSArray<NSString *> *members;
    
    /**
     *  The attributes of the conversation. Intend to save any extra data of the conversation.
     *  Can be set when creating the conversation or can be updated by update:callback: .
     */
    @property (nonatomic, strong, readonly, nullable) NSDictionary *attributes;
    
    /**
     Unique ID of Unique Conversation.
     */
    @property (nonatomic, strong, readonly, nullable) NSString *uniqueId;
    
    /**
     Indicate whether it is a unique conversation.
     */
    @property (nonatomic, assign, readonly) BOOL unique;
    
    /**
     *  Indicate whether it is a transient conversation. 
     *  @see LCIMConversationOptionTransient
     */
    @property (nonatomic, assign, readonly) BOOL transient;
    
    /**
     Indicate whether it is a system conversation.
     */
    @property (nonatomic, assign, readonly) BOOL system;
    
    /**
     Indicate whether it is a temporary conversation.
     */
    @property (nonatomic, assign, readonly) BOOL temporary;
    
    /**
     Temporary Conversation's Time to Live.
     */
    @property (nonatomic, assign, readonly) NSUInteger temporaryTTL;
    
    /**
     *  Muting status. If muted, when you have offline messages, will not receive Apple APNS notification.
     *  Can be changed by muteWithCallback: or unmuteWithCallback:.
     */
    @property (nonatomic, assign, readonly) BOOL muted;
    
    /**
     *  The LCIMClient object which this conversation belongs to.
     */
    @property (nonatomic, weak, readonly, nullable) LCIMClient *imClient;
    
    + (instancetype)new NS_UNAVAILABLE;
    - (instancetype)init NS_UNAVAILABLE;
    
    /**
     * Add custom property for conversation.
     *
     * @param object The property value.
     * @param key    The property name.
     */
    - (void)setObject:(id _Nullable)object forKey:(NSString *)key;
    
    /**
     * Support to use subscript to set custom property.
     *
     * @see -[LCIMConversation setObject:forKey:]
     */
    - (void)setObject:(id _Nullable)object forKeyedSubscript:(NSString *)key;
    
    /*!
     * Get custom property value for conversation.
     *
     * @param key The custom property name.
     *
     * @return The custom property value.
     */
    - (id _Nullable)objectForKey:(NSString *)key;
    
    /**
     * Support to use subscript to set custom property.
     *
     * @see -[LCIMConversation objectForKey:]
     */
    - (id _Nullable)objectForKeyedSubscript:(NSString *)key;
    
    /*!
     Creates an LCIMKeyedConversation object for serialization.
     @return LCIMKeyedConversation object.
     */
    - (LCIMKeyedConversation * _Nullable)keyedConversation;
    
    // MARK: - RCP Timestamps & Read
    
    /*!
     Fetches last receipt timestamps of the message.
     */
    - (void)fetchReceiptTimestampsInBackground;
    
    /*!
     Marks the latest message sent by other members as read.
     The message sender will receives a read notification.
     */
    - (void)readInBackground;
    
    // MARK: - Conversation Update
    
    /*!
     Fetches latest data from the cloud.
     @param callback - A callback on results.
     */
    - (void)fetchWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Sends updates to the cloud.
     @param callback - A callback on results.
     */
    - (void)updateWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    // MARK: - Conversation Mute
    
    /*!
     Turns off the offline notifications of this conversation.
     @param callback - A callback on results.
     */
    - (void)muteWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Turns on the offline notifications of this conversation. 
     @param callback - A callback on results.
     */
    - (void)unmuteWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    // MARK: - Members
    
    /*!
     Joins this conversation.
     @param callback - A callback on results. 
     */
    - (void)joinWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Quits from this conversation.
     @param callback - A callback on results.
     */
    - (void)quitWithCallback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Adds members to this conversation.
     @param clientIds - Member list.
     @param callback - A callback on results.
     */
    - (void)addMembersWithClientIds:(NSArray<NSString *> *)clientIds
                           callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Removes members from this conversation.
     @param clientIds - Member list.
     @param callback - A callback on results. 
     */
    - (void)removeMembersWithClientIds:(NSArray<NSString *> *)clientIds
                              callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Counts the members of this conversation.
     @param callback - A callback on results.
     */
    - (void)countMembersWithCallback:(void (^)(NSInteger count, NSError * _Nullable error))callback;
    
    // MARK: - Message Send
    
    /*!
     Sends a message to this conversation.
     @param message - The message to send.
     @param callback - A callback on results.
     */
    - (void)sendMessage:(LCIMMessage *)message
               callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Sends a message to this conversation. 
     @param message - The message to send.
     @param option - Message sending options.
     @param callback - A callback on results.
     */
    - (void)sendMessage:(LCIMMessage *)message
                 option:(LCIMMessageOption * _Nullable)option
               callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Sends a message to this conversation.
     @param message - The message to send. 
     @param progressBlock - A callback on uploading progress. This is only applicable to uploading files. This callback will not be invoked when sending a text message.
     @param callback - A callback on results.
     */
    - (void)sendMessage:(LCIMMessage *)message
          progressBlock:(void (^ _Nullable)(NSInteger progress))progressBlock
               callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Sends a message to this conversation. 
     @param message - The message to send. 
     @param option - Message sending options. 
     @param progressBlock - A callback on uploading progress. This is only applicable to uploading files. This callback will not be invoked when sending a text message. 
     @param callback - A callback on results. 
     */
    - (void)sendMessage:(LCIMMessage *)message
                 option:(nullable LCIMMessageOption *)option
          progressBlock:(void (^ _Nullable)(NSInteger progress))progressBlock
               callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    // MARK: - Message Update
    
    /*!
     Replace a message you sent with a new message.
    
     @param oldMessage The message you've sent which will be replaced by newMessage.
     @param newMessage A new message.
     @param callback   Callback of message update.
     */
    - (void)updateMessage:(LCIMMessage *)oldMessage
             toNewMessage:(LCIMMessage *)newMessage
                 callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    /*!
     Recall a message.
    
     @param oldMessage The message you've sent which will be replaced by newMessage.
     @param callback   Callback of message update.
     */
    - (void)recallMessage:(LCIMMessage *)oldMessage
                 callback:(void (^)(BOOL succeeded, NSError * _Nullable error, LCIMRecalledMessage * _Nullable recalledMessage))callback;
    
    // MARK: - Message Cache
    
    /*!
     Add a message to cache.
    
     @param message The message to be cached.
     */
    - (void)addMessageToCache:(LCIMMessage *)message;
    
    /*!
     Remove a message from cache.
    
     @param message The message which you want to remove from cache.
     */
    - (void)removeMessageFromCache:(LCIMMessage *)message;
    
    // MARK: - Message Query
    
    /*!
     Queries recent messages from the cloud.
     @param limit The default is 20. The maximum is 1000.
     @param callback A callback on returned results.
     */
    - (void)queryMessagesFromServerWithLimit:(NSUInteger)limit
                                    callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;
    
    /*!
     Queries recent messages from the cache. 
     @param limit The default is 20. The maximum is 1000.
     @return An array of messages.
     */
    - (NSArray *)queryMessagesFromCacheWithLimit:(NSUInteger)limit;
    
    /*!
     Queries recent messages.
     @param limit The default is 20. The maximum is 1000.
     @param callback A callback on returned results.
     */
    - (void)queryMessagesWithLimit:(NSUInteger)limit
                          callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;
    
    /*!
     Queries historical messages.
     @warning `timestamp` must equal to the timestamp of the message that messageId equal to `messageId`, if the `timestamp` and `messageId` not match, continuity of querying message can't guarantee.
     
     @param messageId Messages before this message.
     @param timestamp Messages before this timestamp.
     @param limit The default is 20. The maximum is 1000. 
     @param callback A callback on returned results.
     */
    - (void)queryMessagesBeforeId:(NSString *)messageId
                        timestamp:(int64_t)timestamp
                            limit:(NSUInteger)limit
                         callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;
    
    /**
     Query messages from a message to an another message with specified direction applied.
    
     @param interval  A message interval.
     @param direction Direction of message query.
     @param limit     Limit of messages you want to query.
     @param callback  Callback of query request.
     */
    - (void)queryMessagesInInterval:(LCIMMessageInterval *)interval
                          direction:(LCIMMessageQueryDirection)direction
                              limit:(NSUInteger)limit
                           callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;
    
    /**
     Query Specific Media Type Message from Server.
    
     @param type Specific Media Type you want to query, see `LCIMMessageMediaType`.
     @param limit Limit of messages you want to query.
     @param messageId If set it and MessageId is Valid, the Query Result is Decending base on Timestamp and will Not Include the Message that its messageId is this parameter.
     @param timestamp Set Zero or Negative, it will query from latest Message and result include the latest Message; Set a valid timestamp, the Query Result is Decending base on Timestamp and will Not Include the Message that its timestamp is this parameter.
     @param callback Result callback.
     */
    - (void)queryMediaMessagesFromServerWithType:(LCIMMessageMediaType)type
                                           limit:(NSUInteger)limit
                                   fromMessageId:(NSString * _Nullable)messageId
                                   fromTimestamp:(int64_t)timestamp
                                        callback:(void (^)(NSArray<LCIMMessage *> * _Nullable messages, NSError * _Nullable error))callback;
    
    // MARK: - Member Info
    
    /**
     Get all member info. using cache as a default.
    
     @param callback Result callback.
     */
    - (void)getAllMemberInfoWithCallback:(void (^)(NSArray<LCIMConversationMemberInfo *> * _Nullable memberInfos, NSError * _Nullable error))callback;
    
    /**
     Get all member info.
    
     @param ignoringCache Cache option.
     @param callback Result callback.
     */
    - (void)getAllMemberInfoWithIgnoringCache:(BOOL)ignoringCache
                                     callback:(void (^)(NSArray<LCIMConversationMemberInfo *> * _Nullable memberInfos, NSError * _Nullable error))callback;
    
    /**
     Get a member info by member id. using cache as a default.
    
     @param memberId Equal to client id.
     @param callback Result callback.
     */
    - (void)getMemberInfoWithMemberId:(NSString *)memberId
                             callback:(void (^)(LCIMConversationMemberInfo * _Nullable memberInfo, NSError * _Nullable error))callback;
    
    /**
     Get a member info by member id.
    
     @param ignoringCache Cache option.
     @param memberId Equal to client id.
     @param callback Result callback.
     */
    - (void)getMemberInfoWithIgnoringCache:(BOOL)ignoringCache
                                  memberId:(NSString *)memberId
                                  callback:(void (^)(LCIMConversationMemberInfo * _Nullable memberInfo, NSError * _Nullable error))callback;
    
    /**
     Change a member's role.
    
     @param memberId Equal to client id.
     @param role Changing role.
     @param callback Result callback.
     */
    - (void)updateMemberRoleWithMemberId:(NSString *)memberId
                                    role:(LCIMConversationMemberRole)role
                                callback:(void (^)(BOOL succeeded, NSError * _Nullable error))callback;
    
    // MARK: - Member Block
    
    /**
     Blocking some members in the conversation.
    
     @param memberIds Who will be blocked.
     @param callback Result callback.
     */
    - (void)blockMembers:(NSArray<NSString *> *)memberIds
                callback:(void (^)(NSArray<NSString *> * _Nullable successfulIds, NSArray<LCIMOperationFailure *> * _Nullable failedIds, NSError * _Nullable error))callback;
    
    /**
     Unblocking some members in the conversation.
    
     @param memberIds Who will be unblocked.
     @param callback Result callback.
     */
    - (void)unblockMembers:(NSArray<NSString *> *)memberIds
                  callback:(void (^)(NSArray<NSString *> * _Nullable successfulIds, NSArray<LCIMOperationFailure *> * _Nullable failedIds, NSError * _Nullable error))callback;
    
    /**
     Query blocked members in the conversation.
    
     @param limit Count of the blocked members you want to query.
     @param next Offset, if callback's next is nil or empty, that means there is no more blocked members.
     @param callback Result callback.
     */
    - (void)queryBlockedMembersWithLimit:(NSInteger)limit
                                    next:(NSString * _Nullable)next
                                callback:(void (^)(NSArray<NSString *> * _Nullable blockedMemberIds, NSString * _Nullable next, NSError * _Nullable error))callback;
    
    // MARK: - Member Mute
    
    /**
     Muting some members in the conversation.
     
     @param memberIds Who will be muted.
     @param callback Result callback.
     */
    - (void)muteMembers:(NSArray<NSString *> *)memberIds
               callback:(void (^)(NSArray<NSString *> * _Nullable successfulIds, NSArray<LCIMOperationFailure *> * _Nullable failedIds, NSError * _Nullable error))callback;
    
    /**
     Unmuting some members in the conversation.
     
     @param memberIds Who will be unmuted.
     @param callback Result callback.
     */
    - (void)unmuteMembers:(NSArray<NSString *> *)memberIds
                 callback:(void (^)(NSArray<NSString *> * _Nullable successfulIds, NSArray<LCIMOperationFailure *> * _Nullable failedIds, NSError * _Nullable error))callback;
    
    /**
     Query muted members in the conversation.
     
     @param limit Count of the muted members you want to query.
     @param next Offset, if callback's next is nil or empty, that means there is no more muted members.
     @param callback Result callback.
     */
    - (void)queryMutedMembersWithLimit:(NSInteger)limit
                                  next:(NSString * _Nullable)next
                              callback:(void (^)(NSArray<NSString *> * _Nullable mutedMemberIds, NSString * _Nullable next, NSError * _Nullable error))callback;
    
    @end

    Swift

    class LCIMConversation : NSObject
  • Undocumented

    Declaration

    Objective-C

    @interface LCIMChatRoom : LCIMConversation
    
    @end

    Swift

    class LCIMChatRoom : LCIMConversation
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMServiceConversation : LCIMConversation
    
    /**
     Add ID of conversation's client to conversation's members.
    
     @param callback Result callback.
     */
    - (void)subscribeWithCallback:(void(^)(BOOL, NSError * _Nullable))callback;
    
    /**
     Remove ID of conversation's client from conversation's members.
     
     @param callback Result callback.
     */
    - (void)unsubscribeWithCallback:(void(^)(BOOL, NSError * _Nullable))callback;
    
    @end

    Swift

    class LCIMServiceConversation : LCIMConversation
  • Undocumented

    Declaration

    Objective-C

    @interface LCIMTemporaryConversation : LCIMConversation
    
    @end

    Swift

    class LCIMTemporaryConversation : LCIMConversation
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMConversationMemberInfo : NSObject
    
    + (instancetype)new NS_UNAVAILABLE;
    - (instancetype)init NS_UNAVAILABLE;
    
    /**
     Member's conversation's id.
    
     @return Conversation id.
     */
    - (NSString * _Nullable)conversationId;
    
    /**
     Equal to client id.
    
     @return Member id.
     */
    - (NSString * _Nullable)memberId;
    
    /**
     Member's role
    
     @return Role
     */
    - (LCIMConversationMemberRole)role;
    
    /**
     Whether is the creator of the conversation.
    
     @return Bool.
     */
    - (BOOL)isOwner;
    
    @end

    Swift

    class LCIMConversationMemberInfo : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMConversationQuery : NSObject
    
    /*!
     The max count of the query result, default is 10. 
     */
    @property (nonatomic, assign) NSInteger limit;
    
    /*!
     The offset of the query, default is 0.
     */
    @property (nonatomic, assign) NSInteger skip;
    
    /*!
     Configures cache policy, default is kLCCachePolicyCacheElseNetwork
     */
    @property (nonatomic, assign) LCIMCachePolicy cachePolicy;
    
    /*!
     Configures cache time, default is one hour (1 * 60 * 60)
     */
    @property (nonatomic, assign) NSTimeInterval cacheMaxAge;
    
    /*!
     * Query conditions.
     */
    @property (nonatomic, assign) LCIMConversationQueryOption option;
    
    /*!
     * Build an query that is the OR of the passed in queries.
     * @param queries The list of queries to OR together.
     * @return an query that is the OR of the passed in queries.
     */
    + (nullable instancetype)orQueryWithSubqueries:(NSArray<LCIMConversationQuery *> *)queries;
    
    /*!
     * Build an query that is the AND of the passed in queries.
     * @param queries The list of queries to AND together.
     * @return an query that is the AND of the passed in queries.
     */
    + (nullable instancetype)andQueryWithSubqueries:(NSArray<LCIMConversationQuery *> *)queries;
    
    /*!
     Add a constraint that requires a particular key exists.
     @param key The key that should exist.
     */
    - (void)whereKeyExists:(NSString *)key;
    
    /*!
     Add a constraint that requires a key not exist.
     @param key The key that should not exist.
     */
    - (void)whereKeyDoesNotExist:(NSString *)key;
    
    /*!
     The value corresponding to key is equal to object,
     or the array corresponding to key contains object.
     */
    - (void)whereKey:(NSString *)key equalTo:(id)object;
    
    /*!
     The value corresponding to key is less than object.
     */
    - (void)whereKey:(NSString *)key lessThan:(id)object;
    
    /*!
     The value corresponding to key is less than or equal to object.
     */
    - (void)whereKey:(NSString *)key lessThanOrEqualTo:(id)object;
    
    /*!
     The value corresponding to key is greater than object.
     */
    - (void)whereKey:(NSString *)key greaterThan:(id)object;
    
    /*!
     The value corresponding to key is greater than or equal to object.
     */
    - (void)whereKey:(NSString *)key greaterThanOrEqualTo:(id)object;
    
    /*!
     The value corresponding to key is not equal to object,
     or the array corresponding to key does not contain object.
     */
    - (void)whereKey:(NSString *)key notEqualTo:(id)object;
    
    /*!
     array contains value corresponding to key,
     or array contains at least one element in the array value corresponding to key.
     */
    - (void)whereKey:(NSString *)key containedIn:(NSArray *)array;
    
    /*!
     array does not contain value corresponding to key,
     or the field corresponding to key does not exist.
     */
    - (void)whereKey:(NSString *)key notContainedIn:(NSArray *)array;
    
    /*!
     The array corresponding to key contains all elements in array.
     */
    - (void)whereKey:(NSString *)key containsAllObjectsInArray:(NSArray *)array;
    
    /*!
     Near a geopoint. Returned results will be sorted in distances to the geopoint.
     */
    - (void)whereKey:(NSString *)key nearGeoPoint:(LCGeoPoint *)geopoint;
    
    /*!
     Near a geopoint. Returned results will be sorted in distances to the geopoint.
     @param maxDistance in miles
     */
    - (void)whereKey:(NSString *)key nearGeoPoint:(LCGeoPoint *)geopoint withinMiles:(double)maxDistance;
    
    /*!
     Near a geopoint. Returned results will be sorted in distances to the geopoint.
     @param maxDistance in kilometers
     */
    - (void)whereKey:(NSString *)key nearGeoPoint:(LCGeoPoint *)geopoint withinKilometers:(double)maxDistance;
    
    /*!
     Near a geopoint. Returned results will be sorted in distances to the geopoint.
     @param maxDistance in radians
     */
    - (void)whereKey:(NSString *)key nearGeoPoint:(LCGeoPoint *)geopoint withinRadians:(double)maxDistance;
    
    /*!
     Within a rectangle.
     @param southwest the lower left corner of the rectangle
     @param northeast the upper right corner of the rectangle
     */
    - (void)whereKey:(NSString *)key withinGeoBoxFromSouthwest:(LCGeoPoint *)southwest toNortheast:(LCGeoPoint *)northeast;
    
    /*!
     Matches a regex. This query may have a significant performance impact.
     */
    - (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex;
    
    /*!
     Matches a regex. This query may have a significant performance impact.
     @param modifiers PCRE regex modifiers such as i and m.
     */
    - (void)whereKey:(NSString *)key matchesRegex:(NSString *)regex modifiers:(nullable NSString *)modifiers;
    
    /*!
     The string corresponding to key has a substring.
     */
    - (void)whereKey:(NSString *)key containsString:(NSString *)substring;
    
    /*!
     The string corresponding to key has a prefix.
     */
    - (void)whereKey:(NSString *)key hasPrefix:(NSString *)prefix;
    
    /*!
     The string corresponding to key has a suffix.
     */
    - (void)whereKey:(NSString *)key hasSuffix:(NSString *)suffix;
    
    /*!
     The size of the array corresponding to key is equal to count.
     */
    - (void)whereKey:(NSString *)key sizeEqualTo:(NSUInteger)count;
    
    
    /*!
     The ascending order by the value corresponding to key, support for multi-field sorting with comma.
     */
    - (void)orderByAscending:(NSString *)key;
    
    /*!
     Adding a ascending order by the value corresponding to key to the order.
     */
    - (void)addAscendingOrder:(NSString *)key;
    
    /*!
     The descending order by the value corresponding to key, support for multi-field sorting with comma.
     */
    - (void)orderByDescending:(NSString *)key;
    
    /*!
     Adding a descending order by the value corresponding to key to the order.
     @param key 降序的 key
     */
    - (void)addDescendingOrder:(NSString *)key;
    
    /*!
     Sort with sortDescriptor.
     @param sortDescriptor NSSortDescriptor object
     */
    - (void)orderBySortDescriptor:(NSSortDescriptor *)sortDescriptor;
    
    /*!
     Sort with sortDescriptors.
     @param sortDescriptors NSSortDescriptor object array
     */
    - (void)orderBySortDescriptors:(NSArray *)sortDescriptors;
    
    /*!
     Queries for an LCIMConversation object based on its conversationId.
     @param callback on returned results
     */
    - (void)getConversationById:(NSString *)conversationId
                       callback:(void (^)(LCIMConversation * _Nullable conversation, NSError * _Nullable error))callback;
    
    /*!
     Queries for an array of LCIMConversation objects.
     If limit is unspecified or invalid, it will return 10 results by default.
     @param callback on returned results
     */
    - (void)findConversationsWithCallback:(void (^)(NSArray<LCIMConversation *> * _Nullable conversations, NSError * _Nullable error))callback;
    
    
    /**
     Find temporary conversations from server.
    
     @param tempConvIds ID array of temporary conversations.
     @param callback Result callback.
     */
    - (void)findTemporaryConversationsWith:(NSArray<NSString *> *)tempConvIds
                                  callback:(void (^)(NSArray<LCIMTemporaryConversation *> * _Nullable conversations, NSError * _Nullable error))callback;
    
    @end

    Swift

    class LCIMConversationQuery : NSObject
  • Represents a conversation which intends to be archived. Can get this object from LCIMConversation by -[LCIMConversation keyedConversation]. Can convert this object to LCIMConverstaion by -[LCIMClient conversationWithKeyedConversation:].

    See more

    Declaration

    Objective-C

    @interface LCIMKeyedConversation : NSObject <NSCoding>

    Swift

    class LCIMKeyedConversation : NSObject, NSCoding
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMMessagePatchedReason : NSObject
    
    @property (nonatomic) NSInteger code;
    @property (nonatomic, nullable) NSString *reason;
    
    @end

    Swift

    class LCIMMessagePatchedReason : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMMessage : NSObject <NSCopying, NSCoding>
    
    @property (nonatomic, assign, readonly) LCIMMessageMediaType mediaType;
    
    /*!
     * 表示接收和发出的消息
     */
    @property (nonatomic, assign, readonly) LCIMMessageIOType ioType;
    
    /*!
     * 表示消息状态
     */
    @property (nonatomic, assign, readonly) LCIMMessageStatus status;
    
    /*!
     * 消息 id
     */
    @property (nonatomic, strong, readonly, nullable) NSString *messageId;
    
    /*!
     * 消息发送/接收方 id
     */
    @property (nonatomic, strong, readonly, nullable) NSString *clientId;
    
    /*!
     * A flag indicates whether this message mentions all members in conversation or not.
     */
    @property (nonatomic, assign, readwrite) BOOL mentionAll;
    
    /*!
     * An ID list of clients who mentioned by this message.
     */
    @property (nonatomic, strong, readwrite, nullable) NSArray<NSString *> *mentionList;
    
    /*!
     * Whether current client is mentioned by this message.
     */
    @property (nonatomic, assign, readonly) BOOL mentioned;
    
    /*!
     * 消息所属对话的 id
     */
    @property (nonatomic, strong, readonly, nullable) NSString *conversationId;
    
    /*!
     * 消息文本
     */
    @property (nonatomic, strong, readonly, nullable) NSString *content;
    
    /*!
     * 发送时间(精确到毫秒)
     */
    @property (nonatomic, assign, readonly) int64_t sendTimestamp;
    
    /*!
     * 接收时间(精确到毫秒)
     */
    @property (nonatomic, assign, readonly) int64_t deliveredTimestamp;
    
    /*!
     * 被标记为已读的时间(精确到毫秒)
     */
    @property (nonatomic, assign, readonly) int64_t readTimestamp;
    
    /*!
     The message update time.
     */
    @property (nonatomic, strong, readonly, nullable) NSDate *updatedAt;
    
    - (NSString * _Nullable)payload;
    
    /*!
     创建文本消息。
     @param content - 消息文本.
     */
    + (instancetype)messageWithContent:(NSString *)content;
    
    @end

    Swift

    class LCIMMessage : NSObject, NSCopying, NSCoding
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMMessageOption : NSObject
    
    @property (nonatomic, assign)           BOOL                 receipt;
    @property (nonatomic, assign)           BOOL                 transient;
    @property (nonatomic, assign)           BOOL                 will;
    @property (nonatomic, assign)           LCIMMessagePriority  priority;
    @property (nonatomic, strong, nullable) NSDictionary        *pushData;
    
    @end

    Swift

    class LCIMMessageOption : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCIMSignature : NSObject
    
    /**
     *  Signture result signed by server master key.
     */
    @property (nonatomic, copy, nullable) NSString *signature;
    
    /**
     *  Timestamp used to construct signature.
     */
    @property (nonatomic, assign) int64_t timestamp;
    
    /**
     *  Nonce string used to construct signature
     */
    @property (nonatomic, copy, nullable) NSString *nonce;
    
    /**
     *  Error in the course of getting signature from server. Commonly network error. Please set it if any error when getting signature.
     */
    @property (nonatomic, strong, nullable) NSError *error;
    
    @end

    Swift

    class LCIMSignature : NSObject
  • Audio Message. Can be created by the audio’s file path.

    See more

    Declaration

    Objective-C

    @interface LCIMAudioMessage : LCIMTypedMessage <LCIMTypedMessageSubclassing>

    Swift

    class LCIMAudioMessage : LCIMTypedMessage, LCIMTypedMessageSubclassing
  • File Message.

    See more

    Declaration

    Objective-C

    @interface LCIMFileMessage : LCIMTypedMessage <LCIMTypedMessageSubclassing>

    Swift

    class LCIMFileMessage : LCIMTypedMessage, LCIMTypedMessageSubclassing
  • Image Message. Can be created by the image’s file path.

    See more

    Declaration

    Objective-C

    @interface LCIMImageMessage : LCIMTypedMessage <LCIMTypedMessageSubclassing>

    Swift

    class LCIMImageMessage : LCIMTypedMessage, LCIMTypedMessageSubclassing
  • Location Message.

    See more

    Declaration

    Objective-C

    @interface LCIMLocationMessage : LCIMTypedMessage <LCIMTypedMessageSubclassing>

    Swift

    class LCIMLocationMessage : LCIMTypedMessage, LCIMTypedMessageSubclassing
  • This class is a type of messages that have been recalled by its sender.

    See more

    Declaration

    Objective-C

    @interface LCIMRecalledMessage : LCIMTypedMessage <LCIMTypedMessageSubclassing>

    Swift

    class LCIMRecalledMessage : LCIMTypedMessage, LCIMTypedMessageSubclassing
  • Text Message.

    See more

    Declaration

    Objective-C

    @interface LCIMTextMessage : LCIMTypedMessage <LCIMTypedMessageSubclassing>

    Swift

    class LCIMTextMessage : LCIMTypedMessage, LCIMTypedMessageSubclassing
  • Base class for rich media message.

    See more

    Declaration

    Objective-C

    @interface LCIMTypedMessage : LCIMMessage

    Swift

    class LCIMTypedMessage : LCIMMessage
  • Video Message.

    See more

    Declaration

    Objective-C

    @interface LCIMVideoMessage : LCIMTypedMessage <LCIMTypedMessageSubclassing>

    Swift

    class LCIMVideoMessage : LCIMTypedMessage, LCIMTypedMessageSubclassing
  • A type that defines an object which can observe various kinds of change events of objects that a query matches.

    See more

    Declaration

    Objective-C

    @interface LCLiveQuery : NSObject

    Swift

    class LCLiveQuery : NSObject
  • LCHTTPSessionManager is a subclass of LCURLSessionManager with convenience methods for making HTTP requests. When a baseURL is provided, requests made with the GET / POST / et al. convenience methods can be made with relative paths.

    Subclassing Notes

    Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass LCHTTPSessionManager, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application.

    For developers targeting iOS 6 or Mac OS X 10.8 or earlier, LCHTTPRequestOperationManager may be used to similar effect.

    Methods to Override

    To change the behavior of all data task operation construction, which is also used in the GET / POST / et al. convenience methods, override dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:.

    Serialization

    Requests created by an HTTP client will contain default headers and encode parameters according to the requestSerializer property, which is an object conforming to <LCURLRequestSerialization>.

    Responses received from the server are automatically validated and serialized by the responseSerializers property, which is an object conforming to <LCURLResponseSerialization>

    URL Construction Using Relative Paths

    For HTTP convenience methods, the request serializer constructs URLs from the path relative to the -baseURL, using NSURL +URLWithString:relativeToURL:, when provided. If baseURL is nil, path needs to resolve to a valid NSURL object using NSURL +URLWithString:.

    Below are a few examples of how baseURL and relative paths interact:

    NSURL *baseURL = [NSURL URLWithString:@“http://example.com/v1/”]; [NSURL URLWithString:@“foo” relativeToURL:baseURL]; // http://example.com/v1/foo [NSURL URLWithString:@“foo?bar=baz” relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz [NSURL URLWithString:@“/foo” relativeToURL:baseURL]; // http://example.com/foo [NSURL URLWithString:@“foo/” relativeToURL:baseURL]; // http://example.com/v1/foo [NSURL URLWithString:@“/foo/” relativeToURL:baseURL]; // http://example.com/foo/ [NSURL URLWithString:@“http://example2.com/” relativeToURL:baseURL]; // http://example2.com/

    Also important to note is that a trailing slash will be added to any baseURL without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash.

    Warning

    Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.
    See more

    Declaration

    Objective-C

    @interface LCHTTPSessionManager
        : LCURLSessionManager <NSSecureCoding, NSCopying>

    Swift

    class LCHTTPSessionManager : LCURLSessionManager, NSSecureCoding, NSCopying
  • LCNetworkReachabilityManager monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces.

    Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it’s possible that an initial request may be required to establish reachability.

    See Apple’s Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ )

    Warning

    Instances of LCNetworkReachabilityManager must be started with -startMonitoring before reachability status can be determined.
    See more

    Declaration

    Objective-C

    @interface LCNetworkReachabilityManager : NSObject

    Swift

    class LCNetworkReachabilityManager : NSObject
  • LCSecurityPolicy evaluates server trust against pinned X.509 certificates and public keys over secure connections.

    Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled.

    See more

    Declaration

    Objective-C

    @interface LCSecurityPolicy : NSObject <NSSecureCoding, NSCopying>

    Swift

    class LCSecurityPolicy : NSObject, NSSecureCoding, NSCopying
  • LCHTTPRequestSerializer conforms to the LCURLRequestSerialization & LCURLResponseSerialization protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.

    Any request or response serializer dealing with HTTP is encouraged to subclass LCHTTPRequestSerializer in order to ensure consistent default behavior.

    See more

    Declaration

    Objective-C

    @interface LCHTTPRequestSerializer : NSObject <LCURLRequestSerialization>

    Swift

    class LCHTTPRequestSerializer : NSObject, LCURLRequestSerialization
  • LCJSONRequestSerializer is a subclass of LCHTTPRequestSerializer that encodes parameters as JSON using NSJSONSerialization, setting the Content-Type of the encoded request to application/json.

    See more

    Declaration

    Objective-C

    @interface LCJSONRequestSerializer : LCHTTPRequestSerializer

    Swift

    class LCJSONRequestSerializer : LCHTTPRequestSerializer
  • LCPropertyListRequestSerializer is a subclass of LCHTTPRequestSerializer that encodes parameters as JSON using NSPropertyListSerializer, setting the Content-Type of the encoded request to application/x-plist.

    See more

    Declaration

    Objective-C

    @interface LCPropertyListRequestSerializer : LCHTTPRequestSerializer

    Swift

    class LCPropertyListRequestSerializer : LCHTTPRequestSerializer
  • LCHTTPResponseSerializer conforms to the LCURLRequestSerialization & LCURLResponseSerialization protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation.

    Any request or response serializer dealing with HTTP is encouraged to subclass LCHTTPResponseSerializer in order to ensure consistent default behavior.

    See more

    Declaration

    Objective-C

    @interface LCHTTPResponseSerializer : NSObject <LCURLResponseSerialization>

    Swift

    class LCHTTPResponseSerializer : NSObject, LCURLResponseSerialization
  • LCJSONResponseSerializer is a subclass of LCHTTPResponseSerializer that validates and decodes JSON responses.

    By default, LCJSONResponseSerializer accepts the following MIME types, which includes the official standard, application/json, as well as other commonly-used types:

    • application/json
    • text/json
    • text/javascript

    In RFC 7159 - Section 8.1, it states that JSON text is required to be encoded in UTF-8, UTF-16, or UTF-32, and the default encoding is UTF-8. NSJSONSerialization provides support for all the encodings listed in the specification, and recommends UTF-8 for efficiency. Using an unsupported encoding will result in serialization error. See the NSJSONSerialization documentation for more details.

    See more

    Declaration

    Objective-C

    @interface LCJSONResponseSerializer : LCHTTPResponseSerializer

    Swift

    class LCJSONResponseSerializer : LCHTTPResponseSerializer
  • LCXMLParserResponseSerializer is a subclass of LCHTTPResponseSerializer that validates and decodes XML responses as an NSXMLParser objects.

    By default, LCXMLParserResponseSerializer accepts the following MIME types, which includes the official standard, application/xml, as well as other commonly-used types:

    • application/xml
    • text/xml

    Declaration

    Objective-C

    @interface LCXMLParserResponseSerializer : LCHTTPResponseSerializer

    Swift

    class LCXMLParserResponseSerializer : LCHTTPResponseSerializer
  • LCPropertyListResponseSerializer is a subclass of LCHTTPResponseSerializer that validates and decodes XML responses as an NSXMLDocument objects.

    By default, LCPropertyListResponseSerializer accepts the following MIME types:

    • application/x-plist
    See more

    Declaration

    Objective-C

    @interface LCPropertyListResponseSerializer : LCHTTPResponseSerializer

    Swift

    class LCPropertyListResponseSerializer : LCHTTPResponseSerializer
  • LCImageResponseSerializer is a subclass of LCHTTPResponseSerializer that validates and decodes image responses.

    By default, LCImageResponseSerializer accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage:

    • image/tiff
    • image/jpeg
    • image/gif
    • image/png
    • image/ico
    • image/x-icon
    • image/bmp
    • image/x-bmp
    • image/x-xbitmap
    • image/x-win-bitmap
    See more

    Declaration

    Objective-C

    @interface LCImageResponseSerializer : LCHTTPResponseSerializer

    Swift

    class LCImageResponseSerializer : LCHTTPResponseSerializer
  • LCCompoundSerializer is a subclass of LCHTTPResponseSerializer that delegates the response serialization to the first LCHTTPResponseSerializer object that returns an object for responseObjectForResponse:data:error:, falling back on the default behavior of LCHTTPResponseSerializer. This is useful for supporting multiple potential types and structures of server responses with a single serializer.

    See more

    Declaration

    Objective-C

    @interface LCCompoundResponseSerializer : LCHTTPResponseSerializer

    Swift

    class LCCompoundResponseSerializer : LCHTTPResponseSerializer
  • LCURLSessionManager creates and manages an NSURLSession object based on a specified NSURLSessionConfiguration object, which conforms to <NSURLSessionTaskDelegate>, <NSURLSessionDataDelegate>, <NSURLSessionDownloadDelegate>, and <NSURLSessionDelegate>.

    Subclassing Notes

    This is the base class for LCHTTPSessionManager, which adds functionality specific to making HTTP requests. If you are looking to extend LCURLSessionManager specifically for HTTP, consider subclassing LCHTTPSessionManager instead.

    NSURLSession & NSURLSessionTask Delegate Methods

    LCURLSessionManager implements the following delegate methods:

    NSURLSessionDelegate

    • URLSession:didBecomeInvalidWithError:
    • URLSession:didReceiveChallenge:completionHandler:
    • URLSessionDidFinishEventsForBackgroundURLSession:

    NSURLSessionTaskDelegate

    • URLSession:willPerformHTTPRedirection:newRequest:completionHandler:
    • URLSession:task:didReceiveChallenge:completionHandler:
    • URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:
    • URLSession:task:needNewBodyStream:
    • URLSession:task:didCompleteWithError:

    NSURLSessionDataDelegate

    • URLSession:dataTask:didReceiveResponse:completionHandler:
    • URLSession:dataTask:didBecomeDownloadTask:
    • URLSession:dataTask:didReceiveData:
    • URLSession:dataTask:willCacheResponse:completionHandler:

    NSURLSessionDownloadDelegate

    • URLSession:downloadTask:didFinishDownloadingToURL:
    • URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:
    • URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:

    If any of these methods are overridden in a subclass, they must call the super implementation first.

    Network Reachability Monitoring

    Network reachability status and change monitoring is available through the reachabilityManager property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See LCNetworkReachabilityManager for more details.

    NSCoding Caveats

    • Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using -initWithCoder: or NSKeyedUnarchiver.

    NSCopying Caveats

    • -copy and -copyWithZone: return a new manager with a new NSURLSession created from the configuration of the original.
    • Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to self, which would otherwise have the unintuitive side-effect of pointing to the original session manager when copied.

    Warning

    Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance.

    See more

    Declaration

    Objective-C

    @interface LCURLSessionManager
        : NSObject <NSURLSessionDelegate, NSURLSessionTaskDelegate,
                    NSURLSessionDataDelegate, NSURLSessionDownloadDelegate,
                    NSSecureCoding, NSCopying>

    Swift

    class LCURLSessionManager : NSObject, URLSessionDelegate, URLSessionTaskDelegate, URLSessionDataDelegate, URLSessionDownloadDelegate, NSSecureCoding, NSCopying
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCRTMWebSocketMessage : NSObject
    
    + (instancetype)messageWithData:(NSData *)data;
    + (instancetype)messageWithString:(NSString *)string;
    
    - (instancetype)initWithData:(NSData *)data NS_DESIGNATED_INITIALIZER;
    - (instancetype)initWithString:(NSString *)string NS_DESIGNATED_INITIALIZER;
    
    @property (nonatomic, readonly) LCRTMWebSocketMessageType type;
    @property (nonatomic, nullable, readonly) NSData *data;
    @property (nonatomic, nullable, readonly) NSString *string;
    
    - (instancetype)init NS_UNAVAILABLE;
    + (instancetype)new NS_UNAVAILABLE;
    
    @end

    Swift

    class LCRTMWebSocketMessage : NSObject
  • Undocumented

    See more

    Declaration

    Objective-C

    @interface LCRTMWebSocket : NSObject
    
    - (instancetype)initWithURL:(NSURL *)url;
    - (instancetype)initWithURL:(NSURL *)url protocols:(NSArray<NSString *> *)protocols;
    - (instancetype)initWithRequest:(NSURLRequest *)request;
    
    @property (nonatomic, nullable, weak) id<LCRTMWebSocketDelegate> delegate;
    @property (nonatomic) dispatch_queue_t delegateQueue;
    @property (nonatomic) NSMutableURLRequest *request;
    @property (nonatomic, nullable) id sslSettings;
    
    - (instancetype)init NS_UNAVAILABLE;
    + (instancetype)new NS_UNAVAILABLE;
    
    - (void)open;
    - (void)closeWithCloseCode:(LCRTMWebSocketCloseCode)closeCode reason:(NSData * _Nullable)reason;
    
    - (void)sendMessage:(LCRTMWebSocketMessage *)message completion:(void (^ _Nullable)(void))completion;
    - (void)sendPing:(NSData * _Nullable)data completion:(void (^ _Nullable)(void))completion;
    - (void)sendPong:(NSData * _Nullable)data completion:(void (^ _Nullable)(void))completion;
    
    - (void)clean;
    
    @end

    Swift

    class LCRTMWebSocket : NSObject