URL에서 JSON 배열을 가져 와서 테이블 뷰를 채우는 데 사용하는 iOS 앱의 일부로 다음 코드를 사용합니다. 어떤 이유로, 요청이 함수에서 수행되지 않고 있으며, 이유를 파악할 수 없습니다. 이 기능은 아래와 같습니다.이 URL 요청이 호출되지 않는 이유는 무엇입니까?
P.S - 나는이 Objective-C 종달새의 초보자입니다. 정말 확실한 실수를했다면 용서해주세요!
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
// Create a URL Request
self.responseData = [NSMutableData data];
NSURLRequest *request = [NSURLRequest requestWithURL:
[NSURL URLWithString:@"http://mydomain.com/return_json_list"]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
self.viewController = [[BIDViewController alloc] initWithNibName:@"BIDViewController" bundle:nil];
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
}
요청이 비동기이며 대리자 메서드로 다시보고됩니다. 그래서'NSURLConnectionDelegate' 메쏘드 중 일부를 구현할 필요가 있습니다 :'- connection : didReceiveResponse :'. docs –