为什么调试器'po'与'var'vs'let'一起使用?

时间:2014-10-07 20:33:44

标签: swift lldb

为什么调试器'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':

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>

1 个答案:

答案 0 :(得分:0)

调试信息中存在一些错误&#34; let&#34;使lldb无法正确理解它们的变量。这些都应该在即将发布的Xcode版本中修复。获得新版本后,您需要重新编译代码,但之后您应该能够看到它们。

如果您不提交http://bugreporter.apple.com的错误。