xcode BSXPCMessage 收到消息错误:连接中断

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26065808/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 05:42:37  来源:igfitidea点击:

BSXPCMessage received error for message: Connection interrupted

iosobjective-cxcodeuiimageviewxcode6

提问by Aggressor

UPDATE: Reference #19285042 and submit bug reports to apple

更新:参考 #19285042 并向苹果提交错误报告

Very weird error and not finding anything online. Its saying "BSXPCMessage received error for message: Connection interrupted"

非常奇怪的错误,在网上找不到任何东西。它说“BSXPCMessage 收到消息错误:连接中断”

I'm just doing some basic filter applications. The error message ONLY occurs if I reassign the UIImageView.image to another UIImage. If I comment out just that line I will not get the error. So if you can think of any reason why this message appears when I assign a filtered image to a UIImageView that would be incredibly helpful.

我只是在做一些基本的过滤器应用程序。仅当我将 UIImageView.image 重新分配给另一个 UIImage 时才会出现错误消息。如果我只注释掉那一行,我就不会收到错误消息。因此,如果您能想到当我将过滤后的图像分配给 UIImageView 时出现此消息的任何原因,那将非常有用。

If you can suggest any cause for this error I would appreciate it.

如果您能提出此错误的任何原因,我将不胜感激。

#import "FilterTestsViewController.h"

@interface FilterTestsViewController ()

@end

@implementation FilterTestsViewController

UIImage* _originalImage;
UIImage* _filterImage;
UIImageView* _uiImageView;

- (void)viewDidLoad
{
    [super viewDidLoad];
    [self initialize];
    //flip image by 180*

}

-(void)initialize
{
    _originalImage = [UIImage imageNamed:@"ja.jpg"]; //creates image from file, this will result in a nil CIImage but a valid CGImage;
    [self createFilterImage];
    _uiImageView = [[UIImageView alloc] initWithImage:_filterImage]; //creates a UIImageView with the UIImage
    [self.view addSubview:_uiImageView]; //adds the UIImageView to view;
}

-(void)createFilterImage
{
    NSString* filterName = @"CIFalseColor";
    CIImage* ciImage = [CIImage imageWithCGImage:_originalImage.CGImage];
    CIFilter* filter = [CIFilter filterWithName:filterName keysAndValues:kCIInputImageKey,ciImage, nil];
    _filterImage = [UIImage imageWithCIImage:[filter outputImage]];
}

@end

采纳答案by lswank

The message you are getting is due to a CIFilter bug in iOS 8.

您收到的消息是由于 iOS 8 中的 CIFilter 错误造成的。

XPC Services are meant to reduce crashes by isolating less stable componentssuch as filters and plugins. This is usually not fatal and the connection will be restored by launchd restarting the service. Since this is not a long running service, but simply an operation, chances are that your image filter is not actually being applied.

XPC 服务旨在通过隔离不太稳定的组件(例如过滤器和插件)来减少崩溃。这通常不是致命的,连接将通过 launchd 重新启动服务来恢复。由于这不是一项长期运行的服务,而只是一项操作,因此您的图像过滤器可能实际上并未被应用。

This is very much a bug in iOS 8, and you shouldfile a Radar(bug report) to let Apple know that (yet another piece of) iOS 8 has a bug.

这在很大程度上是 iOS 8 中的一个错误,您应该提交Radar(错误报告)让 Apple 知道(又一个)iOS 8 有一个错误。

If you are going to do that, you should install Quick Radar, keep track of the Radar number, and reply to the many other similar questions on Stack Overflow with the same issue. Encourage other people to file a duplicate Radar report referencing your original issue. That will give the bug more attention at Apple.

如果您打算这样做,您应该安装Quick Radar,跟踪雷达编号,并在 Stack Overflow 上以相同的问题回复许多其他类似问题。鼓励其他人提交一份重复的 Radar 报告,引用您的原始问题。这将使苹果更加关注该漏洞。

Apple really rushed this one out. The previously mentioned workaroundis fine if you can make a different CIFilter subclass do what you want. Otherwise, you will just have to tinker around with copying the image, saving its NSData representation, or otherwise removing it from the CIImage workflow in some other way.

苹果真的把这个赶出去了。在前面提到的解决方法是好的,如果你能做出不同的CIFilter子做你想做的。否则,您将只需要修改图像,保存其 NSData 表示,或者以其他方式将其从 CIImage 工作流中删除。

回答by coco

From reading a raywenderlicharticle, I found that adding an option to the context, so that rendering is done in the CPU rather than the GPU, will remove the warning.

通过阅读raywenderlich文章,我发现向上下文添加一个选项,以便在 CPU 而非 GPU 中完成渲染,将消除警告。

let context = CIContext(options:[kCIContextUseSoftwareRenderer : true])

let context = CIContext(options:[kCIContextUseSoftwareRenderer : true])

回答by Albert Renshaw

For me the issue was occurring when I would try to use CIFilters in iOS8+ for some reason?

对我来说,当我出于某种原因尝试在 iOS8+ 中使用 CIFilters 时出现了这个问题?

I added some code to check iOS version and if it was greater than 7.9.9 I would use a CIFilter substitute that's iOS8+ like: https://stackoverflow.com/a/24083728/2057171

我添加了一些代码来检查 iOS 版本,如果它大于 7.9.9,我将使用 iOS8+ 的 CIFilter 替代品,例如:https://stackoverflow.com/a/24083728/2057171

On a separate side-note, xCode6 had removed CIFilter framework from my project altogether (strange), but adding it back didn't fix this crash...

在一个单独的旁注中,xCode6 已经从我的项目中完全删除了 CIFilter 框架(奇怪),但是重新添加它并没有解决这个崩溃问题......

回答by Zaid Pathan

This worked for me:

这对我有用:

OBJ-C

OBJ-C

CIContext *context = [CIContext contextWithOptions:@{kCIContextUseSoftwareRenderer:@(YES)}];

Swift

迅速

let context = CIContext(options:[kCIContextUseSoftwareRenderer : true])

Ref: https://stackoverflow.com/a/29872829/3411787

参考:https: //stackoverflow.com/a/29872829/3411787