zoukankan      html  css  js  c++  java
  • 经常遇到的警告、错误,解决方法

    升级后,常常遇到的遇到的警告、错误,解决方法

    从sdk3.2.5升级到sdk 5.1中间废弃了很多的方法,还有一些逻辑关系更加严谨了。
    1,警告:“xoxoxoxo”  is deprecated
    解决办法:查看xoxoxoxo的这个方法的文档,替换掉这个方法即可。

    2,警告:Declaration of "struct sockaddr" will not be visible outside of this function
    解决办法:在你的开源.m文件中添加 #import <netinet/in.h>

    3,警告:Implicit conversion from enumeration type 'UIInterfaceOrientation' to different enumeration type 'UIDeviceOrientation'
    解决办法:类型不匹配。跳到出错的那一行,UIInterfaceOrientation强制转换为UIDeviceOrientation就行了。

    4,警告:incompatible pointer types assigning to 'MyArrayList*'from 'NSMutableArray'
    解决办法:加入强制转换(MyArrayList*)

    5,警告:'&&' within '||'
    问题出处:
        if (exists && !isDirectory || !exists)………
      解决办法: if ((exists && !isDirectory) || !exists)………

    6,警告:Warning:The Copy Bundle Resources build phase contains this target's Info.plist file
    解决办法:将Info.plist文件移到Resources目录下,而不要直接放在target下。


    7,警告:在使用ASIHttp…第三方库的,运行报错。
    解决办法:看你的项目中是否添加CFNetwork.framework、SystemConfiguration.framework, MobileCoreServices.framework,
    CoreGraphics.framework和libz.1.2.3.dylib,如果是sdk5.0以上,改添加libz.1.2.5.dylib

     8,警告:xxxooo,missing required architecture i386 in file 
    解决办法:如果是错误信息的话:
    Target->Build Settings->Search Paths, 删除FrameworkSearch Paths 里面内容就可以了。
    要只是一个警告的话,真机调试可以过。具体解决方法待大神出现。 

    9,警告:
    clang: error: no such file or directory: '/demo2/控件代码/13/Recorder/Recorder_Prefix.pch'
    clang: error: no input files
    Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/clang failed with exit code 1

    解决办法: 在你的主工程文件 target搜素,pch ,找到Prefix Header    把它后面的值,都删除,再运行就解决了。

    10,警告:
    “ARC forbids synthesizing a property of an Objective-C object with unspecified ownership or storage attribute
    解决办法:如果定义了ARC有效,那么必须要有所有者属性的定义;所以代码改成下面这样
    @property (nonatomic, strong, readonly) NSString *ss; 
    uiview 2012-10-10 12:17
    11,  错误信息:
      "_OBJC_CLASS_$  xxxxx  ", referenced from:
          objc-class-ref in ViewController.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    解决方法:
     查看工程,看是不是没有导入相关的框架。


    12,  错误信息:
    Couldn't register dy.CKRiLiText with the bootstrap server. Error: unknown error code.
    This generally means that another instance of this process was already running or is hung in the debugger.Current language:  auto; currently objective-c

    解决方法: 可能是电脑内存问题引起,重启电脑即可解决。如果重启解决不了问题,那就是你刚刚改动的代码引起的问题。

    13 、 错误信息:
    ios 5是调试正常ios 6真机调试的时候,出现如下错误:ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/mac4/Desktop/my desktop/My app/MyApp name 20:09:12  /MyApp name/ZBarSDK/libzbar.a for architecture armv7serror: linker command failed with exit code 1 (use -v to see invocation)

    解决方法:在Xcode里,点击相应的Target,然后点Build Settings,找到VALID_ARCHS,看里面的是不是arvm7s,如果不是改成arvm7s就可以了。

    14 、 错误信息:
     error: receiver type 'ViewController' for instance message does not declare a method with selector 'hideSearchBar:' [4]
    ViewController 中没有声明一个方法选择'hideSearchBar:

    解决方法:
    在ViewController .h 中声明一下这个方法 “ hideSearchBar ”  即可。

    15、 错误信息:当json从服务端请求时得到的字符串,如果这样写的话,会报错,';' after top level declarator
    NSString *ss= @"{"recommend":"世界末日","
    dogname":"机器人"}";   

    解决方法:
    就是,把   “   替换成  \"  即可。
    NSString *ss= @"{ \"recommend \": \"世界末日 \", \"dogname \": \"机器人 \"}";  


    湘南七少 2012-10-10 16:52
    3q,先阅读明天升级.哎界面修改一大堆
    uiview 2012-10-16 15:03
    31警告:
     warning: Semantic Issue: Incompatible integer to pointer conversion assigning to 'BOOL *' (aka 'signed char *') from 'BOOL' (aka 'signed char')

    解决办法: 检查 BOOL *换为BOOL就可以了,多写一个   *  号。
    Xcode升级到4.4后,出现了一堆的Warning.网上搜了一些办法,总结一下。

    32:Jsonkit中的

    Direct access to objective-c's isa is deprecated in favor of object_setClass() and object_getClass()
    object->isa 替换为 object_getClass(object)
    keyObject->isa 替换为 object_getClass(keyObject)
    (id)keys[idx]->isa 替换为 object_getClass((id)keys[idx])

    format specifies type 'unsigned long' but the argument has type 'nsuinteger' (aka 'unsigned int')
    给变量增加(unsigned long)进行类型转换


    33:md5加密(iOS SDK中自带了CommonCrypto)

    Implicit declaration of function 'CC_MD5' is invalid in C99

    [plain] view plaincopy

        #define CC_MD5_DIGEST_LENGTH 16  
        +(NSString *)MD5HashForString:(NSString *)input {  
            const char *cStr = [input UTF8String];  
            unsigned char result[CC_MD5_DIGEST_LENGTH];  
            CC_MD5(cStr, strlen(cStr), result);  
            return [NSString stringWithFormat: @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",  
                    result[0], result[1], result[2], result[3],  
                    result[4], result[5], result[6], result[7],  
                    result[8], result[9], result[10], result[11],  
                    result[12], result[13], result[14], result[15]];  
        }  

    引入函数定义的头文件

    #import <CommonCrypto/CommonDigest.h>


    34:ASIDataDecompressor中的警告

    format specifies type  'short' but the  argument has type 'int'

    在+ (NSError *)deflateErrorWithCode:(int)code 和 +(NSError *)inflateErrorWithCode:(int)code中

    [NSString stringWithFormat:@"Compression of data failed with code %hi",code] 中

    将code改为 (short)code,类型转换


    35:Reachability中警告

    Using 'stringWithString:' with a literal is redundant

    statusString = [NSString stringWithString: @"Not Reachable"]; 

    改为:statusString = @"Not Reachable";


    36.format specifies type 'id' but the argument has type 'const char *'

    NSCAssert(NO, @"Unhandled error encountered during SAX parse. msg is %@", msg);
    改为:NSCAssert(NO, @"Unhandled error encountered during SAX parse. msg is %@", [NSString stringWithUTF8String:msg]);

    uiview 2012-11-30 10:58
    41,错误

    Error launching remote program: failed to get the task for process   

    解决方法:
    把真机上的软件,删除,然后,clean 一下,重新运行就可以了。

            
    42,真机调试的时候,出现   [attachment=49364]   这正常,但是不识别机器的。

    解决方法:

    把 , [attachment=49365] 设置为以上相对应的版本就可以了。

    43,真机调试的时候,出现   ios Broken pipe

    解决方法:
    :推出xcode
    :断开机器(iphone,ipad,ipod)链接
    :重启iPhone在联接xcode,就可以了。
  • 相关阅读:
    字符串右移n位(C++实现)
    字符串反转实现(C++)
    MSDN无法显示该页的解决办法
    设计模式——单例模式 (C++实现)
    设计模式——工厂模式 (C++实现)
    设计模式课程 设计模式精讲 24-2 中介者模式coding
    设计模式课程 设计模式精讲 25-1 责任链模式讲解
    设计模式课程 设计模式精讲 23-3 命令模式源码解析
    设计模式课程 设计模式精讲 23-2 命令模式coding
    设计模式课程 设计模式精讲 22-3 备忘录模式源码解析
  • 原文地址:https://www.cnblogs.com/worldtraveler/p/2830945.html
Copyright © 2011-2022 走看看