我知道有关此异常的问题很多,但没有适合我的情况的答案。
var count = sharedPref.getInt("flutter.badgeCount", 0) // line 12
ShortcutBadger.applyCount(applicationContext, count+1) // line 13
count
应该是一个整数,因为它sharedPref.getInt
返回一个整数,并applyCount()
接收一个整数作为第二个参数。在运行时在第12行抛出异常。我看不到任何东西吗?(我对Kotlin很陌生)
使用以下内容。这样可以解决问题。
var count = sharedPref.getLong("flutter.badgeCount", 0L)
ShortcutBadger.applyCount(applicationContext, count.toInt()+1)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句