The issue there is that NSString
's intValue
property returns an Int32
what you need is integerValue
which returns an Int
.
Note that when coding in Swift you should always use Swift native types. You don't need to cast your string to NSString to convert it to integer. You can simply initialize a new integer from your string using Int
initializer.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…