2

Erro:

Assertion failure in -[UICGColor encodeWithCoder:], /SourceCache/UIKit/UIKit-2372/UIColor.m:1191 2012-11-15 14:17:45.531 Neemu Clothes[15179:4d07] Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only support RGBA or the White color space, this method is a hack.' * First throw call stack: (0x363272a3 0x32afe97f 0x3632715d 0x37a492af 0x36c793c5 0x379ec00f 0x379eb8b5 0x36dac72d 0x36daba7b 0x3632462f 0x36dab7f5 0x36e895e5 0x36e17cd7 0x36e17b6d 0x3506890f 0x36e17a61 0x36e210d5 0x3505b83b 0x36e210b1 0x3505b11f 0x3505a99b 0x3505a895 0x35069215 0x350693b9 0x357f8a11 0x357f88a4) libc++abi.dylib: terminate called throwing an exception

Code:

BOOL displayedNativeDialog = [FBNativeDialogs presentShareDialogModallyFrom:self initialText:@"NeeemuG - Veja meu look." image:nil url:[NSURL URLWithString:@"https://www.neemu.com"] handler:^(FBNativeDialogResult result, NSError *error) {

        // Only show the error if it is not due to the dialog
        // not being supporte, i.e. code = 7, otherwise ignore
        // because our fallback will show the share view controller.
        if (error && [error code] == 7) {
            return;
        }

        NSString *alertText = @"";
        if (error) {
            alertText = [NSString stringWithFormat:
                         @"error: domain = %@, code = %d",
                         error.domain, error.code];
        } else if (result == FBNativeDialogResultSucceeded) {
            alertText = @"Posted successfully.";
        }
        if (![alertText isEqualToString:@""]) {
            // Show the result in an alert
            [[[UIAlertView alloc] initWithTitle:@"Result"
                                        message:alertText
                                       delegate:self
                              cancelButtonTitle:@"OK!"
                              otherButtonTitles:nil]
             show];
        }
    }];

    // Fallback, show the view controller that will post using me/feed
    if (!displayedNativeDialog) {
        NSLog(@"No IOS6.");
    }
kmatyaszek
  • 19,016
  • 9
  • 60
  • 65
abraaoan
  • 104
  • 1
  • 4

4 Answers4

2

In my delegate i put [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"background"]] to background navigation bar, i dont know why this crash, but when i remove resolve the problem.

abraaoan
  • 104
  • 1
  • 4
1

I had the same problem and it seems (obviously) linked with the method [UIColor colorWithPatternImage:image];

So, I suggest to check each method that call colorWithPatternImage and comment each line that call that method one by one to find out the source.

For my case, it was the colorWithPatternImage on the UIPageControl in my AppDelegate.

A lot of question is about this problem. Example : UIApperance and various crashes or iOS 6 MFMailComposeViewController: Only support RGBA or the White color space, this method is a hack

Community
  • 1
  • 1
Hugo
  • 295
  • 2
  • 15
1

For me this error was caused by the appearance settings on UITextField and UISwitch.

I have an abstract view controller subclass, which all of my view controllers inherit from, so I just specified to only set the appearance in my views that inherit from this view controller.

Like so:

[[UITextField appearanceWhenContainedIn:[BaseViewController class], nil] setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bkg"]]];
[[UISwitch appearanceWhenContainedIn:[BaseViewController class], nil] setOnTintColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"bkg"]]];
Mark Bridges
  • 8,228
  • 4
  • 50
  • 65
0

I had the same problems and I fixed that by subclassing components. My case was:

UIColor *bkg = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bkg"]];
[[UICollectionView appearance] setBackgroundColor:bkg];

When I was trying to post something on facebook I received error, but then I created simple subclass of UICollectionView - let's name it MyGridView. So after modification my code was:

UIColor *bkg = [UIColor colorWithPatternImage:[UIImage imageNamed:@"bkg"]];
[[MyGridView appearance] setBackgroundColor:bkg];

Then I changed views in storyboards to use custom component class MyGridView instead of default UICollectionView and everything worked - I had background I wanted and was able to post on facebook.

I think if your problem is similar to mine you could try this approach and subclass components you need (if they are intended to be subclassed of course).

Best regards

bart
  • 186
  • 2
  • 4