Skip to content

Commit 387a262

Browse files
committed
Fix warnings build with release config.
1 parent 7c77114 commit 387a262

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

Sources/RFAPI/Define/RFAPIDefineManager.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,10 @@ - (NSURL *)requestURLForDefine:(RFAPIDefine *)define parameters:(NSMutableDictio
9999
}
100100

101101
if (!url) {
102+
#if RFDEBUG
102103
NSString *debugFormat = [RFAPI localizedStringForKey:@"RFAPI.Debug.CannotJoinPathToBaseURL" value:@"Unable to join path %1$@ to %2$@, please check the API define"];
103104
RFAPILogError_(debugFormat, path, define.baseURL)
105+
#endif
104106
if (error) {
105107
*error = [RFAPI localizedErrorWithDoomain:NSURLErrorDomain code:NSURLErrorBadURL underlyingError:nil descriptionKey:@"RFAPI.Error.CannotCreateRequestDescription" descriptionValue:@"Internal error, unable to create request" reasonKey:@"RFAPI.Error.CannotCreateRequestReason" reasonValue:@"It seems to be an application bug" suggestionKey:@"RFAPI.Error.CannotCreateRequestSuggestion" suggestionValue:@"Please try again. If it still doesn't work, try restarting the application" url:nil];
106108
}

Sources/RFAPI/ModelTransformer/RFAPIJSONModelTransformer.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,32 @@ - (id)transformResponse:(id)response toType:(RFAPIDefineResponseExpectType)type
1111
case RFAPIDefineResponseExpectObject: {
1212
NSDictionary *responseObject = response;
1313
if (![responseObject isKindOfClass:NSDictionary.class]) {
14+
#if RFDEBUG
1415
NSString *debugFormat = [RFAPI localizedStringForKey:@"RFAPI.Debug.ObjectResponseTypeMismatchClass" value:@"Server response is %@ other than a dictionary\nPlease check your code first, then contart the server staff if the sever does not return as required"];
1516
RFAPILogError_(debugFormat, responseObject.class)
17+
#endif
1618
*error = [self badResponseError:nil];
1719
return nil;
1820
}
1921

2022
NSError *e = nil;
2123
id JSONModelObject = [(JSONModel *)[modelClass alloc] initWithDictionary:responseObject error:&e];
2224
if (!JSONModelObject) {
25+
#if RFDEBUG
2326
NSString *debugFormat = [RFAPI localizedStringForKey:@"RFAPI.Debug.ObjectResponseConvertToModelError" value:@"Cannot convert response to model: %@\nPlease check your code first, then contart the server staff if the sever does not return as required"];
2427
RFAPILogError_(debugFormat, e)
28+
#endif
2529
*error = [self badResponseError:e];
2630
}
2731
return JSONModelObject;
2832
}
2933
case RFAPIDefineResponseExpectObjects: {
3034
NSArray *responseObject = response;
3135
if (![responseObject isKindOfClass:NSArray.class]) {
36+
#if RFDEBUG
3237
NSString *debugFormat = [RFAPI localizedStringForKey:@"RFAPI.Debug.ArrayResponseTypeMismatchClass" value:@"Server response is %@ other than an array\nPlease check your code first, then contart the server staff if the sever does not return as required"];
3338
RFAPILogError_(debugFormat, responseObject.class)
39+
#endif
3440
*error = [self badResponseError:nil];
3541
return nil;
3642
}
@@ -43,9 +49,10 @@ - (id)transformResponse:(id)response toType:(RFAPIDefineResponseExpectType)type
4349
[objects addObject:obj];
4450
continue;
4551
}
46-
52+
#if RFDEBUG
4753
NSString *debugFormat = [RFAPI localizedStringForKey:@"RFAPI.Debug.ObjectResponseConvertToModelError" value:@"Cannot convert elements in the array to model: %@\nPlease check your code first, then contart the server staff if the sever does not return as required"];
4854
RFAPILogError_(debugFormat, e)
55+
#endif
4956
*error = [self badResponseError:e];
5057
return nil;
5158
}

Sources/RFAPI/RFAPI.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,10 @@ - (void)cancelOperationsWithGroupIdentifier:(nullable NSString *)identifier {
170170
NSError *e = nil;
171171
NSMutableURLRequest *request = [self _RFAPI_makeURLRequestWithDefine:define context:context error:&e];
172172
if (!request) {
173+
#if RFDEBUG
173174
NSString *debugFormat = [self.class localizedStringForKey:@"RFAPI.Debug.CannotCreateRequestError" value:@"Cannot create request: %@"];
174175
RFAPILogError_(debugFormat, e)
176+
#endif
175177
NSError *error = [self.class localizedErrorWithDoomain:NSURLErrorDomain code:NSURLErrorCancelled underlyingError:e descriptionKey:@"RFAPI.Error.CannotCreateRequest" descriptionValue:@"Internal error, unable to create request" reasonKey:@"RFAPI.Error.CannotCreateRequestReason" reasonValue:@"It seems to be an application bug" suggestionKey:@"RFAPI.Error.CannotCreateRequestSuggestion" suggestionValue:@"Please try again. If it still doesn't work, try restarting the application" url:request.URL];
176178
[self _RFAPI_executeContext:context failure:error];
177179
return nil;

0 commit comments

Comments
 (0)