1.程序崩溃
* Application received signal SIGSEGV
* Application received signal SIGBUS
SIGSEGV和SIGBUS一般是因为访问已被释放的内存或者调用不存在的方法导致的
2.FMDB 错误
DB Error: 1 "unrecognized token: """
解决:此问题表面一看就知道是哪里的字符串需要单引号,但实质上可能除了这个错误以外,还可能是你的sql语句里面有一个中文的空格。最好的办法就是把sql拼接打印出来在navicat里面去执行
3.FMDB 有时会遇到update操作无效
解决:看看是不是update和query写混了 FMDB 插入和更新都是用update,查询用query
4.经常看到有人问怎么一个一个的上传图片到服务器?
GCD群组就可以啦,可以利用GCD群组任务完成后进行统一的通知回调
小demo:
dispatch_group_t group = dispatch_group_create();
for (int i = 0; i < self.addImageView.images.count; i++) { dispatch_group_enter(group);
UIImage *im = self.addImageView.images[i];
[[NetWorkTool sharedNetWorkTool] POST:uploadPicUrl parameters:nil constructingBodyWithBlock:^(id_Nonnull formData) {
NSData *imageData = UIImageJPEGRepresentation(im, 0.0);
NSDate *date = [NSDate date];
NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
[dateformatter setDateFormat:@"MMddHH_mm_ss_SSS"];
NSString * locationString=[dateformatter stringFromDate:date];
NSString *imageName = [NSString stringWithFormat:@"-%@.jpeg",locationString];
//这边注意data是图片流,name是后台接受的参数和后台要就可以了
[formData appendPartWithFileData:imageData name:@"qqfile" fileName:imageName mimeType:@"jpeg"];
} progress:^(NSProgress * _Nonnull uploadProgress) {
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
DLog(@"上传第%d图片成功",i);
}
dispatch_group_leave(group);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
dispatch_group_leave(group);
}];
}
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
DLog(@"所有图片上传成功");
}
});
5.webview下面有一个黑色的条
if ([self respondsToSelector:@selector(automaticallyAdjustsScrollViewInsets)]) {
self.automaticallyAdjustsScrollViewInsets = NO;
}