fatal error: NSArray element failed to match the Swift Array Element type

后端 未结 4 1053
臣服心动
臣服心动 2020-12-05 17:16

Suddenly I\'v started getting run time error as,

fatal error: NSArray element failed to match the Swift Array Element type

I\'v declared my

4条回答
  •  失恋的感觉
    2020-12-05 18:01

    Could it be a conflict between swift type and ObjectiveC's one? Because I experienced a similar situation trying to loop on a [NSMutableDisctionary] both with .forEach{} and for ... in way, but it gave me your same error (NSArray element failed to match the Swift Array Element type). When I changed the type to [Dictionary] all worked well. Now, [] was introduced in Swift, and types with prefix NS... in ObjectiveC.

提交回复
热议问题