iOS编译填坑记录

以下是本人在iOS开发工作中使用的一些小技巧,记录一下。

 问题一这里有两个前提: 1、 工程中已经链接生成.a文件,同时target dependency也指定了  2、外加一个指定link里面也指定了链接库

为什么还会错误呢

问题二:

xcode编译过程中的环境变量

问题三


系统库找不到原来是C++库要用mm后缀,我了去

问题四

protobuffer里面默认采用的是C99的版本,导致编译出来是_t _n ,其他引用protobuffer的工程需要手动define,恶心啊

问题五

两次link framework会导致编译不过,报符号重复错误


问题6   Error: Argument list too long: recursive header expansion failed at /Applications/iWork '09/Pages.app/…/Contents/Resources

This is an Xcode "problem", as the error is generated from having a recursive search in your header search path. I've solved this in the past by unchecking the "Recursive" flag on items in the Header search path and instead link to each directory directly. There might be other (better) ways to solve this problem but it appears to be somewhat a bug with Xcode not reporting the error correctly when it is hit with a path it can not fully resolve.

There is also some info here about this error:

Xcode 3.1 problem checking dependencies | Cocoabuilder

There someone wrote, 

Since GCC doesn't natively support recursive search paths, Xcode simulates them by expanding such a path into a discrete -I or -F or -L flag for each directory under the parent directory, but this can rapidly expand to the point that it results in a command line too long to be issued.

The difference between Xcode 3.0 and 3.1 here is that Xcode 3.0 would silently stop expanding the recursive search path if it got too long and simply use whatever it had computed up to that point, which would result in semi-deterministic (and extremely difficult to diagnose) errors for certain types of projects. So now Xcode emits an error if it was unable to fully expand the recursive search path.

So you may need to remove that recursive search path, or modify it to expand to a smaller set of directories, or convert it to a smaller set of non-recursive search paths. Or, alternately, reorganize your source to have fewer directories the path can expand to.

Incidentally, having a smaller set of expansions could also lead to somewhat-faster compilation times, since it's fewer directories that the compiler has to search in when compiling each file. (I don't know the magnitude of impact this would have, though.)


问题7   touch framework卡死

关闭所有程序重新编译无效, 关闭xcode编译无效,只有重启电脑才有效!!!!

问题8  

While editing in the storyboard, specifically assigning a view controller to a specific class, I suddenly encountered this error when I wanted to run the project.

Main.storyboard: Internal error. Please file a bug at bugreport.apple.com and attach "/var/folders/79/_jh611t15qsfcx165_jv_20h0000gn/T/IB-agent-diagnostics_2015-10-28_00-33-12_730000".

And now I can't run my project anymore. I couldn't find any information regarding to this anywhere else. Did anyone encounter this before?

enter image description here

解决方案:   I faced the same issue. And it was solved by cleaning up the build files.

cmd + shift + k

AND

cmd + option + shift + k

Hope this helps Thanks.

问题9:  debug、build、attach ios直接卡死


重启ios手机,注意是重启手机哦,不是重启xcode,不是重启mac,是重启手机,够坑

问题10: The maximum number of apps for free development profiles has been reached.

删除手机上多余的app,就搞定

问题11


问题12  如果使用了forceload就要link depends加上依赖关系,没有foceload,也要加上depend依赖关系,主工程对所有的静态库都要加上依赖关系; 工程的目录关系直接影响着依赖关系的消失,删除工程中的树形结构关系,就等于潜规则删除了依赖关系



1.使用XXX.pch文件便捷开发+加速Build

在IOS开发的项目中有一个XX_Prefix.pch

XX_Prefix.pch:扩展名.pch表示"precompiled header",这是一个你工程要用到的来自于外部框架的头文件列表。xcode将编译这些头到文件,这将减少你在选择Build 或Build and Go时编译项目的时间。通常用到的头文件已经自动包含了pch,系统编译每个.m文件前,都会先imort这个文件。这样就节省了添加include的时 间,相当于加速编译

还有就是可以再这里面放入宏,在整个工程中都可以用.

添加方法:

  

在targets->Build Setting中Apple LLVM 7.0 - language中做如下修改

例如在一个项目中有一个hello.h文件,需要在所有.m文件中都要包含这个文件就可以在

XX_Prefix.pch文件中引入hello.h

2.在一个应用中打开其他应用.

在iOS开发中,如何实现从app1打开app2。

    基本的思路就是,可以为app2定义一个URL,在app1中通过打开这个URL来打开app2,在此过程中,可以传送一些参数。下面来讨论一下具体的实现过程。

1. 在app2的info.plist中定义URL,就是在文件中添加URL types一项。可按下图进行添加。

2. 在app1的代码中打开刚才定义的URL,代码如下:

1  NSURL *url = [NSURL URLWithString:@"myapp://test?para1=1¶2=2"];  
2 [[UIApplication sharedApplication] openURL:url]; 

当然,这个URL的形式可以是其他形式的,只要以"myapp://"开始即可。

    这样,就可以在app1中打开app2.

    打开之后,会调用app2的AppDelegate的

 

1
- ( BOOL )application:(UIApplication *)application openURL:(
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值