我在swift中编写应用程序,当我在iPhone模拟器上运行测试应用程序时,一切正常,但我尝试向右滑动,这是我添加的一个手势,以便转到下一页(View Controller Two)它崩溃并在控制台日志中显示此错误报告.
2014-10-18 12:07:34.400 soundtest[17081:818922] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<soundtest.ViewControllerTwo 0x7f92f1f20090> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key sfdfa.'
*** First throw call stack:
(
0 CoreFoundation 0x00000001067813f5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001082afbb7 objc_exception_throw + 45
2 CoreFoundation 0x0000000106781039 -[NSException raise] + 9
3 Foundation 0x0000000106b984d3 -[NSObject(NSKeyValueCoding) setValue:forKey:] + 259
4 CoreFoundation 0x00000001066cb400 -[NSArray makeObjectsPerformSelector:] + 224
5 UIKit 0x00000001072ce97d -[UINib instantiateWithOwner:options:] + 1506
6 UIKit 0x000000010712f698 -[UIViewController _loadViewFromNibNamed:bundle:] …Run Code Online (Sandbox Code Playgroud) 我想通过将每个[String : Int]字典显示为数组中的字符串,将我的字典转换为数组.
例如:
var myDict: [String : Int] = ["attack" : 1, "defend" : 5, "block" : 12]
Run Code Online (Sandbox Code Playgroud)
我知道myDict.keys.array并且myDict.values.array,但我希望它们一起出现在阵列中.这就是我的意思:
var myDictConvertedToArray = ["attack 1", "defend 5", "block 12"]
Run Code Online (Sandbox Code Playgroud)
提前致谢.