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及以前版本。

  • 相关阅读:
    Java中只有按值传递,没有按引用传递!(两种参数情况下都是值传递)
    最简单的struts实例介绍
    Spring中bean的五个作用域简介(转载)
    Spring配置文件
    轻松搞定面试中的二叉树题目 (转)
    二叉树
    稳定排序与非稳定排序判别方法
    Yii的缓存机制之动态缓存
    Yii的缓存机制之数据缓存
    Yii的缓存机制之页面缓存
  • 原文地址:https://www.cnblogs.com/hanyis/p/3540234.html
Copyright © 2011-2022 走看看