UIDropInteraction fails in simulator

I am testing a simple drag and drop interaction on the iOS 11 simulator using Xcode 9 beta 2 (9M137d).


1. The drag works fine (single image).


2. dropInteraction(_ interaction: UIDropInteraction, canHandle session: UIDropSession) is called properly in the UIDropInteractionDelegate (returns true)

ERROR: But every time I release the touch over the drop interaction target, xcode spits out an error:


PBItemCollectionServicer connection disconnected.

Has anyone gotten drag and drop working in the simulator?

Hey,


Drag and Drop works fine for me. Did you also implement the following method?


dropInteraction(_ interaction: UIDropInteraction, sessionDidUpdate session: UIDropSession) -> UIDropProposal


Dropping won't work if you don't tell the drag how dropping will be performed (and if it's even possible on that exact spot of your view).


Best,
Klemens

even implementing this for UTI type Data gives the same error in the iPad PRO simulator.


Also I noticed that this happened when there were a few views that could accept the drop then the drop will succeed if its the first view, but is the user lifts the mouse in simulator on the second or the third view then the drop would give this error


PBItemCollectionServicer connection disconnected.

I'm having the same issue in iOS 11 GM on a iPhone 7 Plus. The performDrop method isn't being called. 😢

I'm also implementing this method and the performDrop method isn't being called.

I can confirm that performDrop isn't being called in the iOS Simulator.


I'm implementing these 3 methods:


- (BOOL)dropInteraction:(UIDropInteraction *)interaction canHandleSession:(id<UIDropSession>)session API_AVAILABLE(ios(11.0))
{
  return ([session canLoadObjectsOfClass:UIImage.class]);
}

- (UIDropProposal *)dropInteraction:(UIDropInteraction *)interaction sessionDidUpdate:(id<UIDropSession>)session API_AVAILABLE(ios(11.0))
{
  return ([[UIDropProposal alloc] initWithDropOperation:UIDropOperationCopy]);
}

- (void)dropInteraction:(UIDropInteraction *)interaction performDrop:(id<UIDropSession>)session API_AVAILABLE(ios(11.0))
{
  CGPoint loc = [session locationInView:self.view];

  NSLog(@"%f, %f", loc.x, loc.y);
}


The dragged item shows the green +, but when dropping, the performDrop method isn't being called in the iOS Simulator (at the moment, I can't test on a real iPad).


Using Xcode Version 9.0.1 (9A1004).

Update:


Dropping into UIViews is working in the Simulator.


In my app, the performDrop method isn't being called in the iOS Simulator when:

- I'm dropping into a GLKView with an Open GL ES context. (when I do nothing in glkView: drawInRect:, performDrop is being called)

Problem solved in Xcode 9.1 Simulator!

I'm getting this error Xcode 12.5 Simulator iOS 14.5. Turns out I have to set in order.
Code Block
tableView.dragInteractionEnabled = true
tableView.dragDelegate = self

UIDropInteraction fails in simulator
 
 
Q