1.collectionView 不能滑动。
用的系统的collectionView,不能上下滑动,原因是我在viewDidLoad里写了self.automaticallyAdjustsScrollViewInsets = NO;
解决方法
将self.automaticallyAdjustsScrollViewInsets = NO
或者在这句后面再加一句:self.collectionView.alwaysBounceVertical = YES;
2.property follows cocoa naming convention for returning 'owned' objects
xib拖线的时候犯错,一个复制用的button命名为了copyBtn。命名不规范 ,属性不能以关键字符开头。不能以alloc,new,copy,mutableCopy 作为开头命名,比如:copyBtn。
-
Xcode has encountered an unexpected error: (0x01c) No space left on device, at ‘/Library/Caches/com.apple.xbs/Sources/...'
电脑明明还有几G的内存剩余,手机也是,但是xcode老是报这个,最后大退重启xcode直接就没事了......
4.Could not load NIB in bundle: 'NSBundle...'
nib名字写错了
[[XXX alloc] initWithNibName:@"nibName" bundle: nil];
5....does not contain bitcode.
'/Users/tobace/Library/Developer/Xcode/DerivedData/xxxxx-bjarxrykxongsdgoobkxgjzbdzkb/Build/Products/
Debug-iphoneos/libCrossApp.a(as_color.o)' does not contain bitcode. You must rebuild it with
bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable
bitcode for this target. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(点击TAERGETS,再点击Build Setting .在搜索框搜索BitCode,把它默认的Yes改为No就可以了)
6.Tableview最后一行无法显示或者显示不全的问题IOS
初始化时:
self.tableView = [[UITableView alloc]initWithFrame:self.view.bounds];
遇到了Tableview最后一行显示不全的问题。由于navigationBar的高度的问题,导致self.view的frame发生了变化。
解决办法:
设置frame的时候,设定高度减去navigationBar的高度44。
self.tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - 44)];
7.在子线程做了一些操作,又更新UI时
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(), ^{
self.playBtn.selected = NO;
});
8.loaded the "xxx" nib but the view outlet was not set 错误的解决办法
(1)常规原因及解决参考
http://www.jianshu.com/p/29b58582c392
http://blog.csdn.net/leonpengweicn/article/details/6022616
(2)我的项目中,存在一个 TestController.xib,又建了一个TestView.xib,报了那个bug。解决方法:TestView.xib删掉重新建一个别名的xib。原因可能是TestController 的view也叫TestView。
9.[[NSBundle mainBundle] URLForResource:@"xx" withExtension:@".mp4"]获取不到数据
视频添加到项目中的时候,使用右击->add File to 的方式添加文件!!!
10.百度地图SDK配置好后拿不到定位数据,也不报错。
plist文件中忘了添加NSLocationUsageDescription和NSLocationWhenInUseUsageDescription
11.打包时遇到symbol(s) not found for architecture armv7
自己制作的framwwork添加到工程里打包时遇到symbol(s) not found for architecture armv7。详细错误如下:
原因:制作framework时忘记将Build Active Architecture Only 设为 NO。
12.类名重命名以后又新建了xib与之关联,运行时崩溃。记得将xib中的view与File's Owner进行关联!
13、用xib创建的UICollectionViewCell在类名rename之后报如下错误:
Assertion failure in -[UICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:viewCategory:],
或者
Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/shiguang/Library/Developer/CoreSimulator/Devices/84005112-C5B2-4664-9E4B-781424469F05/data/Containers/Bundle/Application/9B754351-A0D4-48CB-9CFC-95A81D4F20F3/CollectTest.app> (loaded)' with name 'PersenCell''
解决方法:xib删了重新新建一个,再与rename后的CollectionViewCell进行关联解决。
14、
控制器中添加UICollectionView后不能正常显示
将 self.automaticallyAdjustsScrollViewInsets 设为 NO;
自定义UICollectionViewCell 在- (instancetype)init中添加的子控件无法显示,改为- (instancetype)initWithFrame:(CGRect)frame添加,而且子控件要加到contentView上:
- (instancetype)initWithFrame:(CGRect)frame{
if (self = [super initWithFrame:frame]) {
if (!_imageView) {
self.imageView = [[UIImageView alloc]init];
self.imageView.frame = self.bounds;
[self.contentView addSubview:self.imageView];
}
}
return self;
}
15、集成百度地图SDK时按官方文档配置完后依旧报错
Undefined symbols for architecture arm64:
"_kUTTagClassFilenameExtension", referenced from:
-[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
"_kUTTagClassMIMEType", referenced from:
-[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
"_UTTypeCreatePreferredIdentifierForTag", referenced from:
-[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
"_UTTypeCopyPreferredTagWithClass", referenced from:
-[BMKBaseStreamingMultipartFormData appendPartWithFileURL:name:error:] in BaiduMapAPI_Search(BMKBaseURLRequestSerialization.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因:虽然文档里没写,但是SDK还需要另一个framework才行。导入MobileCoreServices.framework解决问题。
16、(xpc-connection-interrupted) Communications error: <OS_xpc_error: <error: 0x19d846af0> { count = 1, contents =
"XPCErrorDescription" => <string: 0x19d846e50> { length = 22, contents = "Connection interrupted" }
}>
使用UIGraphicsBeginImageContextWithOptions时报这个错,内存急增然后崩溃,临时将方法替换为
UIGraphicsBeginImageContext解决,暂时没有分析出具体原因。
17、Thread 1: EXC_BAD_ACCESS (code=1, address=0xc1af04148)
一般是访问已释放信息或者类似的情况导致的,可以开启Zombie Object来进行追踪,会给出较为详细的error信息。
xcode设置方法:
Product->Scheme->Edit Scheme->Diagnostics->Zombie Object
18、Provisioning profile "iOS Team Provisioning Profile: com.xxx.xxx" doesn't include signing certificate "iPhone Developer: xxx xxx (DeveloperName)"
生成配置文件的时候没选DeveloperName的证书