Update to recommended settings
原因:Xcode所支持的iOS版本大于工程设置的版本。
点击警告,弹出如下提示,为所有项目升级Target和Project升级版本。
或是直接在在此处逐一进行修改
Precompiled header uses DATE or TIME
解决方法:
https://github.com/ibireme/YYKit/issues/152
warning: multi-character character constant [-Wfour-char-constants]
Comparison of integers of different signs: ‘int’ and ‘NSUInteger’ (aka ‘unsigned long’)
使用数组的,count属性的时候容易出这个问题。
for (int j = 0 ; j < [emotions count]; j++) {
}
由于数组索引不可能为负数,所以count是一个无符号整形,j是一个有符号整形。类型没有同意所以出现异常,同时, NSInteger在64位上是long 在32位上是int所以还是使用long比较保险,不会出现溢出情况。
for (unsigned long j = 0 ; j < [emotions count]; j++) {
}
Implementing deprecated method
使用了Object-C垃圾回收器不支持的方法 Objective-C garbage collection is no longer supported.
Method override for the designated initializer of the superclass ‘-init’ not found
reason:
The designated initializer guarantees the object is fully initialised by sending an initialization message to the superclass. The implementation detail becomes important to a user of the class when they subclass it. The rules for designated initializers in detail:
A designated initializer must call (via super) a designated initializer of the superclass. Where NSObject is the superclass this is just [super init].
Any convenience initializer must call another initializer in the class - which eventually leads to a designated initializer.
A class with designated initializers must implement all of the designated initializers of the superclass.
解决方法:
example:
@interface MyClass : NSObject
@property(copy, nonatomic) NSString *name;
-(instancetype)initWithName:(NSString *)name NS_DESIGNATED_INITIALIZER;
-(instancetype)init;
@end
/**
then the compiler checks if the (convenience) initializer init calls the (designated) initializer initWithName:, so this would cause a warning:
*/
-(instancetype)init
{
self = [super init];
return self;
}
//and this would be OK:
-(instancetype)init
{
self = [self initWithName:@""];
return self;
}
http://stackoverflow.com/questions/32741123/objective-c-warning-method-override-for-the-designated-initializer-of-the-superc
http://stackoverflow.com/questions/26185239/ios-designated-ini