iOS开发过程中遇到的问题总结

来源:互联网 发布:java ee书籍推荐 编辑:程序博客网 时间:2024/05/02 00:41

总结个人开发过程中遇到的问题,持续更新:

1、官网的speakhere复制拷贝到自己的项目,提示CADebugPrintf.h file not found:

select the Target, open the Build Settings pane, search for "Preprocessor Macros". Leave the fields blank (I've got rid of a DEBUG entry),就是把Preprocessor Macros参数的值清空即可;(记得添加AudioToolBox.framework)


2、CAStreamBasicDescription.h unknown type name class

speakhere复制到自己项目时,会出现很多文件提示以上错误,原因是oc中引用了c++文件,将引用c++文件的.m文件改成.mm,然后再在另一个.h文件引用.mm的类,注意此时使用@class name, 不要使用#import"name"


3、使用Xcode 4时, 文件已经删除,但是会出现missing file错误,这一般是SVN或git造成的,有几种方法可以删除:
方法1:批量删除的一个方法,删除.svn文件:
在终端中输入cd (有空格),将项目文件夹拖进入,回车
输入命令行:
rm -rf  find . -type d -name .svn
再回车


方法2:删除隐藏的.svn文件

命令行运行

  1. defaults write com.apple.finder AppleShowAllFiles TRUE
  
  2.   
  3. killall Finder  


开启显示隐藏文件,然后到工程目录下删除.svn文件,然后再恢复

  1. defaults write com.apple.finder AppleShowAllFiles FALSE  
  2.   
  3. 
killall Finder  


4、obstructing    is blocking item under version control

It was svn issue. after a clean up and update on build folder, I could delete the build folder and add set it to ignore.

Did you use TouchXML from a svn repository? You may check for any ".xxxx" folders.

// Update: I meant running svn cleanup and svn update commands.


5、指定同一个应用中的view不同旋转方向,在每个view中重载:

 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return (interfaceOrientation != UIInterfaceOrientationMaskLandscapeLeft);
}

-(NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskLandscapeRight;
}

-(BOOL)shouldAutorotate
{
    return YES;
}

iOS5、6通吃。

6、善用“=”:

开发中经常遇到要将一个变量的值付给另一个变量,最惯用的方法则是a.value=b.value,这时其实是将b.value的地址直接付给了a.value,这样产生的效果则是:如果a.value的值发生改变,则b.value也会改变。可以使用a.value=[b.value mutableCopy], copy同样不可以,copy达到的效果与直接赋值一样

7、XCode 的CopyPNGFile Error (找不到图片或目录)

1.点击工程的TARGETS

2.点击Build Phases

3.点击Copy Bundle Resources

4.看里面的资源有什么是红色显示的,然后选中它,最底下有删除的按钮。删掉就好了

或者用ps打开文件另存为无交错的



原创粉丝点击