Swift 如何排除错误代码";exc“错误”访问(代码=1,地址=0x20)";
我的应用程序执行类函数时遇到问题。错误代码为: EXC错误访问(代码=1,地址=0x20) 我的问题源代码是:Swift 如何排除错误代码";exc“错误”访问(代码=1,地址=0x20)";,swift,exc-bad-access,Swift,Exc Bad Access,我的应用程序执行类函数时遇到问题。错误代码为: EXC错误访问(代码=1,地址=0x20) 我的问题源代码是: func setupClient(){ let configuration = ConfigData.sharedInstance if (configuration.sipLogin == SipLoginStatus.SipLoginStatusLoggedOut && configuration.sipUsername?.length == 0)
func setupClient(){
let configuration = ConfigData.sharedInstance
if (configuration.sipLogin == SipLoginStatus.SipLoginStatusLoggedOut && configuration.sipUsername?.length == 0) && (configuration.acsLogin == ACSLoginStatus.ACSLoginStatusLoggedOut && configuration.acsUsername?.length == 0){
return
}
//the app is broken here with the code "exc_bad_access(code=1,address=0x20)" and CSClient is a Class imported by a third party framework.
CSClient.setLogLevel(CSLogLevel.Debug)
...
}
有人能告诉我如何解决这个问题吗?您有权访问
CSClient.setLogLevel
的实现来显示它吗?在这种情况下,我首先要检查的是配置。sipUsername?.length==前面条件的0部分。如果sipUsername恰好为零,则条件可能会失败。根据编译器优化代码的方式,它可能指向以下代码行(这有时会产生误导,但不可避免)您有权访问CSClient.setLogLevel的实现来显示它吗?在这种情况下,我要检查的第一件事是配置.sipUsername?.length==前面条件的0部分。如果sipUsername恰好为零,则条件可能会失败。根据编译器优化代码的方式,它可能指向以下代码行(这有时会产生误导,但不可避免)