45

UPDATE: Reference #19285042 and submit bug reports to apple

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

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.

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
Cœur
  • 37,241
  • 25
  • 195
  • 267
Aggressor
  • 13,323
  • 24
  • 103
  • 182
  • I got the same error in XCode 6 also using CIFilters in a very similar manner. I've never seen BSXPC before though, and I don't know what it is. I found this gist displaying the same problem in a very different context: https://gist.github.com/saurabh360/19d739e3c0ccee1caf34 – michaelsnowden Sep 28 '14 at 22:28
  • I have no clue, but if I turn something up I'll answer this. – Aggressor Oct 02 '14 at 19:28
  • This has something to do with memory in ios 8. When I run the same code through Xcode 5 and ios 7, I get a memory warning, but for whatever reason it's not being generated in ios 8. The memory profiler through Xcode 6 also doesn't show increased memory usage. So, I'm not quite sure what the story is. – puzzl Oct 09 '14 at 15:44
  • For me this issue is happening when using CIContext in iOS8. Commented out that code and returned the image without CI manipulation (such as Gaussian blur) and it ran fine. – Albert Renshaw Dec 11 '14 at 22:19
  • This is pretty bad! Couldn't find the issue at Apple bug reporter, issued mine as #20384576 FWIW. – jlapoutre Apr 01 '15 at 17:25

4 Answers4

39

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

XPC Services are meant to reduce crashes by isolating less stable components such 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.

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

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.

Apple really rushed this one out. The previously mentioned workaround is 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.

Community
  • 1
  • 1
lswank
  • 2,471
  • 1
  • 24
  • 21
  • 1
    I did and they stopped replying. But I do appreciate the extra info! – Aggressor Dec 14 '14 at 10:01
  • Would you mind giving us the Radar bug number? I'll edit this question so that it contains the solution, which will be, "File a duplicate Radar referencing this original Radar." Then you can choose this as the "Solution". This will get other people to file a duplicate Radar, getting Apple's attention. – lswank Dec 14 '14 at 17:28
  • I added my number for the bug report – Aggressor Dec 17 '14 at 22:48
  • 3
    Any news if this bug has been fixed? I'm experiencing similar issues to the poster. – JH95 Jan 29 '15 at 20:17
  • I also have a similar problem using CIFilters with OpenGLES. Any solutions posted? – noobsmcgoobs Jun 23 '15 at 05:55
5

From reading a raywenderlich article, 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.

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

coco
  • 2,998
  • 1
  • 35
  • 58
2

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

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

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

Community
  • 1
  • 1
Albert Renshaw
  • 17,282
  • 18
  • 107
  • 195
  • I just had this come up when the Game Center GKMatchmaker dialog appeared. That's Apple's own dialog, and I guess they're doing something that CI didn't like. – BGreenstone Apr 14 '15 at 12:13
  • Looking back on this I was able to make actual CIFilters work, i just had to code them a different way, I dont remember what I did, it was a while back, but I think it had to do with not running the CIFilter on the main thread or something (which you could do in iOS7 but they stopped you from doing in iOS8 for some reason). – Albert Renshaw Jun 19 '15 at 22:28
0

This worked for me:

OBJ-C

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

Swift

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

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

Community
  • 1
  • 1
Mohammad Zaid Pathan
  • 16,304
  • 7
  • 99
  • 130