标签:
1.从ControllerA跳往照相UIImagePickerController,只能用presentViewController形式,因为定义UIImagePickerController时,
UIImagePickerController *pickerController = [[UIImagePickerController alloc]init];
pickerController.allowsEditing = NO;
pickerController.delegate = self;
pickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
设置delegate时,若只引入UIImagePickerControllerDelegate,那么会报以下警告:
Assigning to ‘id<UINavigationControllerDelegate,UIImagePickerControllerDelegate>’ from incompatible type ‘AddSightingViewController *const __strong’
解决方法是再添加UINavigationControllerDelegate。如下
@interface ControllerA()<UIImagePickerControllerDelegate,UINavigationControllerDelegate>
@end
所以当跳转界面时用
[self.navigationController pushViewController:pickerController animated:YES];
会报Pushing a navigation controller is not supported错误
引以为戒
2.解决A valid provisioning profile for this executable was not found 问题
当导入签名和证书后,真机调试仍出现这种问题,那么可以按照以下步骤排查
①先检查provisioning profile是否导入成功
我用的Xcode版本是7.3.1,在Window——>Devices——>选中运行的真机——>provisioning profiles查看
②检查 Project 和 Target 中的 Code Signing Identity 是否设置一样,必须一样
3.当往NSArray中存入基本数据类型时,可以用NSNumber,也可以用简写
//NSNumber形式
_signTypesArr = [NSArray arrayWithObjects:[NSNumber numberWithInteger:3],[NSNumber numberWithInteger:2], nil];
//简写形式
_signTypesArr = [NSArray arrayWithObjects:@(2),@(2),@(2),@(1),@(3),@(3),@(3), nil];
但从数组中往外读取时,下面这种写法虽然不报错,但取的值不对,会取到意想不到的值
NSInteger typeDef = self.signTypesArr[i];
正确的是
NSInteger typeDef = [self.signTypesArr[i] integerValue];
4.NSError转换为NSString
NSError *error= [NSError errorWithDomain:@"" code:0 userInfo:errInfo];
NSString *errorStr = [error localizedDescription];
标签:
原文地址:http://www.cnblogs.com/Apologize/p/5584890.html