DraggableCollectionView icon indicating copy to clipboard operation
DraggableCollectionView copied to clipboard

Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

Open pucktada opened this issue 12 years ago • 6 comments

get this error sometimes, when drag and dropping to item (can reproduce in Flowlayout Demo sometimes, cant figure out a way to consistenly make it happen yet, but i can get it to show up once per 4-5 tries). After some investigations, i think it occurs in

  • (void)warpToIndexPath:(NSIndexPath *)indexPath

in the performBatchUpdates ...

[self.collectionView performBatchUpdates:^{
    self.layoutHelper.hideIndexPath = indexPath;
    self.layoutHelper.toIndexPath = indexPath;
} completion:nil];

I dont know why though, any idea?

pucktada avatar Oct 02 '13 09:10 pucktada

me too have the same problem since i modified the completition nil and added a method didMoveItemAtIndexPath:toIndexPath

nicpro85 avatar Jan 30 '14 10:01 nicpro85

just found the solution.

        NSIndexPath * fromIndexPath = nil;
        NSIndexPath * toIndexPath   = nil;
        fromIndexPath = self.layoutHelper.fromIndexPath;
        toIndexPath   = self.layoutHelper.toIndexPath;
        // Tell the data source to move the item
        [(id<UICollectionViewDataSource_Draggable>)self.collectionView.dataSource collectionView:self.collectionView
                                                                          moveItemAtIndexPath:self.layoutHelper.fromIndexPath
                                                                                  toIndexPath:self.layoutHelper.toIndexPath];
        // Move the item
        [self.collectionView performBatchUpdates:^
        {

            [self.collectionView moveItemAtIndexPath:self.layoutHelper.fromIndexPath
                                         toIndexPath:self.layoutHelper.toIndexPath];
            self.layoutHelper.fromIndexPath = nil;
            self.layoutHelper.toIndexPath   = nil;

        } completion:^(BOOL finished)
        {
            [(id<UICollectionViewDataSource_Draggable>)self.collectionView.dataSource collectionView:self.collectionView
                                                                              didMoveItemAtIndexPath:fromIndexPath
                                                                                         toIndexPath:toIndexPath];
        }];

nicpro85 avatar Jan 30 '14 10:01 nicpro85

@ro6inhoddie @nicpro85 how did you track down this warning? I am getting this in another project and am struggling to trace it because it does not crash etc.

gconno avatar Oct 16 '14 11:10 gconno

I have issue with UIImagePickerController, when I open the camera in my app. I get message "Received Memory Warning" and then gets this message like < Snapshotting a view that has not been rendered results in an empty snapshot. Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates. >

guys please help to solve this problem

ahsolanki avatar Jun 30 '15 04:06 ahsolanki

I am also getting this in my own code now. @nicpro85- would you mind sharing how you tracked down that issue?

ohayon avatar Jul 28 '15 23:07 ohayon

Bump, me too!!!

caseyjmorton avatar Dec 11 '15 21:12 caseyjmorton