私のコード:
RKRequest.m:
#import "RKRequestDelegate.h"
#import "Constants.h"
@implementation RKRequestDelegate {
}
- (void)sendRequest:(UIImageView *)imageView {
NSDictionary *queryParams = [NSDictionary dictionaryWithObjectsAndKeys:@"0", @"w", @"4", @"section", @"0",
@"latitude", @"0", @"longitude", @"0", @"dt", @"0", @"di", nil];
NSString *plistPath = [[NSBundle mainBundle] pathForResource:[Constants getSettingsName]
ofType:[Constants getSettingsFormat]];
NSDictionary *contentDictionary = [NSDictionary dictionaryWithContentsOfFile:plistPath];
NSString *addedUrl = [contentDictionary valueForKey:[Constants getBannerTag]];
//
RKRequest *request = [[RKClient sharedClient] get:addedUrl queryParameters:queryParams delegate:self];
}
- (void)request:(RKRequest *)request didLoadResponse:(RKResponse *)response {
NSLog(@"Response!!!");
}
@end
RKRequestDelegate.h:
@interface RKRequestDelegate : NSObject <RKRequestDelegate>
- (void)sendRequest:(UIImageView *)UIImageView;
- (void)request:(RKRequest *)request didLoadResponse:(RKResponse *)response;
@end
AppDelegate.m:
RKClient *client = [RKClient clientWithBaseURL:[HttpUtil getHost]];
アプリケーションを起動した後、5 秒後にクラッシュします。delegate:self
デリゲートに変更する[RKRequestDelegate class]
と、クラッシュせず、応答 200 (OK) が返されますが、didLoadResponse
!
助けてください、そしてありがとう。
アップデート:
[request sendSynchronously];
RKRequestDelegate.m で使用すると、応答が呼び出されます。