zoukankan      html  css  js  c++  java
  • OC Xcode中常见的错误

    在开发的过程中难免会遇到很多的错误,可是当看到系统给出的英文时,又不知道是什么意思。所以这篇文章总结了Xcode中常见的一些英文单词及词组,可以帮助初学的人快速了解给出的提示。多练习,就肯定能基本掌握。

    expression:表达式

    assignable:赋值
    variable:变量+
    redefinition:重复定义
    type:类型
    conflicting:冲突项
    invalid:无效的
    conversion:转换
    specifier:说明符
    indent:缩进
    operands:运算对象、操作数
    binary:二进制
    expected:期望
    logical:逻辑
    const :常量
    constant:常量
    statements:语句
    initialization:初始化
    condition:条件
    increment:增量
    index:索引、下标
    abbrev:简写、缩写
    alias:别名,化名
    modified:修改/改进的
    parameter:参数
    implicit:隐含的
    undo:取消
    redo:重做
    cancel:取消
    octal:八进制的
    incompatible:不匹配的
    duplicate:重复
    action:行为
    instance:实例
    modify:修改
    general:普通的   in general:大体,一般来说
    subclass:子类
    superclass:父类
    inherit:继承
    contents:内容
    primitive:原始的
    modify:修改
    ordered:有序的
    collection:集合
    dynamic:动态的
    querying:查询
    deriving:派生
    description:描述,描写
    collection:集合
    programmatic:编程的
    a set of:一系列、一组
    overview :概述
    related 相关的
    declared in:声明在...(文件里)
    availability:可用的
    framework:框架、类库
    Conforms to:服从....协议
    Conforms :服从
    dynamic:动态
    term:条目
    exact:确切的
    membership:成员
    entry:条目
    consists of:由...组成
    unique:独特的、唯一的
    determined:决定
    conform to:服从,遵照
    protocol:协议
    distinct:不同的、独特的
    addition:添加、增加
    literals:字面量
    denote:表示,指示
    category:类目、分类
    concrete:具体的
    decouples:解耦
    KVC:Key-Value Coding:键值对编码

    Getting Numeric Values:获得一个数值
    Identifying and Comparing Strings:识别和比较字符串
    Replacing Substrings:替换子串
    Finding Characters and Substrings:查找字符和子串
    Dividing Strings:分割字符串
    Combining Strings:拼接字符串
    Getting C Strings:得到c语言的字符串
    Getting Characters and Bytes:获取字符或字节
    Getting a String’s Length:得到字符串的长度
    Writing to a File or URL:把内容写到一个文件或者URL里
    Creating and Initializing a String from a File:从文件里创建并初始化一个字符串
    Deprecated:弃用
    Creating and Initializing Strings:创建初始化字符串
    tasks:功能
    Adopted Protocols:采用的/服从的协议 

    1: local declaration “XXX”hide instance variable

    reason:一般是你函数里面定义的变量和class属性变量重名了。很少有和系统变量重名的情况。 这样的情况,修改一下变量的名字就好。

    2、Undefined symbols for architecture x86_64:

     可能由于某些类库不支持64位Architecture造成,

     可以在项目Build Setting=》Architecture设为非64位的选项

     

    3、编译warning:ld: warning: directory not foundfor option

     

     选择工程, 编译的 (targets)

     选择 Build Settings 菜单

     查找 Library Search Paths 和 Framework Search Paths删掉编译报warning的路径即OK

     

    4、Undefined symbols for architecture armv7s: “_OBJC_CLASS_$_SZAdWebViewDelegate”, referenced from:xxxx

     查找了半天,总以为缺少某个文件,后对比正常的sample发现问题出在armv7s,这是针对iPhone5 cpu优化的编译,可能你某个库不支持,解决方法是:

     Build Setting->Build Active Architecture only 的值由NO设为YES,查了一下这个选项的资料:

     

     这个属性设置为yes,是为了debug的时候编译速度更快,它只编译当前的architecture版本。

     而设置为no时,会编译所有的版本。

     这个是设备对应的architecture

     armv6:iPhone 2G/3G,iPod1G/2G

     armv7:iPhone 3GS/4/4s,iPod3G/4G,iPad1G/2G/3G

     armv7s:iPhone5, iPod5

     编译出的版本是向下兼容的(不太对,应该说,设备是向下兼容的),比如你设置此值为yes,用iphone4编译出来的是armv7版本的,iphone5也可以运行,但是armv6的设备就不能运行。

     所以,一般debug的时候可以选择设置为yes,release的时候要改为no,以适应不同设备。

     

    5、Xcode “Attaching to…” 卡住,模拟器停留在启动界面

     网上有很多方法,什么Clean Build Folder,和各种删除,但有一个点是优先要考虑的,就是host没有修改过,修复如下:

     

     

     

     

     

    1、error: macro names must be identifiers YourProject_prefix.pch

    原因: 因为你弄脏了预处理器宏,在它处于<Multiple Values>的时候修改了它

    解决方法: Configiration选择All Configirations,清空它 然后分别重新定义你的Debug,Release,Distributin预处理器宏吧

    2、warning: no rule to process file '$(PROJECT_DIR)/LoadingView.h' of type sourcecode.c.h for architecture armv6

    原因: Target里Compile Sources里含有头文件 了,那里面不需要头文件

    解决方法: 从Target里Compile Sources里删除头文件

    3、Command /Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Plug-ins/iPhoneOS Build System Support.xcplugin/Contents/Resources/copypng failed with exit code 1

    原因: png图像文件拷贝失败,看看信息上面提示Can't find哪个文件,一般都是从文件系统里删除文件而没有通过Xcode删除造成的,Xcode的项目配置文件依然纪录着这个文件的引用

    解决办法: 给文件系统里增加相应的文件,或者从Xcode的Groups & Files删除它,或者从Target的Copy Bundle Resources里删除它

    4、Code Sign error: The identity 'iPhone Developer: Your Name' doesn't match any valid certificate/private key pair in the default keychain

    原因: 签名错误

    解决办法: Target -> Get Info -> Build -> Code Signing -> 修改签名

    记得左上角的Configuration类型要跟当前Build类型对应(Debug, Release, Distribution),否则改了也白改

    5、could not create bundle folder for versioned model *.moda(好像是这个后缀名的这个文件)

    原因:编译一次会产生一个新的

    解决办法:应该把编译产生出来的moda文件都删了,然后clean下工程,重新build即可

    6、error:There are no valid certificate/private key pairs in the default keychain

    7、error:Cannot assign to 'self' outside of a method in the init family

    原因:只能在init方法中给self赋值,Xcode判断是否为init方法规则:方法返回id,并且名字以init     +大写字母开头+其他  为准则。例如:- (id) initWithXXX;

    出错代码:- (id) Myinit{

     self = [super init];

     ……

    }

    解决方法:- (id) initWithMy

    {

     self = [super init];

    }

    1, iOS真机调试时,报错:failed to get the task for process 20900

    原因:

    证书问题,project和targets的证书都必须是开发证书,ADHOC的证书会出现此问题。

    解决方案:

        project和targets的证书使用开发证书。

    2,当 一个socket正在连接,这时又一个新的socket建立链接,会抛出错误 “ Attempting to connect while connected or accepting connections. Disconnect first.”。

    原因:

    第一个socket还没返回isConnected  为YES,   就建立第二个socket连接。

    解决方案:

    AsyncSocket有个属性叫isDisconnected,但接口并未开放,将- (BOOL)isDisconnected;
    加入到AsyncSocket.h中。
    然后在连接处:
    if(![_sendSocket isDisconnected])

        {

            [_sendSocket disconnect];

        }

    3,tcp socket willDisconnectWithError:Error Domain=NSPOSIXErrorDomain Code=65

     "The operation couldn’t be completed. No route to host"

            No route to host (socket error ::10065) 

           产生此问题的原因:网络连接不上此服务器。

           解决:查看ip是否正确,查看调试设备网络连接是否正常。

    4,报错:CALayer bounds contains NaN:

    绘图时,某个长宽值中包含除数为0的操作。

     

    5,报错:libxml/tree.h not found

          解决方案:

          步骤1:

          工程-->PROJECT-->Build Settings

          将“Header Search Paths”的值设置为<${SDK_DIR}/usr/include/libxml2>即可。

          步骤2:

          工程-->TARGETS-->Build Settings

          将“Header Search Paths”的值设置为<${SDK_DIR}/usr/include/libxml2>即可。

  • 相关阅读:
    guzzle下载图片(laravel+vue)
    leetcode——131.分割回文串
    leetcode——139.单词拆分
    leetcode——115.不同的子序列
    leetcode——72.编辑距离
    leetcode——87.扰乱字符串
    leetcode——123. 买卖股票的最佳时机 III
    leetcode——132. 分割回文串 II
    leetcode——124. 二叉树中的最大路径和
    leetcode——51.N皇后
  • 原文地址:https://www.cnblogs.com/oc-bowen/p/5036491.html
Copyright © 2011-2022 走看看