When I call this method locally, the animation works fine. When it's called from another class however, I get a Thread 1 SIGABRT error: "Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]'"
- (void)test{
animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view];
settings_snap_behaviour = [[UISnapBehavior alloc] initWithItem:_orange_ball snapToPoint:CGPointMake(64, 237)];
UIDynamicItemBehavior *ballBehavior = [[UIDynamicItemBehavior alloc] initWithItems:@[_orange_ball]];
ballBehavior.elasticity = 1.0;
[animator addBehavior:ballBehavior];
[animator addBehavior:settings_snap_behaviour];
}
The actual method call is working, as I replaced the guts of the method with an NSLog and it worked fine. From my testing, it seems to be specifically related to initWithItems:@[_orange_ball]
Why would it work locally but not when called from another class? I think I'm missing something obvious.