swift - 当我运行我的应用程序时出现错误

标签 swift xcode7

运行应用程序时出现错误:

Thread:1 EXC_BAD_INSTRUCTION(code=EXC_1386_INVOP, subcode=0×0)

我的代码:

 NotificationManager.updateNotif(params){
            (result:Bool) in
            if result {
                cell.backgroundColor = UIColor.whiteColor()
                // バッジを-1に
                let val = NotificationManager.sharedInstance.notifTabbar.badgeValue

                if Int(val!)!/*val?.toInt()*/ > 0 {
                    let badgStr = Int(val!)!/*val!.toInt()!*/ - 1
                    if badgStr == 0 {
                        NotificationManager.sharedInstance.notifTabbar.badgeValue = nil
                        UIApplication.sharedApplication().applicationIconBadgeNumber = 0
                    }
                    else{
                        NotificationManager.sharedInstance.notifTabbar.badgeValue = String(stringInterpolationSegment: badgStr)
                        UIApplication.sharedApplication().applicationIconBadgeNumber = badgStr

最佳答案

当头文件中存在未连接的链接时,通常会发生此类错误

即您将一个按钮添加到头文件中,然后按钮被删除,但头文件中的声明仍然存在。

检查您的 View Controller 和头文件以确保情况并非如此。

关于swift - 当我运行我的应用程序时出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34962362/

相关文章:

ios - 如何在 reloadData() 之后为 UITableViewCell 中的 UILabel 设置动画?

c - 带有可变参数的 Swift 和 C 回调

ruby - 在 N 个总 gem 中找不到 'cocoapods' (>= 0) (Gem::LoadError)

ios - Alamofire 总是给我错误状态代码 500 作为响应

ios - WebRTC iOS : Record Remote Audio stream using WebRTC

ios - 使用前置摄像头时需要镜像视频方向和处理旋转

ios - 如何在第一首歌曲播放完毕后自动在 tableview 中播放下一首歌曲

ios - 我如何在 Xcode 7.3 中启动非托管测试?

xcode7 - tvOS XC UI 测试滑动远程手势

SwiftUI:仅当输入不为空时才启用保存按钮