Typically you put this register line in the viewDidLoad or some sort of initialize so that it is not called over and over again. But mainly you have some confusion. You register a class for the header but you dequeue a class on the footer. You should register a class for both and dequeue the right one for each.
Notice your register uses UICollectionElementKindSectionHeader:
[self.collectionView registerClass:[UICollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"header"];
Notice your dequeue uses UICollectionElementKindSectionFooter :
UICollectionReusableView *supplementaryView = [self.collectionView dequeueReusableSupplementaryViewOfKind:UICollectionElementKindSectionFooter withReuseIdentifier:@"header" forIndexPath:indexPath];
hope that helps.