iOS:Compile error List (一)

----property  'XX'  cannot  be found  in forward  class  'XX *' 。分析:那个类没相应属性,经常的错误是XX类头文件没导入。

----'FF/XX.h' file not found。系统框架中的某个类找不到,一般是在Header Search Paths里面添加路径。

----#error XX is ARC only. Either turn on ARC for the project or use -fobjc-arc。修改arc的设置,在targets->build phases中修改compiler Flags。添加-fobjc-arc或者-fno-objc-arc。
--备注:因为可以修改文件的arc设置,所以在代码中添加判断是否支持arc,调整相应代码,这样不管以后.m的arc是否改变,都不用再次调整代码。

----duplicate symbol _OBJC_CLASS_$_XXX.....。1.项目里面有相同名字的类;2import的时候.h写出.m;3有多个main文件。

---- if([self 方法a]){

       self.xx = [self 方法a];
   }
    return self.XX;
  方法A会返回nil或者别的值。想套用init方法的写法,在if条件里写上(self.xx = [self 方法a])的判断条件,但xx的值跟预期不一样(xx取值:方法A有值就改变xx的值,没有xx就不变),改成上面这这种方式,xx取值没问题了,但导致另一个问题就是[方法a]被调用俩次,程序有可能会出错

----Couldn't register com.myApp.debug 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.经常是一个项目开着模拟器调试,另一项目开真机调试,就会出现这问题。解决办法,网管守则第一条,重启(模拟器、真机)。网上还有人说的简单方法:

----模拟器:1.Close simulator. 2.Stop the app from running in xCode.  3.Open Activity Monitor and search for a process running with your App NAME.  4.Kill this process in Activity Monitor.  5.Rebuild your project and you should be all set;

----真机:1.Deleting the app from the device.  2.Disconnecting the device from Mac.  3.Turning the device off and back on.  4.Quitting and relaunching Xcode.  5.Quitting Instruments,Finally, Clean and Build again.

----The Simulator can't be launched because it is already in use。这个在你用simulator run 项目A的时候有时会提示,一般是另外一个项目B用着simulator,然后你command+Q退出simulator,但有时会导致项目B直接崩溃并且使项目处于‘调试’状态。这个时候在项目B菜单Product中stop项目,其它项目即可使用simulator了。

----the executable was signed with invalid entitlements.The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.这问题是设备里面没有程序的Provisioning Profiles.解决办法:在Organizer窗口将LIBRARY里面的Provisioning Profiles拖到设备中去。
备注:若是该Provisioning Profiles里面没有包含该设备,会报错,得登陆苹果开发网站,将设备添加到Provisioning Profiles里面去,重新下载该Provisioning Profiles,双击它,就将添加到了xcode,之后导入设备中去。

----could not change executable permissions on the application. 原因:你同一个bundle identifier  往iphone里装了两个程序。解决办法,将设备上之前装用同一个bundle identifier的程序删除掉。

----ld: file is universal (xx slices) but does not contain a(n) armv7s slice:/....../iPhoneOS5.1.sdk/usr/lib/crt1.3.1.o for architecture armv7s.原因:有的文件编译需要armv7架构。解决办法:在工程build setting的Architectures中 选“Standard Active Architecture Only"为yes。
----说明:arm结构处理器,几乎所有的手机都基于arm,其在嵌入式系统中应用非常广泛,如果“Standard Active Architecture Only”为True则,选择Armv6或v7都只会编译对应指令集的包;若选false,则编译器会整合两个指令集到一起,则包比较大,但是能使用Armv7 的优化,同时能适配到老的机器。低arm的包可以在高arm的机子上跑,反之则不可以。

----Could not load the "xx.png" image referenced from a nib in the bundle with identifier "com.company.identify"。那张图片没有add到Target里面。在图片的Target Membership里面或者“Build Phases” 里面加上。

----录音的时候报错recorder = [[ AVAudioRecorder alloc] initWithURL:recordedTmpFile settings:recordSetting error:&error]; [error description]   Error Domain=NSOSStatusErrorDomain Code=1718449215 "The operation couldn’t be completed. (OSStatus error 1718449215.).可能问题,url文件后缀名不对。AVAudioRecorder的initWithURL方法说明:The file type to record is inferred from the file extension. Will overwrite a file at the specified url if a file exists。======

----missing context for method  declaration.原因:方法没有放在@implementation和@end之间。

----A valid provisioning profile for this executable was not found.原因:没有找到相应的“配置文件”。但在“Organizer”窗口里面有相应有效的“配置文件”,其中一个原因可能是设备的时间不对(比如未来某个时间,超过了“配置文件”有效期,导致失效)。

---- (BOOL)textFieldShouldEndEditing:(UITextField *)textField,在此方法里写一些判断条件,判断用户当前的输入是否符合要求,不符合,提示AlertView ,return NO;这样在用户退出该控制器时,会连续弹出几个AlertView,之后程序里任何输入,都无法弹出键盘。如果在用户退出控制器的时候,该控制器释放了(比如popViewController),程序会崩溃。即使在用户退出之前resignFirstResponder 方法也不好用。问题出现的原因是退出的时候调用了textFieldShouldEndEditing,但是它一直返回no,然后继续调用。目前想到解决问题方法是在textFieldShouldBeginEditing方法里记住上一个textField,在它里面判断用户输入格式是否正确,它的返回值不会导致它可能一直是first responder。

----Class cs = NSClassFromString(@"XX")   returns nil;返回值说明:return value:The class object named by aClassName, or nil if no class by that name is currently loaded. If aClassName is nil, returns nil;通常情况是class  没有loaded。所以确保1.if you are trying to instantiate a class from a static library, you must add the "-ObjC" flag to the "Other Linker Flags" build setting;2.Class在Compile Sources里面/Class.m 的Target Membership没有被选中。

----non-ascill characters  are not allowed outside   of literals and identifiers ;code里面还有‘非法’字符,可能是中文输入法下输入的一些空格、字符。另:在代码版本管理的时候,如果出现冲突,在“冲突解决界面”里解决冲突的时候,如果copy了界面里一些代码,在冲突解决后,将这些代码paste到项目里的时候,一些字符也是“非法”的。

----Interface Builder could not open the document “XXX.xib” because it does not exist;自己碰到情况是build phases的resource文件变红了,解决办法:select project target -->remove the file from the build phases tab in copy bundle resources -->re add it to the build phases tab;

----warning: control reaches end of non-void function:控制到达非void函数的结尾。就是说你的一些本应带有返回值的函数到达结尾后可能并没有返回任何值;

----提示如下错误信息.../Frameworks/xx.framwork/Headers/UIxx.h has been modified since the precompiled header...:可能在查看系统头文件的时候,不小心改了内容,解决办法:在Windows->Organizer窗口里,删除Derived Data,之后Clean,运行不一定好使。以上不行的话,在Windows->Organizer窗口里,跳到Derived Data的文件夹中,删除所有子文件夹,之后Clean,运行即可。

----No visible @interface for 'xxClass' declares the selector 'xxmethod':说明,类中很多调用方法的地方提示该错误信息,并且在xcode的“pragma mark列表”里看不到相应方法了。原因:xcode识别不了了那些方法,一般都是因为某个方法格式书写错误(大括号不对应等),导致xcode之后的方法格式都对应不上,可以从“pragma mark列表”中不能识别的方法开始,排查出现问题的方法。

----Please verify that your device's clock is properly set, and that your signing certificate is not expired. (0xE8008018):原因:字面意思是设备锁住了,或者证书过期了。基本就是证书问题,可以通过Command+,在开发账号里面更新provisioning files即可;也可以登录开发者中心,更新provisioning files;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值