如何解决使用未解析的标识符“ className”:Xcode可以识别文件中定义的所有类,除了一个
我有这些Swift文件。每个都包含一个名称相似的类。
if let _ = CMSessionManager.sharedInstance.tokenExpiration {
sessionExpired = CMSessionManager.sharedInstance.tokenExpiration!.isLessThanDate(dateToCompare: Date())
}
let error = CMError(code: errorCode,title: errorTitle,message: errorDescription)
if error.code == 1160 || error.code == 401 || sessionExpired {
//Session expired --> Logout
showAlertAndPop(title: (error.title)!,message: (error.message)!,action: {
// The code inside the disconnect function has been commented
// Check comment inside of function
CMProfileManager.sharedInstance.disconnect()
})
// return
}
使用 CMSessionManager 类的代码可以正常工作:
if let _ = CMSessionManager.sharedInstance.tokenExpiration {
sessionExpired = CMSessionManager.sharedInstance.tokenExpiration!.isLessThanDate(dateToCompare: Date())
}
但是,使用CMProfileManager
的代码会引发错误:
CMProfileManager.sharedInstance.disconnect()
错误:
使用未解析的标识符 CMProfileManager
我不明白,如果Xcode都以相同的方式在相同的位置定义,为什么Xcode找不到 CMSessionManager 而找不到 CMProfileManager 。
class CMProfileManager {
static let sharedInstance = CMProfileManager()
}
解决方法
如果无法解决,请清除构建。..重新启动Xcode
。.在右侧面板中检查Target Membership
文件的“ CMProfileManager.swift
”。您的目标被检查了吗
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。