zoukankan      html  css  js  c++  java
  • 总结:工程编译后出现的警告解决办法

    一、 Writable atomic property 'numberOfImages' cannot pair a synthesized setter/getter with a user defined setter/getter
    这个是导入了OPenFlow包产生的,
    查找这两个文件的头文件声明获知,这两个属性声明是这样的:
    @property int number;
    @propertyint numberOfImages;
    可以有以下几种方法解决:
    1. 声明属性为nonatomic,即我上面的修改方法。
    2. @synthesize合成用getter/setter方法(即自己手动定义getter/setter方法)。
    3. 用@dynamic来代替@synthesize。
    4. 直接不用属性@property。

    二、'&&' within '||'
    问题出处:
        if (!([string characterAtIndex:0] >= '0' &&
            [string characterAtIndex:0] <= '9' || 
            [string characterAtIndex:0] == '.')) {
            return NO;
    高版本更严谨了,逻辑表达式要清晰明确,更正后
        if (!(([string characterAtIndex:0] >= '0' &&
            [string characterAtIndex:0] <= '9' )|| 
            [string characterAtIndex:0] == '.')) {
            return NO;

    三、Property's synthesized getter follows Cocoa naming convention for returning 'owned' objects
    这个出处:@synthesize newPwd;
    违犯了ARC命名规则,成员变量不要以new作为前缀。
    关于ARC规则,请参考http://mobile.51cto.com/iphone-313122.htm
    基本的ARC使用规则:
        1。代码中不能使用retain, release, retain, autorelease
        2。不重载dealloc(如果是释放对象内存以外的处理,是可以重载该函数的,但是不能调用[super dealloc])
        3。不能使用NSAllocateObject, NSDeallocateObject
        4。不能在C结构体中使用对象指针
        5。id与void *间的如果cast时需要用特定的方法(__bridge关键字)
        6 。不能使用NSAutoReleasePool、而需要@autoreleasepool块
        7 。不能使用“new”开始的属性名称 (如果使用会有下面的编译错误”Property’s synthesized getter follows Cocoa naming convention for returning ‘owned’ objects”)

    四、warning:No previous prototype for function "randomPoint"。
    你的function是在类外声明的吧,解决办法有两种:
    1.在你的function前面加上static。
    2.或者Project-Info -> TARGETS ->Build Settings -> LLVM GCC4.2 - Warnings组 -> Missing Function Prototypes   Yes改为No

    五、 warning: 'uniqueIdentifier' is deprecated 
    ios5.0已经弃用了uniqueIdentifier。如果要使用GUID,可以用apple推荐的其他办法。
    或者更改iOS deployment target:iOS4.3及以前版本。

  • 相关阅读:
    使用golang访问kubebernetes
    使用 Rancher 管理现有 Kubernetes 集群
    Running powershell scripts during nuget package installation and removal
    How to Create, Use, and Debug .NET application Crash Dumps in 2019
    寻找写代码感觉(一)之使用 Spring Boot 快速搭建项目
    Selenium+Java之解决org.openqa.selenium.InvalidArgumentException: invalid argument报错问题
    Selenium环境搭建
    关于Xpath定位方法知道这些基本够用
    Web自动化之浏览器启动
    【翻译】编写代码注释的最佳实践
  • 原文地址:https://www.cnblogs.com/hanyis/p/3540234.html
Copyright © 2011-2022 走看看