2013-01-10 45 views
-1

我正在关注如何运行FQL查询(https://developers.facebook.com/docs/howtos/run-fql-queries-ios-sdk/)这个美丽的教程,但不幸的是我有一个意想不到的问题,我我不知道如何解决。我能够遵循拉数据并继续下去,直到第三步(在实现它之后,程序崩溃),我已经通过我的程序来查看我是否犯了错误,但是我没有看到任何错误。在这种情况下,有人可以给我一个关于如何修理插座的建议吗?谢谢。加载了“FriendViewController”笔尖,但未设置视图插口。'

FriendViewController.h

#import <UIKit/UIKit.h> 

@interface FriendViewController : UITableViewController 
@property (strong, nonatomic) NSArray *data; 
@end 

FriendViewController.m

#import "FriendViewController.h" 

@interface FriendViewController() 
@property (strong, nonatomic) UIToolbar *toolbar; 
@end 

@implementation FriendViewController 

@synthesize data = _data; 
@synthesize toolbar = _toolbar; 

- (id)initWithStyle:(UITableViewStyle)style 
{ 
    self = [super initWithStyle:style]; 
    if (self) { 
     // Custom initialization 
    } 
    return self; 
} 

- (void)viewDidLoad 
{  

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller. 
    // self.navigationItem.rightBarButtonItem = self.editButtonItem; 
    // Add a toolbar to hold a Done button that will dismiss this view controller 
    self.toolbar = [[UIToolbar alloc] init]; 
    self.toolbar.barStyle = UIBarStyleDefault; 
    [self.toolbar setAutoresizingMask:UIViewAutoresizingFlexibleWidth]; 
    [self.toolbar sizeToFit]; 

    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] 
            initWithBarButtonSystemItem:UIBarButtonSystemItemDone 
            target:self 
            action:@selector(doneButtonPressed:)]; 

    UIBarButtonItem *space = [[UIBarButtonItem alloc] 
           initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
           target:nil 
           action:nil]; 

    self.toolbar.items = [NSArray arrayWithObjects:space, doneButton, nil]; 
    [super viewDidLoad]; 


} 

- (void)didReceiveMemoryWarning 
{ 
    [super didReceiveMemoryWarning]; 
    // Dispose of any resources that can be recreated. 
} 

#pragma mark - Table view data source 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
{ 
    // Return the number of sections. 
    return 1; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section 
{ 

    // Return the number of rows in the section. 
    return [self.data count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView 
     cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    static NSString *CellIdentifier = @"Cell"; 
    UITableViewCell *cell = 
    [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) { 
     cell = [[UITableViewCell alloc] 
       initWithStyle:UITableViewCellStyleDefault 
       reuseIdentifier:CellIdentifier]; 
    } 
    cell.textLabel.text = [[self.data objectAtIndex:indexPath.row] 
          objectForKey:@"name"]; 
    UIImage *image = [UIImage imageWithData: 
         [NSData dataWithContentsOfURL: 
         [NSURL URLWithString: 
         [[self.data objectAtIndex:indexPath.row] 
         objectForKey:@"pic_square"]]]]; 
    cell.imageView.image = image; 

    return cell; 
} 
/* 
// Override to support conditional editing of the table view. 
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // Return NO if you do not want the specified item to be editable. 
    return YES; 
} 
*/ 

/* 
// Override to support editing the table view. 
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    if (editingStyle == UITableViewCellEditingStyleDelete) { 
     [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; 
    } 
    else if (editingStyle == UITableViewCellEditingStyleInsert) { 
    } 
} 
*/ 

/* 
// Override to support rearranging the table view. 
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath 
{ 
} 
*/ 

/* 
// Override to support conditional rearranging of the table view. 
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // Return NO if you do not want the item to be re-orderable. 
    return YES; 
} 
*/ 

#pragma mark - Table view delegate 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // Navigation logic may go here. Create and push another view controller. 
    /* 
    <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil]; 
    // ... 
    // Pass the selected object to the new view controller. 
    [self.navigationController pushViewController:detailViewController animated:YES]; 
    */ 
} 

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 
{ 
    return self.toolbar; 
} 

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section 
{ 
    return self.toolbar.frame.size.height; 
} 
- (void)doneButtonPressed:(id)sender 
{ 
    // Dismiss view controller based on supported methods 
    if ([self respondsToSelector:@selector(presentingViewController)]) { 
     // iOS 5+ support 
     [[self presentingViewController] dismissModalViewControllerAnimated:YES]; 
    } else { 
     [[self parentViewController] dismissModalViewControllerAnimated:YES]; 

    } 
} 
@end 
+0

您必须发布崩溃信息时显示它。 (就像在xcode下半部分,它应该说像访问错误或其他东西) – Pochi

回答

0

FriendViewController.xib,从文件的所有者自己的实际来看view连接已断开连接或从未连接第一名。而不是成为一个朋友,并加载一个视图,UIViewController将您的应用程序与一个异常(漂亮)。

相关问题