cruffenach / CRToast

A modern iOS toast view that can fit your notification needs
MIT License
4.17k stars 463 forks source link

CRToast is error in horizontal screen~! please help me. #196

Open danwey opened 8 years ago

dmiedema commented 8 years ago

Can you provide more details and a screenshot of what is going wrong?

danwey commented 8 years ago

code in: case CRToastAnimationTypeGravity: { UIView notificationView = notification.notificationView; UIView statusBarView = notification.statusBarView;

        [notification initiateAnimator:_notificationWindow.rootViewController.view];
        [notification.animator removeAllBehaviors];
        UIGravityBehavior *gravity = [[UIGravityBehavior alloc] initWithItems:@[notificationView, statusBarView]];
        gravity.gravityDirection = notification.inGravityDirection;
        gravity.magnitude = notification.animationGravityMagnitude;
        NSMutableArray *collisionItems = [@[notificationView] mutableCopy];
        if (notification.presentationType == CRToastPresentationTypePush) [collisionItems addObject:statusBarView];
        UICollisionBehavior *collision = [[UICollisionBehavior alloc] initWithItems:collisionItems];
        collision.collisionDelegate = self;
        [collision addBoundaryWithIdentifier:kCRToastManagerCollisionBoundryIdentifier
                                   fromPoint:notification.inCollisionPoint1
                                     toPoint:notification.inCollisionPoint2];
        UIDynamicItemBehavior *rotationLock = [[UIDynamicItemBehavior alloc] initWithItems:collisionItems];
        rotationLock.allowsRotation = NO;
        [notification.animator addBehavior:gravity]; //Thread 1:signal SIGABRT
        [notification.animator addBehavior:collision];
        [notification.animator addBehavior:rotationLock];
        self.gravityAnimationCompletionBlock = inwardAnimationsCompletionBlock;
    } break;

output: 2016-03-25 09:42:33.178 newf2o[745:279004] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid size {568, 0} for item <CRToastView: 0x12d685600; frame = (0 0; 568 0); autoresize = W; userInteractionEnabled = NO; layer = <CALayer: 0x12d68ba90>> in Dynamics' * First throw call stack: (0x18199ee38 0x181003f80 0x18199ed08 0x182324124 0x18749cc78 0x1874a234c 0x1874a2ba0 0x187499fb4 0x187499d38 0x10013f12c 0x10013e41c 0x10013d968 0x10013a614 0x10013a4f4 0x1000f1260 0x1000f16e0 0x1000fbfa8 0x10011e1d4 0x100349a7c 0x100349a3c 0x10034f4e4 0x181954dd8 0x181952c40 0x18187cd10 0x183164088 0x186b51f70 0x1000f5c24 0x18141a8b8) libc++abi.dylib: terminating with uncaught exception of type NSException

在 2016年3月24日,下午10:57,Daniel Miedema notifications@github.com 写道:

Can you provide more details and a screenshot of what is going wrong?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/cruffenach/CRToast/issues/196#issuecomment-200872444

dmiedema commented 8 years ago

Right, but without any more context than that such as the code generating it, it makes it really hard for us to debug what is going on. There are known issues with the gravity type (https://github.com/cruffenach/CRToast/issues/154, https://github.com/cruffenach/CRToast/issues/141) so without more context it'll make figuring out what is going on really difficult.

For example, are you using a custom content view? Defining the size specifically? Any specific details about your use or specific implementation you can provide will make it a ton easier for us to figure out what is going on