警告:Applications using Launch Screen Files and targetting iOS 7.1 and earlier need to also include a Launch Image in an Asset Catalog.
解决方案:Launch Images Source 要选择启动图片来源,来适配iOS7.1及更早的版本。
图示:
Xcode6默认是这样的:
:
修改后:
报错:This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes. This will cause an exception in a future release.
解决方案:使用主线程更新UI,
dispatch_async(dispatch_get_main_queue(), ^{
// 更UI
});
报错:Collection <__NSArrayM: 0x13e172510> was mutated while being enumerated.的崩溃问题。
崩溃原因:
在枚举的时候发生了变化。比如forin 循环中的便利内容不能被改变, 是因为如果改变其便利的内容会少一个, 而系统是不会允许这个发生的所以就会crash...但是当改变最后一个的内容时, 就不会crash, 是因为此时遍历已经结束, 结束之后对内容做修改是允许的 。
这里有三种解决方案:
1.利用for loop ()
for (int i = 0; i < arr.count; i++) {
if (...) {
// do sth ;
}
}
2.利用临时变量
NSArray *tmp = [NSArray arrayWithArray:arr];
for (id obj in tmp) {
if (...) {
// do sth ;
}
}
3.enumerateObjectsUsingBlock(推荐)
[arr enumerateObjectsUsingBlock:^(NSMutableDictionary *obj, NSUInteger idx, BOOL *stop) {
if (...) {
// do sth
*stop = YES; // 相当于break ; stop控制跳出枚举器.
}
}];