在目标C代码中使用NSLOG在Swift Enum上使用NSLOG时exc_bad_access崩溃
我正在崩溃线程21:exc_bad_access(代码= 1,地址= 0x101e)
在尝试在我的目标C代码中记录Swift Enum时。
枚举通过OBJ C代码的Swift函数调用的完成处理程序传递,
NSLog(@"Completed with operation: %@", operation);
枚举:
@objc public enum Operation: Int {
case Unknown
case Operation1
case Operation2
case Operation1And2
}
我疲倦了以下2个变体,并且该应用程序无法构建。 Xcode存在一个问题,可以防止我看到实际错误是什么。
NSLog(@"Completed with operation: %@", [operation description]);
NSLog(@"Completed with operation: %@", [operation value]);
我想在此枚举上进行基本操作,例如记录其值,做布尔比较。但是我对如何做这件事是对目标C的新手有些失落的。
I am getting a crash Thread 21: EXC_BAD_ACCESS (code=1, address=0x101e)
when trying to log a Swift enum in my Objective C code.
Enum passed in as the result of a completion handler on Swift function call from Obj C code:
NSLog(@"Completed with operation: %@", operation);
Enum:
@objc public enum Operation: Int {
case Unknown
case Operation1
case Operation2
case Operation1And2
}
I tired the following 2 variations and the app failed to build. There is an issue with Xcode that prevents me from being able to see what the actual error was.
NSLog(@"Completed with operation: %@", [operation description]);
NSLog(@"Completed with operation: %@", [operation value]);
I want to do basic operation on this enum like log its value, do boolean comparisons. But I am a little lost on how to do that as fairly new to Objective C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论