[报错]Fast enumeration variables cannot be modified in ARC by default; declare the variable __strong to allow this
今天写了下面的快速枚举for循环代码,从按钮数组subButtons中取出button,然后修改button的样式,在添加到view中
for (UIButton *button in subButtons) {
button.selected = YES;
button = [self updateStatusWithButton:button];
[self.view addSubview:button];
}
但是写完还未编译,就报如下错误:
Fast enumeration variables cannot be modified in ARC by default; declare the variable __strong to allow this
即: 快速枚举变量在ARC下默认不能修改其引用属性,声明变量为__strong允许修改
所以修改如下即可:
for (__strong UIButton *button in subButtons) {
button.selected = YES;
button = [self updateButtonStatusWithButton:button isInitial:YES];
[self.view addSubview:button];
}
[报错]Fast enumeration variables cannot be modified in ARC by default; declare the variable __strong to allow this的更多相关文章
- mysql 5.7 创建用户报错ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
如: INSERT INTO user (host, user, authentication_string, select_priv, insert_priv, update_priv) VALUE ...
- apscheduler 执行报错No handlers could be found for logger "apscheduler.executors.default
执行报错如下: No handlers could be found for logger "apscheduler.executors.default 解决: 加入日志,查看具体报错,载根 ...
- List使用Foreach 修改集合时,会报错的解决方案 (Error: Collection was modified; enumeration operation may not execute. ) - 摘自网络
当用foreach遍历Collection时,如果对Collection有Add或者Remove操作时,会发生以下运行时错误: "Collection was modified; enume ...
- 安装Ecshop首页出现报错:Only variables should be passed by referen
出现下面这就话: Strict Standards: Only variables should be passed by reference in E:\Tools\ECShop_V2.7.3_UT ...
- 解决eclipse用maven install打包报错问题:-Dmaven.multiModuleProjectDirectory system property is not set. Check $M2_HOME environment variable and mvn script match.
1.添加M2_HOME的环境变量 2.Preference->Java->Installed JREs->Edit 选择一个jdk, 添加 -Dmaven.multiModuleP ...
- jack反序列化自定义字段绑定,报错:can only instantiate non-static inner class by using default, no-argument constructor
package com.xxx; import com.fasterxml.jackson.annotation.JsonProperty; import lombok.Data; import lo ...
- storm启动报错: InvalidTopologyException(msg:Component: [mybolt] subscribes from non-existent stream: [default] of component [es-bolt])
storm每一个bolt在emit之后需要把数据传递到下一个bolt,所以declareOUtputFields 一定要写 默认的情况下不用加streamId,如果加了streamId,后面的bolt ...
- Mysql报错[Warning] TIMESTAMP with implicit DEFAULT value is deprecated和Buffered warning: Changed limits
报错2019-04-24 12:06:46 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use -- ...
- C语言 在VS环境下一个很有意思的报错:stack around the variable was corrupted
今天做一个很简单的oj来温习下c 语言 题目如下 输入 3位正整数 输出 逆置后的正整数 代码如下: #include"stdio.h"int main(){ float h,su ...
随机推荐
- 用C语言(apue)实现 把时间戳转换为国标格式的字符串(2017-07-17 22:36:12)的函数
/*******************************************************************************/ /** *** 函 数 名: cha ...
- Excel 自定义关闭按钮
遇到过这样一个需求,是在excel关闭的时候,不要excel本身的保存窗口,只用自定义的. 这个的需要第一,是点击关闭时候触发, 第二:触发后,不能还是弹出那个窗口 第三:取消后,要能停止程序 为了弄 ...
- sama5d3 环境检测 gpio--yx测试
说明: yx0--pioA0 yx1--pioA2 yx2--pioA4 yx3--pioA10 yx4--pioA14 yx5--pioA16 yx6--pioA12 yx7--pioA20 ...
- BLUETOOTH:HCI层编程
1. HCI层协议概述: Host Controller Interface(HCI) 就是用来沟通Host和Module.Host通常就是PC,Module则是以各种物理连接形式(USB,seri ...
- vector--C++ STL 学习
vector对应的数据结构为数组,而且是动态数组,也就是说我们不必关心该数组事先定义的容量是多少,它的大小会动态增长.与数组类似的是,我们可以在末尾进行元素的添加和删除,也可以进行元素值的随机访问和修 ...
- 绑定内网和安全redis和mongo以及MQ
redis允许局域网访问其实很简单.网上一堆都不怎么靠谱. 特此记录一下. 可参考此篇 假设A B 两台机器 在B(ip:192.168.1.99)机器上修改redis配置文件 bind 192.16 ...
- 3% of users browse with IE9 and 14% of users have a disability. Why do we only cater for the former?
我想要用一个否定声明来開始我的文章:对于怎样创造一个易于用户体验的站点,我也不是了解非常多. 让作为一个资深开发人员的我操心的是,我在并没有获得太多关于这个主题(指怎样创造一个易于用户体验的站点)的实 ...
- Oracel 数据库面试题
1.取出表中第31到40行的记录mysql方案: , oracle方案: select t2.* ) t2 2.truncate和delete有什么区别TRUNCATE TABLE在功能上与不带WHE ...
- 漫游Kafka设计篇之消息传输的事务定义(5)
之前讨论了consumer和producer是怎么工作的,现在来讨论一下数据传输方面.数据传输的事务定义通常有以下三种级别: 最多一次: 消息不会被重复发送,最多被传输一次,但也有可能一次不传输. 最 ...
- 响应式布局中为什么要使用em设置字体大小而不用px
px像素(Pixel).相对长度单位.像素px是相对于不同设备显示器屏幕分辨率(pad/phone/pc)而言的.(引自CSS2.0手册) 1em指的是一个字体的大小,它会继承父级元素的字体大小,因此 ...