2013-12-18 3 views
-2

오류가 발생합니다. 그러나 왜 내가 그걸 얻었는지 잘 모르겠습니다. 그것은Xcode 5 유령 오류

+0

우리는 * 전에 else' * 오프닝'가 아닌 그 뒤에 코드를 참조해야합니다 전에 다른 중괄호 닫기 (.이 코드는 문법적으로 정확한 모양) – Tim

+0

것은 t, 방법을 닫습니다 보인다 그 밖의 사람은 어떤 방법이든 벗어났습니다. 오타 같아. – JOM

답변

0

이동을하는 방법의 마지막에 다른 전에 브래킷을 원한다 다음.

if ([appDelegate.profileImages objectForKey:userName]) { 
    cell.userImage.image = [appDelegate.profileImages objectForKey:userName]; 
} else { 
    dispatch_queue_t conccurentQueue = dispatch_get_global_queue(dispatch_get_global_queue, 0); 
dispatch_async(conccurentQueue, ^{ 
    NSURL *imageURL = [NSURL URLWithString:[currentUser objectForKey:@"image.png"]]; 

    __block NSData *imageData; 

    dispatch_sync(conccurentQueue, ^{ 

     imageData = [NSData dataWithContentsOfURL:imageURL]; 

     [AppDelegate.profileImages setObject:[UIImage imageWithData:imageData] forKey:userName]; 

    }); 

    }); 
} 
0

가에 다른과 브라켓 위치를 변경하려면 '('다른 전. 여기

모든 일이다.

#import "TweetCell.h" 
#import "AppDelegate.h" 

@implementation TweetCell 

@synthesize tweetLabel = _tweetLabel; 

@synthesize userImage = _userImage; 

@synthesize usernameLabel = _usernameLabel; 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"ContentCell"; 

    TweetCell *cell = [tableView dequeueReusableCellWithIdentifier:indexPath]; 

    NSDictionary *currentTweet = [self.tweetsArray objectAtIndex:indexPath.row]; 

    NSDictionary *currentUser = [currentTweet objectForKey:@"user"]; 

    cell.usernameLabel.text = [currentTweet objectForKey:@"name"]; 

    cell.tweetLabel.text = [currentTweet objectForKey:@"text"]; 
    cell.userImage.image = [UIImage imageNamed:@"image.png"]; 

    AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate]; 

    NSString *userName = cell.usernameLabel.text; 

    if ([appDelegate.profileImages objectForKey:userName]) { 
     cell.userImage.image = [appDelegate.profileImages objectForKey:userName]; 
    } 

} 


else { 

     dispatch_queue_t conccurentQueue = dispatch_get_global_queue(dispatch_get_global_queue, 0); 
    dispatch_async(conccurentQueue, ^{ 
     NSURL *imageURL = [NSURL URLWithString:[currentUser objectForKey:@"image.png"]]; 

     __block NSData *imageData; 

     dispatch_sync(conccurentQueue, ^{ 

      imageData = [NSData dataWithContentsOfURL:imageURL]; 

      [AppDelegate.profileImages setObject:[UIImage imageWithData:imageData] forKey:userName]; 

     }); 

    }); 
}