Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
308 views
in Technique[技术] by (71.8m points)

objective c - Xcode 5 Ghost error

I am getting an error But I am not sure why I am getting it. It wants a '(' before else.

Here is the whole thing.

#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];

        });

    });
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Move the bracket before the else to the end of the method


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...