更新:ちょっと難しい部分を見つけました...このようなことをするとうまくいきます:
[_friendsArrayInBlock insertObject:@"Bla" atIndex:itemIndex];
しかし、そうではありません:
[_friendsArrayInBlock insertObject:friend atIndex:itemIndex];
カスタム オブジェクトを追加できないのに、NSString を追加できるのはなぜですか? どうしたの
元の部分: 関連するコード部分は次のとおりです。
@implementation ORGFriendsTableViewController
{
    NSMutableArray *_friendsArray;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    _friendsArray = [NSMutableArray array];
    __block NSMutableArray *_friendsArrayInBlock = _friendsArray;
    [FBRequestConnection startForMyFriendsWithCompletionHandler: ^(FBRequestConnection *connection,
                                                                   id result,
                                                                   NSError *error) {
        FBGraphObject *fbGraphObject = (FBGraphObject *)result;
        NSMutableArray *userArray = fbGraphObject[@"data"];
        for (FBGraphObject *user in userArray) {
            ORGFBUser *friend = [[ORGFBUser alloc] initWithId:user[@"id"] name:user[@"name"] andPhotoURL:@"someurl"];
            NSInteger itemIndex = 0;
            [_friendsArrayInBlock insertObject:friend atIndex:itemIndex];
            [self.tableView insertRowsAtIndexPaths:[NSArray arrayWithObject:[NSIndexPath indexPathForItem:itemIndex inSection:0]] withRowAnimation:UITableViewRowAnimationRight];
        }
    }];
}
問題は次の行に表示されます。
[_friendsArrayInBlock insertObject:friend atIndex:itemIndex];
プログラム受信シグナル「EXC_BAD_ACCESS」
ブロックの概念に関連していると思いますが、それから非スレッドセーフの NSMutableArray を変更しています。
これを修正する方法はありますか?