Xcode常见警告汇总(持续更新)

原因: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]

解决方法:
http://stackoverflow.com/questions/7459939/what-do-single-quotes-do-in-c-when-used-on-multiple-characters

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++) {
 }

参考地址:
http://stackoverflow.com/questions/8350971/comparison-of-integers-of-different-signs-warning-with-xcode

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
如果您需要在 Xcode更新高德地图 SDK 的证书,您可以按照以下步骤操作: 1. 在高德开发者网站上下载最新版本的 SDK,并将其解压缩到您的项目文件夹中。 2. 在 Xcode 中,打开您的项目,并选择“Build Phases”(编译阶段)选项卡。 3. 展开“Link Binary With Libraries”(链接二进制文件库)部分,并删除高德地图 SDK 相关的库,例如 libAMapFoundationKit.a、libAMapLocation.a 等。 4. 将最新版本的高德地图 SDK 的库文件添加到您的项目中。您可以将库文件拖放到“Link Binary With Libraries”部分,或者点击“+”按钮,并选择“Add Other”(添加其他文件)选项。 5. 如果您使用了高德地图 SDK 的资源文件,例如地图样式文件或图片资源,请确保将它们添加到您的项目中。您可以将这些文件拖放到“Copy Bundle Resources”(复制捆绑资源)部分。 6. 在“Build Settings”(构建设置)选项卡中,搜索“Other Linker Flags”(其他链接器标志)设置,并确保您已添加了以下标志: ``` -ObjC -all_load ``` 7. 在“Build Settings”选项卡中,搜索“Header Search Paths”(头文件搜索路径)设置,并确保您已添加了高德地图 SDK 的头文件路径。 8. 在“Build Settings”选项卡中,搜索“Framework Search Paths”(框架搜索路径)设置,并确保您已添加了高德地图 SDK 的框架路径。 9. 最后,重新编译您的项目,并确保您已经成功更新了高德地图 SDK 的证书。 请注意,以上步骤仅适用于手动安装高德地图 SDK 的情况。如果您使用 CocoaPods 管理您的依赖项,则可以更新您的 Podfile 文件,并运行“pod update”命令来更新高德地图 SDK 的版本和证书。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值