[报错]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 ...
随机推荐
- Python内置函数property()使用实例
class Shuxing(): def __init__(self, size = 10): self.size = size def getSize(self): print('getSize') ...
- 人工打jar包
(一)将可执行程序打成一个jar包 其中Yoyo为入口程序,因此将当前目录下workhard和Book.class.testEx.class.Yoyo.class打成一个jar包的命令如下: jar ...
- hdu1285 确定比赛名次(拓扑排序多种方法)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1285 Problem Description 有N个比赛队(1<=N<=500),编号依次 ...
- CEF Xilium.CefGlue 在当前窗体中打开全部链接(防止弹窗)
我们在使用Xilium.CefGlue编写浏览器应用程序时.对于嵌入的网页假设有链接会在新窗体打开.这种用户体验会非常差.因此我们须要改动程序,使全部链接都在当前窗体中打开. 首先引用Xilium.C ...
- PHP——简单的表单提交
<body> <form name="" method="post" action="CHULI.php"> < ...
- Ci 错误 In order to use the Session class you are required to set an encryption key in your config file.
说明自己没有给session 加密 ,在配置文件config中 $config['encryption_key'] = '2rf3f3fwefwefwef2';
- [Java] java调用wsdl接口
前提: ① 已经提供了一个wsdl接口 ② 该接口能正常调用 步骤1:使用cxf的wsdl2java工具生成本地类 下载CXF:http://cxf.apache.org/download.html ...
- ubuntu14.04中安装jdk
1. 下载JDK http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 将下载的 .g ...
- OAuth2.0 介绍
一.基本协议流程: (1) Client请求RO(Resource Owner)的授权:请求中一般包含:要访问的资源路径,操作类型,Client的身份等信息.(2) RO批准授权:并将“授权证据”发送 ...
- HttpModule的简单示例
1.HttpModule可用在asp.net 管线事件触发的过程中.. 可处理一些通用的操作,如给特定请求加 gzip压缩. 2.示例代码: using System; using System.We ...