I'm updating my code from iOS 8 to iOS 9+, and in Xcode 8.2 I'm getting these warnings and have no idea how to fix it. I've seen a couple SO posts from a few years ago suggesting the solution is to silence the compiler rather than adjust the code.
What is the best way to handle these warnings without jeopardizing acceptance in the App Store?
One thing to note that is not in the screenshot but is in the same file - this initializer:
-(instancetype)initWithCoder:(NSCoder*)decoder{
if(self=[super init]){
// If parent class also adopts NSCoding, replace [super init]
// with [super initWithCoder:decoder] to properly initialize.
text=[decoder decodeObjectForKey:@"text"];
fontname=[decoder decodeObjectForKey:@"font"];
}
return self;
}
This is the accompanying Message.h:
#import <Foundation/Foundation.h>
@interface Message : NSObject <NSCoding>{
NSString *text;
NSString *fontname;
UIColor *color;
NSInteger speed;
NSInteger fontsize;
BOOL isMirror;
BOOL isReverse;
NSInteger transStyle;
NSInteger transDir;
NSInteger transSpeed;
BOOL isTransition;
BOOL isTextOnly;
NSInteger transOther;
NSInteger transPause;
}
@property (nonatomic,retain)NSString *text;
@property (nonatomic,retain)NSString *fontname;
@property (nonatomic,retain)UIColor *color;
@property (nonatomic,assign)NSInteger speed;
@property (nonatomic,assign)NSInteger fontsize;
@property (nonatomic,assign)BOOL isMirror;
@property (nonatomic,assign)BOOL isReverse;
@property (nonatomic,assign)NSInteger transStyle;
@property (nonatomic,assign)NSInteger transDir;
@property (nonatomic,assign)NSInteger transSpeed;
@property (nonatomic,assign)NSInteger transOther;
@property (nonatomic,assign)NSInteger transPause;
@property (nonatomic,assign)BOOL isTransition;
@property (nonatomic,assign)BOOL isTextOnly;
- (void) encodeWithCoder:(NSCoder*)encoder;
- (instancetype) initWithCoder:(NSCoder*)decoder NS_DESIGNATED_INITIALIZER;
@end