ios - 当前 UIActivityViewController- LaunchServices :invalidationHandler called

标签 ios objective-c iphone uiactivityviewcontroller

我已经看过相关问题herehere ,我已经实现了建议的答案但无济于事。

我在 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/

相关文章:

objective-c - 使用日历存储。

iphone - UIView 中的两个 UITapGestureRecognizer

ios - Xcode - presentViewController NSInvalidArgumentException : unrecognized selector sent to instance

ios - Xcode:归档 iOS 项目时无法创建符号链接(symbolic link)

ios - iOS开发中如何从.a(静态库)中提取文件?

iphone - 删除 UITableViewCells 之间的间距

ios - 在 iphone 浏览器上嵌入 Youtube 时应用 css

iOS Unity Asset Bundle 下载限制 - 粒子效果、动画和动画资源

objective-c - 收听我的文本字段的值更改

objective-c - NSMutableArray在运行时崩溃