1. Local declaration of "xxx" hides instance variable
原因: 本地变量跟函数参数变量同名了。
2.Variable is not assignable(missing __block type specifier)
原因:对于外部普通变量,block只有读取的权限,要想对外部变量具有写权限,需要在变量前加 __block
3.Xcode模拟器 内置键盘不可以输入,(外接键盘和内置键盘不可以同时输入)
解决: command + shift +k
4.
原因:设置imageView的image时,实例化image时不能传入nil 例如错误用法:imageView.image = [UIImage imageNamed:nil];
5. LaunchServices:ERROR :There is no registered handler for URL scheme xxx
原因:运行模拟器时,报的错误。我检查了下 info.plist 文件里配置是没有问题的,后来发现是设备上没有安装 客户端,此时会走网页端。
6.The 'viewDidAppear:' instance method in UIViewController subclass 'MyViewController' is missing a [super viewDidAppear:] call
)
原因:Product - Analyze 时,出现上述问题,方法体中没有写 [superviewDidDisappear:animated];
7. <Error>: CGAffineTransformInvert: singular matrix.
设置了缩放比例为零
self.forDisplayButton.transform = CGAffineTransformMakeScale(0, 0);
改为:
self.forDisplayButton.transform = CGAffineTransformMakeScale(0.01f, 0.01f);
8.Collection <__NSDictionaryM: 0x174251fa0> was mutated while being enumerated
原因: 当程序出现这个提示的时候,是因为你同时遍历你的数组/字典,同时又修改你数组里的数据,导致崩溃。
方法1. 定义一个一模一样的数组,遍历数组A 然后操作数组B
NSMutableDictionary * mutableDictionary = [[NSMutableDictionary alloc] initWithDictionary:parameters];
for (NSString * key in mutableDictionary) {
[parameters setObject:@"ddddddd" forKey:key];
}
NSLog(@"-----------------%@",parameters);
方法2. 用系统自带的遍历
NSMutableArray *tempArray = [[NSMutableArray alloc]initWithObjects:@"12",@"23",@"34",@"45", nil];
[tempArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
if ([obj isEqualToString:@"34"])
{
[tempArray replaceObjectAtIndex:idx withObject:@"3333333"];
}
}];
NSLog(@"%@",tempArray);
MinJing_Lin的博客