- while I was using a block, it aways prompt block type confit,
结果如下:
Redefinition of 'responseObject' with a different type: 'sucessBlock
(__strong' (aka 'void (^__strong)(__strong id)') vs 'id _Nullable
__strong' // here is the block declare: #import <Foundation/Foundation.h> typedef void(^sucessBlock)(id
respondseObject); typedef void(^failureBlock)(NSError * error);
#import <Foundation/Foundation.h>
typedef void(^sucessBlock)(id respondseObject);
typedef void(^failureBlock)(NSError * error);
@interface TRAFNetWorkManager : NSObject
+(void)sendGetRequestWithUrl:(NSString*)urlStr paramenters:(NSDictionary*)paramDic sucess:(sucessBlock)suscess failure:(failureBlock)failure;
@end
//这里是补充#import
#import "TRAFNetWorkManager.h"
#import "AFNetworking.h"
@implementation TRAFNetWorkManager
+(void)sendGetRequestWithUrl:(NSString *)urlStr paramenters:(NSDictionary *)paramDic sucess:(sucessBlock)suscess failure:(failureBlock)failure {
AFHTTPSessionManager* manager=[AFHTTPSessionManager manager];
[manager GET:urlStr parameters:paramDic progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
sucessBlock(responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
NSError*error1=nil;
failureBlock(error1);
}];
}
@end
答案 0 :(得分:2)
SimpleDraweeView
和successBlock
是块类型的名称。您不能将它们用于调用。相反,您需要使用块变量的名称,在您的情况下为failureBlock
和success
:
failure