【发布时间】:2014-10-07 20:33:43
【问题描述】:
为什么调试器 'po' 与 var 一起工作:
var myDict = currentImageDownloader.dict
如下图:
(lldb) po myDict
Some
{
[0] = {
key = "ispublic"
value = (instance_type = Builtin.RawPointer = 0xb000000000000013)
(lldb) po myDict
error: <EXPR>:1:1: error: use of unresolved identifier 'myDict'
myDict
...
但是通过“让”:
let myDict = currentImageDownloader.dict
调试器“po”不起作用:
(lldb) po myDict
error: <EXPR>:1:1: error: use of unresolved identifier 'myDict'
myDict
^
虽然我可以使用调试器的 frame 命令通过 'let' 或 'var' 查看所有内容:
(lldb) fr v
(UICollectionView) collectionView = 0x00007fc2d2821600 {
UIKit.UIScrollView = {
UIKit.UIView = {
UIKit.UIResponder = {
ObjectiveC.NSObject = {}
}
}
}
}
(NSIndexPath) indexPath = 0xc000000000000016 {
ObjectiveC.NSObject = {}
}
(FlickrSwift.ViewController) self = 0x00007fc2d2580f20 {
UIKit.UIViewController = {
UIKit.UIResponder = {
ObjectiveC.NSObject = {}
}
}
collectionView = Some
}
(FlickrSwift.ImageDownloader) currentImageDownloader = 0x00007fc2d4449750 {
image = nil
bigImage = nil
dict = Some {
[0] = {
key = "ispublic"
value = (instance_type = Builtin.RawPointer = 0xb000000000000013)
}
[1] = {
key = "height_sq"
value = (instance_type = Builtin.RawPointer = 0xb0000000000004b3)
}
[2] = {
key = "url_m"
value = (instance_type = Builtin.RawPointer = 0x00007fc2d25131a0 -> 0x00000001088e7488 (void *)0x00000001088e7438: __NSCFString)
}
[3] = {
key = "title"
value = (instance_type = Builtin.RawPointer = 0x00007fc2d25a7030 -> 0x00000001088e7488 (void *)0x00000001088e7438: __NSCFString)
}
[4] = {
key = "isfamily"
value = (instance_type = Builtin.RawPointer = 0xb000000000000003)
}
...
}
descString = nil
}
(AnyObject) cell = <variable not available>
(UIImageView) photoImageView = <variable not available>
(UIImage) image = <variable not available>
【问题讨论】: