找不到分类
针对于swift中找不到引用第三方OC库找不到内部分类方法时,需设置Build Setting->Other Linker Flags,添加-Objc选项
Application tried to present modally an active controller
在定义了nav之后并没有使用,而是直接present了VC,导致如下崩溃:
present崩溃
猜想可能是生成Navigationcontroller后,系统就认为它是active的了,所以会报错“尝试present一个已为active的控制器”,但是需要注意即使定义了nav,但是如果使用self.navigationController?.pushViewController(loginVC, animated: true)是可以正常跳转的
两种方式
解决方案有两个:1.去除nav定义 或 2.present方法传参nav而不是VC
在上一个问题使用方案1解决后,也就是直接present vc而不是nav的情况下,会出现
【1】崩溃1:Cannot form weak reference to instance (0x7fa47bc4e2e0) of class WYLoginSDKWebViewController. It is possible that this object was over-released, or is in the process of deallocation.
delegateError
这是因为SDK内部是使用self.navigationController进行跳转的,但是此时navigationController为nil(因为上一步是直接使用VC跳转的)所以webVC就是个局部变量,并没有实际跳转,所以方法执行完就被销毁了走到了dealloc方法中,但是dealloc中使用了self.wkwebview ,而wkwebview的懒加载里面有个设置delegate,然后就GG了
【2】Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer
deallocError
同7.1,这是因为SDK内部是使用self.navigationController进行跳转的,但是此时navigationController为nil(因为上一步是直接使用VC跳转的)所以webVC就是个局部变量,并没有实际跳转,所以方法执行完就被销毁了走到了dealloc方法中,但是dealloc中试图去移除observer,但是其实observer是在viewdidload方法才添加的,viewcontroller根本显示加载成功,当然viewdidload没有执行到,observer并没有添加,这个时候去移除,然后就GG了
【tip】所以遇到崩溃时,查看堆栈信息,永远是最有效的方法









网友评论