今天写了下面的快速枚举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的更多相关文章

  1. 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 ...

  2. apscheduler 执行报错No handlers could be found for logger "apscheduler.executors.default

    执行报错如下: No handlers could be found for logger "apscheduler.executors.default 解决: 加入日志,查看具体报错,载根 ...

  3. List使用Foreach 修改集合时,会报错的解决方案 (Error: Collection was modified; enumeration operation may not execute. ) - 摘自网络

    当用foreach遍历Collection时,如果对Collection有Add或者Remove操作时,会发生以下运行时错误: "Collection was modified; enume ...

  4. 安装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 ...

  5. 解决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 ...

  6. 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 ...

  7. storm启动报错: InvalidTopologyException(msg:Component: [mybolt] subscribes from non-existent stream: [default] of component [es-bolt])

    storm每一个bolt在emit之后需要把数据传递到下一个bolt,所以declareOUtputFields 一定要写 默认的情况下不用加streamId,如果加了streamId,后面的bolt ...

  8. 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 -- ...

  9. C语言 在VS环境下一个很有意思的报错:stack around the variable was corrupted

    今天做一个很简单的oj来温习下c 语言 题目如下 输入 3位正整数 输出 逆置后的正整数 代码如下: #include"stdio.h"int main(){ float h,su ...

随机推荐

  1. nyoj746 整数划分(四)

    整数划分(四) 时间限制:1000 ms  |  内存限制:65535 KB 难度:3 描述 暑假来了,hrdv 又要留学校在参加ACM集训了,集训的生活非常Happy(ps:你懂得),可是他最近遇到 ...

  2. httpclient 释放连接的问题 Invalid use of SingleClientConnManager: connection still allocated

    Invalid use of SingleClientConnManager: connection still allocated httpPost.releaseConnection();  该代 ...

  3. dp背包之01背包poj2184

    http://poj.org/problem?id=2184 题意:给定两个属性,求这两个属性的和的最大值......... 思路:将第一个属性往后平移1000个单位,然后推导其动态转移方程,若是dp ...

  4. Eclipse “cannot be resolved to a type” error

    引言:     eclipse新导入的项目经常可以看到"XX cannot be resolved to a type"的报错信息.本文将做以简单总结. 正文:     (1)jd ...

  5. su和sudo命令

    su命令用于在不同的用户之间切换,比如使用user1登陆了系统,但要执行一些管理操作,比如useradd,普通用户没有这个权限的,解决的办法有两个. 1:退出user1用户,重新以root用户登录系统 ...

  6. senfile函数实例的运行过程截图

    //要传输的文件内容如下所示: 启动服务器,等待客户端连接(在同一台主机上模拟的) 客户端远程登录,这里是在本地登录 这个要注意一点就是远程登陆的时候一定要带上端口号不然连接失败!!

  7. Android——区别DVM与JVM (2)

    区别DVM与JVM 1.首要差别 Dalvik: 基于寄存器,编译和运行都会更快些 JVM: 基于栈, 编译和运行都会慢些 2.字节码的区别 Dalvik: 执行.dex格式的字节码,是对.class ...

  8. Adroid—— DVM

     Android DVM   Android 运行环境主要指的虚拟机技术——Dalvik.Android中的所有Java程序都是运行在Dalvik VM上的.Android上的每个程序都有自己的线程, ...

  9. 面向对象设计原则二:开闭原则(OCP)

    开闭原则(OCP)定义:对扩展开发,对修改关闭.好处:      适应性和灵活性.      稳定性和延续性.      可复用性与可维护性. 解释说明:开闭原则指的是两方面:对功能扩展开发,对修改进 ...

  10. TF和SD

    TF卡又称T-Flash卡,全名:TransFLash,又名:Micro SD SD卡(Secure Digital Memory Card,安全数码卡)