My customers reported a strange behaviour for a basic UIMenuController : when the app is installed from app store or ad hoc, the UIMenuController won't show up ! It works perfectly fine on the simulator, or when loaded directly from xcode but if I try to distribute the exact same app and install it via app store or via an ipa file, the menu is not showing up.
Where could this come from ?
I don't think it helps, but here is the code I use to display the menu controller :
UIMenuController *menuController;
NSAssert([self becomeFirstResponder], @"Sorry, UIMenuController will not work with %@ since it cannot become first responder", self);
UIMenuItem *duplicateItem = [[UIMenuItem alloc] initWithTitle:@"Duplicate" action:@selector(duplicate:)];
UIMenuItem *deleteItem = [[UIMenuItem alloc] initWithTitle:@"Delete" action:@selector(deleteButton:)];
UIMenuItem *copyItem = [[UIMenuItem alloc] initWithTitle:@"Copy" action:@selector(copySelected:)];
[menuController setMenuItems:[NSArray arrayWithObjects:duplicateItem, deleteItem, copyItem, nil]];
[menuController setArrowDirection:UIMenuControllerArrowDown];
[menuController setTargetRect:sender.frame inView:contentView];
[menuController setMenuVisible:YES animated:YES];
and :
- (BOOL) canPerformAction:(SEL)selector withSender:(id) sender
{
return [super canPerformAction:selector withSender:sender];
}
The difference between your tests and the distributed binaries is that you probably test your app in "Debug" but release in "Release".
The NSAssert might be stripped down from "Release" build, and that /could/ change the behaviour.