Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'AppearanceWhenContainedIn' is deprecated

I recently installed a new Cocoapod ChameleonFramework, and right off the bat I am getting an error in the framework. It is telling me

'appearanceWhenContainedIn:' is deprecated: first deprecated in iOS 9.0 - Use +appearanceWhenContainedInInstancesOfClasses: instead

I am really not sure what to do, and this code is written in Objective-C and I really don't have much knowledge in Objective-C, I only know Swift. As a result any help would be appreciated. Here is the code that is causing the error:

#import "UIAppearance+Swift.h"

@implementation UIView (UIViewAppearance_Swift)

+ (instancetype)appearanceWhenContainedWithin: (NSArray *)containers {

NSUInteger count = containers.count;
NSAssert(count <= 10, @"The count of containers greater than 10 is not supported.");

return [self appearanceWhenContainedIn:
        count > 0 ? containers[0] : nil,
        count > 1 ? containers[1] : nil,
        count > 2 ? containers[2] : nil,
        count > 3 ? containers[3] : nil,
        count > 4 ? containers[4] : nil,
        count > 5 ? containers[5] : nil,
        count > 6 ? containers[6] : nil,
        count > 7 ? containers[7] : nil,
        count > 8 ? containers[8] : nil,
        count > 9 ? containers[9] : nil,
        nil];
}

@end

This may seem like a really simple question, but I really don't know much Objective-C, so any help with resolving this issue would help me out a lot!

like image 570
Harish Avatar asked Sep 05 '25 03:09

Harish


1 Answers

It's up the people who write this CocoaPod to keep it up to date; contact them. Meanwhile, this is not your code, so do nothing. The code will work just fine for now, so no action is called for.

like image 123
matt Avatar answered Sep 08 '25 00:09

matt