我已经看过相关问题here和 here ,我已经实现了建议的答案但无济于事。
我在 UIToolbar 上有一个 UIBarButtonItem,带有发送操作到 btnTBAction_touch 的连接:
在 ViewController 的类 header 中我有:
@property (nonatomic, strong) UIActivityViewController *activityViewController;
类实现中的相关方法:
- (IBAction)btnTBAction_touch:(id)sender {
NSString *string = @"Some string";
NSURL *url = [[NSURL alloc] initWithString:@"http://www.google.com"];
UIImage *image = [UIImage imageNamed:@"default.png"];
self.activityViewController = [[UIActivityViewController alloc]
initWithActivityItems:@[string, url, image] applicationActivities:nil];
if ([self.activityViewController respondsToSelector:@selector(popoverPresentationController)])
{
UIPopoverPresentationController *presentationController = [self.activityViewController
popoverPresentationController];
presentationController.sourceView = sender;
}
[self presentViewController:self.activityViewController animated:YES completion:nil];
}
在物理设备上以 Debug模式运行时,当我触摸调用上述方法的按钮时,我在调试控制台中得到以下内容
2014-09-19 09:43:31.635 TestApp[1878:237873] LaunchServices: invalidationHandler called
2014-09-19 09:43:31.644 TestApp[1878:237814] LaunchServices: invalidationHandler called
但是,与相关问题不同,我的应用程序在发生这种情况时不会崩溃,应用程序继续正常工作并且 UIActivityViewController 正确显示......但我宁愿修复错误也不愿说它足够好。
此外,我还使用这些行尝试了上述方法的一些排列:
presentationController.sourceView = self.view;
presentationController.sourceRect = self.view.frame;
这些都没有帮助解决问题。
- 我正在使用 Xcode v6.0.1
- 我的应用程序的部署目标是 7.0,仅适用于 iPhone
- 在运行 iOS 8.0 的 iPhone 5s 上进行测试
- 代码全部在 Objective-C 中
最佳答案
如果您的开发目标设备是 iPhone,您不必担心此消息。看起来这是苹果的一个错误。查看开发人员论坛:“该日志消息并未表明您有任何错误。”
参见:https://devforums.apple.com/message/1049415#1049415 (可能需要您登录)
关于ios - 当前 UIActivityViewController- LaunchServices :invalidationHandler called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25937143/