专门的DictionaryIterator._nativeNext()崩溃

时间:2018-12-04 09:58:33

标签: swift dictionary

Crashed: com.apple.main-thread
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x722f73726573552f

发生部分代码崩溃:

var totalNotifications : [Int : UserNotification] = [Int : UserNotification]()
func getPendingInvitesCount() -> Int
    {     
        AppDelegate.getAppDelegate().log.debug("getPendingInvitesCount()")

        var count = 0
        for notification in totalNotifications {
            if notification.1.msgClassName == RideInvitation.rideInviteMessageClassName {
                count += 1
            }
        }
            return count
    }
}

该应用在以下几行中崩溃:

for notification in totalNotifications {
    var totalNotifications : [Int : UserNotification] = [Int : UserNotification]()  
}

我将totalNotifications声明为:

var totalNotifications : [Int : UserNotification] = [Int : UserNotification]()

由于该应用程序崩溃,我做了很多尝试,但是我无法分析字典声明中为什么崩溃了,请帮助我找到解决方法。 预先感谢。

0 个答案:

没有答案