Skip to content
This repository has been archived by the owner on Oct 31, 2019. It is now read-only.

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. #27

Open
pucktada opened this issue Oct 2, 2013 · 6 comments

Comments

@pucktada
Copy link

pucktada commented Oct 2, 2013

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?

@nicpro85
Copy link

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

@nicpro85
Copy link

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

@gconno
Copy link

gconno commented Oct 16, 2014

@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.

@ahsolanki
Copy link

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

@ohayon
Copy link

ohayon commented Jul 28, 2015

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

@caseyjmorton
Copy link

Bump, me too!!!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants