Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .h
- @interface ICSessionManager (CheckAPI)
- - (nullable NSURLSessionDataTask *)checkAPIConnection:(nullable void (^)(void))successBlock
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failureBlock;
- @end
- .m
- @implementation ICSessionManager (CheckAPI)
- - (nullable NSURLSessionDataTask *)checkAPIConnection:(nullable void (^)(void))successBlock
- failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failureBlock {
- return [self GET:ICTestAPI
- parameters:nil
- success:^( NSURLSessionDataTask * _Nullable task, id responseObject) {
- if (successBlock) {
- dispatch_async(dispatch_get_main_queue(), ^{
- successBlock();
- });
- }
- } failure:[ICSessionManager forwardFailureBlock:failureBlock]];
- }
- @end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement