ios - 将每个数组元素转换为单独的字符串
问题描述
假设,我有
var temp1TeamName = String()
var temp2TeamName = String()
var teamNameOnceArray = [[String]]()
我需要的
for i in 0..100 {
if(i=0) {
temp1TeamName = ((teamNameOnceArray[i] as AnyObject) as! String)
}
if(i=1) {
temp2TeamName = ((teamNameOnceArray[i] as AnyObject) as! String)
}
}
基本上我想将数组的每个元素存储到不同的字符串中。
但是在运行时它会崩溃。错误是
Could not cast value of type 'Swift._SwiftDeferredNSArray'
(0x10560c988) to 'NSString' (0x1036ba2a8).
Could not cast value of type 'Swift._SwiftDeferredNSArray'
(0x10560c988) to 'NSString' (0x1036ba2a8).
解决方案
推荐阅读
- r - 在 R 中进行模糊匹配的更有效方法?
- javascript - 如何在给定 DB FS 的情况下计算 DB SPL
- ruby-on-rails - 如何修复 Rails + Heroku 中未定义的方法错误
- scala - If else 在单个语句中:scala
- kubernetes - 使用 Kubernetes 为 Openfaas 的具有相同命名空间的 pod 设置配额
- java - 尝试更改片段背景时出现 NullPointerException(空对象引用上的 setBackgroundResource)
- java - Mockito.`when`(....) 正在调用实际实现。?
- python - 我在 Python 中导入请求模块时遇到问题
- xero-api - 从一次登录中检索多个组织 - 通过 API
- excel - 有没有办法将 Power Pivot 数据模型导出到 Power Query?