The exception was not handled due to missing onError handler in the subscribe() method call

今天测试一个网络异常的情况下单回调,一直告诉我没有实现RxJava的onError回调,可是我检查来检查去,就是没有发现问题所在,明明我的BaseObser里实现了onError的统一处理了呀!就是给我报错

//代码一,提示没有实现onError处理
val currVersionName = AppUtil.getAppVersion(c)
        ApiImplCommBuss().checkVersion(AppUtil.getAppVersion(c),1)
            .subscribe { object:BaseObserver<JsonObjBase<Version>>() {
                    override fun onSuccess(t: JsonObjBase<Version>?) {
                        if (currVersionName.equals(it.data.versionName)) {
                            KLog.i(TAG, "已经是最新版本")
                            if (showToast) {
                                ToastUtil.show(c, "已经是最新版本!")
                            }
                        } else {
                            CommBussUIHelper.showVersionDialog(it.data, c) { it2 ->
                                BaseUIHelper.showWebPage(c, it.data.downloadUrl)
                                KLog.i(TAG, "跳转到下载页面")
                            }
                        }
                    }
                }
            }

然后,经过逐个字符的检查,发现是因为把圆括号()写成了花括号{}造成的

//代码二,没问题
val currVersionName = AppUtil.getAppVersion(c)
ApiImplCommBuss().checkVersion(AppUtil.getAppVersion(c),1)
    .subscribe (object:BaseObserver<JsonObjBase<Version>>() {
            override fun onSuccess(it: JsonObjBase<Version>) {
                if (currVersionName.equals(it.data.versionName)) {
                    KLog.i(TAG, "已经是最新版本")
                    if (showToast) {
                        ToastUtil.show(c, "已经是最新版本!")
                    }
                } else {
                    CommBussUIHelper.showVersionDialog(it.data, c) { it2 ->
                        BaseUIHelper.showWebPage(c, it.data.downloadUrl)
                        KLog.i(TAG, "跳转到下载页面")
                    }
                }
            }
        })

浪费了2个小时,记录一下!

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Welcome! You must be here because you want to write programs for your Mac. Well, you’ve definitely come to the right place. (Here for Pilates? Third door down, on the right.) By the time you finish this book, you’ll know everything you need to know to create fast, efficient, good-looking Mac OS X applications. The key to creating a modern Mac application is Cocoa. According to Apple, Cocoa is a set of object-oriented frameworks that provide a runtime environment for Mac OS X applications. As you make your way through this book, you’ll learn all about the Cocoa frameworks and runtime environment. For the moment, think of Cocoa as a programmer’s assistant that takes care of much of the housekeeping that goes along with Mac development. Almost every common task performed by a Mac application, from drawing a window to blinking the cursor in a text field, is handled for you when you write programs using Cocoa, freeing you up to concentrate on the code that makes your application unique. Cocoa provides a class for just about every one of your development needs. There are Cocoa classes for each piece of the Mac OS X user interface, from windows to menus, scrollbars to buttons, images to icons. If you can think of a user interface element you’d like to add to your own application, chances are very good that element is already implemented as a Cocoa class. Another benefit of using Cocoa is that it is tightly integrated with Mac OS X. Build your application using Cocoa, and your application will play well with others and will interface seamlessly with Mac OS X elements like the Finder and the Dock. Cocoa has been around in one form or another since 1986. The technologies that we call Cocoa evolved from the NeXTStep AppKit, the application building tools developed for the NeXT platform. When Apple bought NeXT in 1996, they began building a new version of the Mac OS, what we now know as OS X, basing much of the new operating system on technologies acquired from NeXT.

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值