몇 주 전에 IOS와 Graph API를 사용하기 시작했습니다. 나는 페이스 북에서 검색하는 앨범 데이터로 UITableView를 채우는 데 문제가있다. 내 appdelegete 내 uitabledatasource하고 나는 사용자가 로그인 한 후 다음과 같은 요청하게 너무 uitabledelegate :Facebook 앨범으로 UITableView 채우기 | IOS
NSString* fql = [NSString stringWithString:@"select object_id, cover_object_id, name, description from album where can_upload=1 and owner=me()"];
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObject:fql forKey:@"query"];
[facebook requestWithMethodName:@"fql.query" andParams:params andHttpMethod:@"GET" andDelegate:self];
[theTable reloadData];
을 그리고 나는 테이블에 다음과 같은 구현 :
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.resultData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *SimpleTableIdentifier = @"SimpleTableIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: SimpleTableIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:SimpleTableIdentifier] autorelease];
}
NSUInteger row = [indexPath row]; cell.textLabel.text = [[self.resultData objectAtIndex:row] valueForKey:@"name"];
NSLog(@"the name %@", [[self.resultData objectAtIndex:row] valueForKey:@"name"]);
return cell;
}
그리고이 같은 결과를 관리를 :
- (void)request:(FBRequest *)request didLoad:(id)result {
if ([result isKindOfClass:[NSArray class]]) {
resultData=result;
[theTable reloadData];
}
NSLog(@"Result of API call: %@", result);
}
나는 쿼리의 정확한 결과를 얻을 수 있지만, 항상 빈
그래서 테이블 데이터를 다시로드하지